:root {
  --wallet-ink: #45111e;
  --wallet-muted: #8d7278;
  --wallet-cream: #fffaf0;
  --wallet-paper: #fffdf9;
  --wallet-line: #f0d8d2;
  --wallet-red: #bb1737;
  --wallet-orange: #f5a623;
  --wallet-violet: #9f24c8;
  --wallet-shadow: 0 22px 60px rgba(91, 31, 45, .11);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #fff9ef; }
body.wallet-app {
  min-height: 100vh;
  margin: 0;
  color: var(--wallet-ink);
  font-family: "Source Sans Pro", "Noto Sans KR", sans-serif;
  background:
    linear-gradient(rgba(236, 188, 124, .11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 188, 124, .11) 1px, transparent 1px),
    radial-gradient(circle at 8% 2%, rgba(255, 220, 116, .28), transparent 26rem),
    radial-gradient(circle at 96% 22%, rgba(246, 183, 193, .24), transparent 28rem),
    #fffaf2;
  background-size: 24px 24px, 24px 24px, auto, auto, auto;
}

.wallet-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 70px; }
.wallet-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.wallet-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--wallet-ink); text-decoration: none; }
.wallet-brand img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 8px 16px rgba(187, 23, 55, .16)); }
.wallet-brand strong { display: block; font-size: 20px; letter-spacing: -.02em; }
.wallet-brand span span { display: block; margin-top: 1px; color: var(--wallet-muted); font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.wallet-signout { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--wallet-line); border-radius: 14px; color: var(--wallet-ink); background: rgba(255,255,255,.7); font-size: 13px; font-weight: 700; text-decoration: none; }

.wallet-card { border: 1px solid var(--wallet-line); border-radius: 28px; background: rgba(255,253,249,.92); box-shadow: var(--wallet-shadow); }
.wallet-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; padding: 32px; margin-bottom: 20px; }
.wallet-hero::after { content: ""; position: absolute; width: 330px; height: 330px; right: -150px; top: -170px; border-radius: 50%; background: linear-gradient(145deg, rgba(247,173,34,.25), rgba(190,22,56,.16)); }
.eyebrow { margin: 0 0 8px; color: var(--wallet-red); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.wallet-hero h1 { margin: 0; color: var(--wallet-ink); font-size: clamp(29px, 4vw, 48px); line-height: 1.08; letter-spacing: -.045em; }
.wallet-hero p { margin: 12px 0 0; color: var(--wallet-muted); font-size: 15px; }
.member-summary { position: relative; z-index: 1; align-self: stretch; padding: 20px; border: 1px solid rgba(236, 206, 197, .85); border-radius: 22px; background: rgba(255,255,255,.76); backdrop-filter: blur(10px); }
.member-line { display: flex; align-items: center; gap: 12px; }
.member-avatar { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--wallet-red), #e45761); font-size: 18px; font-weight: 800; box-shadow: 0 10px 24px rgba(187,23,55,.22); }
.member-name strong { display: block; font-size: 17px; }
.member-name span { color: #2aa66a; font-size: 12px; font-weight: 800; }
.member-detail { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--wallet-line); }
.member-detail small { display: block; margin-bottom: 4px; color: var(--wallet-muted); font-size: 11px; }
.member-detail code { display: block; overflow: hidden; color: var(--wallet-ink); font-family: inherit; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.wallet-register-note { display: block; margin-top: 7px; color: var(--wallet-red); font-size: 10px; font-weight: 800; }

.balance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.balance-card { position: relative; overflow: hidden; min-height: 166px; padding: 22px; border: 1px solid var(--wallet-line); border-radius: 24px; background: rgba(255,255,255,.82); box-shadow: 0 12px 34px rgba(84, 30, 42, .06); }
.balance-card::after { content: ""; position: absolute; right: -34px; bottom: -48px; width: 120px; height: 120px; border-radius: 50%; background: var(--balance-glow); opacity: .15; }
.balance-card.coin { --balance-color: #bb1737; --balance-glow: #bb1737; }
.balance-card.meme { --balance-color: #f09019; --balance-glow: #f6b035; }
.balance-card.coop { --balance-color: #a52eca; --balance-glow: #aa36d1; }
.balance-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.balance-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: #fff; background: var(--balance-color); font-weight: 900; box-shadow: 0 8px 18px rgba(120, 30, 50, .15); }
.balance-label { color: var(--wallet-muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.balance-value { position: relative; z-index: 1; margin-top: 28px; font-size: clamp(23px, 3vw, 34px); font-weight: 800; line-height: 1; letter-spacing: -.035em; word-break: break-all; }
.balance-unit { margin-top: 8px; color: var(--balance-color); font-size: 12px; font-weight: 800; }

.wallet-main-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; }
.side-stack { display: grid; align-content: start; gap: 20px; }
.section-card { padding: 28px; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.section-head p { margin: 5px 0 0; color: var(--wallet-muted); font-size: 13px; }
.rate-pill { flex: 0 0 auto; padding: 8px 11px; border: 1px solid #f2d78d; border-radius: 99px; color: #a86608; background: #fff7dc; font-size: 11px; font-weight: 800; }

.asset-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px; margin-bottom: 18px; border: 1px solid var(--wallet-line); border-radius: 17px; background: #fff9f4; }
.asset-switch button { padding: 12px; border: 0; border-radius: 12px; color: var(--wallet-muted); background: transparent; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.asset-switch button.active { color: #fff; background: linear-gradient(135deg, var(--wallet-red), #dc4b5b); box-shadow: 0 8px 20px rgba(187,23,55,.2); }
.swap-box { padding: 18px; border: 1px solid var(--wallet-line); border-radius: 20px; background: #fff; }
.swap-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: var(--wallet-muted); font-size: 12px; font-weight: 700; }
.swap-label button { padding: 0; border: 0; color: var(--wallet-red); background: none; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.amount-row { display: flex; align-items: center; gap: 12px; }
.amount-row input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--wallet-ink); background: transparent; font: inherit; font-size: clamp(24px, 4vw, 34px); font-weight: 800; letter-spacing: -.03em; }
.asset-code { flex: 0 0 auto; padding: 7px 10px; border-radius: 10px; color: var(--wallet-ink); background: var(--wallet-cream); font-size: 12px; font-weight: 800; }
.swap-arrow { display: grid; place-items: center; width: 42px; height: 42px; margin: -2px auto; border: 6px solid var(--wallet-paper); border-radius: 50%; color: #fff; background: var(--wallet-ink); position: relative; z-index: 2; }
.swap-preview { margin: 16px 0 18px; padding: 14px 16px; border: 1px dashed #ebc4bc; border-radius: 16px; background: #fffaf7; }
.preview-row { display: flex; justify-content: space-between; gap: 16px; color: var(--wallet-muted); font-size: 12px; }
.preview-row + .preview-row { margin-top: 8px; }
.preview-row strong { color: var(--wallet-ink); }
.swap-submit { width: 100%; padding: 15px 18px; border: 0; border-radius: 15px; color: #fff; background: linear-gradient(135deg, var(--wallet-red), #d84559); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 13px 28px rgba(187,23,55,.2); }
.swap-submit:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }

.history-list { display: grid; gap: 10px; }
.history-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--wallet-line); border-radius: 17px; background: rgba(255,255,255,.72); }
.history-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--wallet-red); background: #fff0ef; font-size: 18px; font-weight: 900; }
.history-icon.withdraw { color: var(--wallet-violet); background: #f7eafd; }
.history-main strong { display: block; font-size: 14px; }
.history-main span { display: block; margin-top: 3px; color: var(--wallet-muted); font-size: 11px; }
.history-status { text-align: right; }
.history-status strong { display: block; color: var(--wallet-violet); font-size: 13px; }
.history-status span { display: inline-block; margin-top: 4px; padding: 4px 7px; border-radius: 99px; color: #967006; background: #fff5cf; font-size: 9px; font-weight: 800; }
.history-status span.completed { color: #23855c; background: #e5f8ee; }
.empty-state { padding: 40px 10px; color: var(--wallet-muted); text-align: center; font-size: 13px; }

.withdraw-card { position: relative; overflow: hidden; }
.withdraw-card.locked { background: rgba(252,248,245,.86); }
.withdraw-head { margin-bottom: 18px; }
.withdraw-state { flex: 0 0 auto; padding: 7px 10px; border-radius: 99px; color: #9a6d72; background: #f4e8e6; font-size: 10px; font-weight: 800; }
.withdraw-state.enabled { color: #23855c; background: #e5f8ee; }
.withdraw-balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; margin-bottom: 14px; border: 1px solid #ead0ca; border-radius: 15px; background: #fff8f5; }
.withdraw-balance span { color: var(--wallet-muted); font-size: 11px; font-weight: 700; }
.withdraw-balance strong { font-size: 14px; }
.wallet-field { display: block; margin-bottom: 12px; }
.wallet-field > span { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--wallet-muted); font-size: 11px; font-weight: 800; }
.wallet-field em { color: var(--wallet-red); font-style: normal; font-size: 9px; }
.wallet-field > div { display: flex; align-items: center; gap: 8px; padding: 12px 13px; border: 1px solid var(--wallet-line); border-radius: 14px; background: #fff; }
.wallet-field input { min-width: 0; width: 100%; border: 0; outline: none; color: var(--wallet-ink); background: transparent; font: inherit; font-size: 13px; font-weight: 700; }
.wallet-field b { flex: 0 0 auto; font-size: 10px; }
.withdraw-preview { padding: 12px 14px; margin: 15px 0; border: 1px dashed #ebc4bc; border-radius: 14px; background: #fffaf7; }
.withdraw-preview div { display: flex; justify-content: space-between; gap: 10px; color: var(--wallet-muted); font-size: 11px; }
.withdraw-preview div + div { margin-top: 7px; }
.withdraw-preview strong { color: var(--wallet-ink); }
.withdraw-submit { width: 100%; padding: 13px; border: 0; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #8f25b4, #b43bd4); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; box-shadow: 0 10px 22px rgba(159,36,200,.18); }
.withdraw-submit:disabled { cursor: not-allowed; opacity: .4; box-shadow: none; }
.withdraw-locked { display: grid; place-items: center; min-height: 112px; padding: 20px; border: 1px dashed #dec8c4; border-radius: 17px; color: var(--wallet-muted); background: rgba(255,255,255,.5); text-align: center; }
.withdraw-locked span { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 8px; border-radius: 50%; color: #fff; background: #b79fa3; font-size: 20px; }
.withdraw-locked strong { font-size: 12px; }
.confirm-wallet { max-width: 235px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.flash { margin-bottom: 16px; padding: 13px 16px; border-radius: 14px; font-size: 13px; font-weight: 700; }
.flash.success { color: #1f7a54; background: #e8f8ef; border: 1px solid #bce8d0; }
.flash.error { color: #a22035; background: #fff0f1; border: 1px solid #f1c4ca; }

.signin-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.signin-card { overflow: hidden; display: grid; grid-template-columns: .88fr 1.12fr; width: min(920px, 100%); min-height: 570px; }
.signin-visual { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 42px; color: #fff; background: linear-gradient(150deg, #561327, #a71535 62%, #e15d4f); }
.signin-visual::before, .signin-visual::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.signin-visual::before { width: 340px; height: 340px; right: -175px; top: -85px; }
.signin-visual::after { width: 220px; height: 220px; left: -100px; bottom: -90px; }
.signin-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.signin-brand img { width: 48px; height: 48px; object-fit: contain; }
.signin-brand strong { font-size: 22px; }
.signin-copy { position: relative; z-index: 1; }
.signin-copy p { margin: 0 0 8px; color: #ffd8c6; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.signin-copy h1 { margin: 0; font-size: 36px; line-height: 1.16; letter-spacing: -.04em; }
.signin-copy span { display: block; margin-top: 14px; color: rgba(255,255,255,.68); font-size: 13px; line-height: 1.65; }
.signin-form-wrap { display: flex; flex-direction: column; justify-content: center; padding: 50px; background: rgba(255,253,249,.97); }
.signin-form-wrap h2 { margin: 0; font-size: 29px; letter-spacing: -.04em; }
.signin-form-wrap > p { margin: 8px 0 30px; color: var(--wallet-muted); font-size: 13px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin: 0 0 7px; color: var(--wallet-muted); font-size: 12px; font-weight: 800; }
.field input { width: 100%; padding: 15px 16px; border: 1px solid var(--wallet-line); border-radius: 14px; outline: none; color: var(--wallet-ink); background: #fff; font: inherit; font-size: 15px; }
.field input:focus { border-color: #d86270; box-shadow: 0 0 0 4px rgba(187,23,55,.08); }
.signin-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 3px 0 24px; color: var(--wallet-muted); font-size: 12px; }
.signin-actions label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.signin-button { width: 100%; padding: 16px; border: 0; border-radius: 15px; color: #fff; background: linear-gradient(135deg, var(--wallet-red), #df4c59); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 14px 30px rgba(187,23,55,.24); }
.signin-security { margin-top: 22px; color: var(--wallet-muted); font-size: 11px; text-align: center; }

.confirm-layer { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(48,11,23,.5); backdrop-filter: blur(8px); }
.confirm-layer.open { display: flex; }
.confirm-card { width: min(430px, 100%); padding: 26px; border-radius: 24px; background: #fffdf9; box-shadow: 0 30px 90px rgba(31,7,15,.3); }
.confirm-card h3 { margin: 0 0 8px; font-size: 21px; }
.confirm-card > p { margin: 0 0 18px; color: var(--wallet-muted); font-size: 13px; }
.confirm-summary { padding: 14px; border: 1px solid var(--wallet-line); border-radius: 15px; background: #fff8f5; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.confirm-actions button { padding: 13px; border-radius: 13px; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.confirm-cancel { border: 1px solid var(--wallet-line); color: var(--wallet-ink); background: #fff; }
.confirm-submit { border: 0; color: #fff; background: var(--wallet-red); }

@media (max-width: 860px) {
  .wallet-hero, .wallet-main-grid { grid-template-columns: 1fr; }
  .balance-grid { grid-template-columns: 1fr 1fr; }
  .balance-card.coop { grid-column: 1 / -1; }
  .signin-card { grid-template-columns: 1fr; min-height: auto; }
  .signin-visual { min-height: 250px; padding: 30px; }
  .signin-form-wrap { padding: 36px 30px; }
}

@media (max-width: 560px) {
  .wallet-shell { width: min(100% - 24px, 1180px); padding-top: 16px; }
  .wallet-topbar { margin-bottom: 15px; }
  .wallet-brand img { width: 36px; height: 36px; }
  .wallet-brand strong { font-size: 17px; }
  .wallet-signout { padding: 8px 10px; font-size: 11px; }
  .wallet-hero { padding: 22px; border-radius: 23px; }
  .balance-grid { grid-template-columns: 1fr; gap: 11px; }
  .balance-card, .balance-card.coop { grid-column: auto; min-height: 138px; padding: 18px; }
  .balance-value { margin-top: 20px; }
  .section-card { padding: 20px; border-radius: 23px; }
  .section-head { display: block; }
  .rate-pill { display: inline-block; margin-top: 12px; }
  .wallet-main-grid { gap: 14px; }
  .signin-shell { padding: 12px; }
  .signin-card { border-radius: 24px; }
  .signin-visual { min-height: 220px; padding: 25px; }
  .signin-copy h1 { font-size: 30px; }
  .signin-form-wrap { padding: 30px 24px; }
}
