/* The app wears the same clothes as the story site: Jeju Myeongjo and Lora on
   a sky background, glass cards with the yellow accent. */
@font-face {
  font-family: "Jeju Myeongjo";
  src: url("../assets/fonts/JejuMyeongjo-Regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("../assets/fonts/Lora-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #090909;
  --sky: #8ebacb;
  --gold: #ffda51;
  --glass-border: rgba(255,255,255,.56);
  --glass-fill: rgba(255,255,255,.16);
  --glass-ring: 0 0 0 8px rgba(0,0,0,.16);
  --muted: rgba(9,9,9,.62);
  --line: rgba(9,9,9,.14);
  --good: #0f7a4f;
  --bad: #a52020;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(#74a9c1, #c4d8d8) fixed;
  font-family: "Jeju Myeongjo", Georgia, serif;
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3, h4 { font-family: "Lora", Georgia, serif; font-weight: 500; letter-spacing: -.02em; margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select, textarea { font: inherit; color: inherit; }

/* --- chrome ------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: clamp(14px, 2vw, 30px);
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(142,186,203,.72);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  border-bottom: 1px solid rgba(255,255,255,.4);
}
.bar img { display: block; width: 132px; height: auto; }
.bar nav { display: flex; gap: clamp(10px, 1.6vw, 24px); margin-left: auto; align-items: center; }
.bar nav a { text-decoration: none; padding: 6px 2px; border-bottom: 2px solid transparent; white-space: nowrap; }
.bar nav a:hover { opacity: .65; }
.bar nav a.on { border-bottom-color: var(--ink); }
.x-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #fff; text-decoration: none; }
.x-link:hover { background: #333; }
.x-link svg { width: 15px; height: 15px; fill: currentColor; }

.wallet-button {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 38px; padding: 0 16px;
  border: 0; border-radius: 9px;
  background: var(--ink); color: #fff;
  box-shadow: 0 0 0 5px rgba(255,255,255,.45);
  transition: background 160ms ease, transform 160ms ease;
}
.wallet-button:hover { background: #262626; transform: translateY(-1px); }
.wallet-button.on { background: #fff; color: var(--ink); box-shadow: 0 0 0 5px rgba(255,255,255,.3); }

main { max-width: 1180px; margin: 0 auto; padding: clamp(22px, 4vh, 44px) clamp(16px, 4vw, 48px) 90px; }

/* --- cards -------------------------------------------------------------- */
.card {
  border: 2px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass-fill);
  box-shadow: var(--glass-ring);
  -webkit-backdrop-filter: blur(60px); backdrop-filter: blur(60px);
  padding: clamp(18px, 2.2vw, 28px);
}
.card + .card { margin-top: 20px; }
.card h2 { font-size: clamp(19px, 1.6vw, 24px); margin-bottom: 4px; }
.card h3 { font-size: 17px; margin-bottom: 10px; }
.lede { margin: 0 0 20px; color: var(--muted); max-width: 62ch; }
.grid { display: grid; gap: 20px; }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1.35fr 1fr; align-items: start; } }

/* --- forms -------------------------------------------------------------- */
.field { display: block; margin-bottom: 15px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: rgba(255,255,255,.66);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.field textarea { min-height: 76px; resize: vertical; }
.row { display: grid; gap: 15px; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } }

.switch { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 18px 0; }
.switch input { width: 42px; height: 24px; margin: 0; accent-color: var(--ink); flex: none; }
.switch div { font-size: 14px; }
.switch strong { display: block; font-size: 15px; }
.switch span { color: var(--muted); }

.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px; width: 100%;
  border: 0; border-radius: 10px;
  transition: transform 160ms ease, background 160ms ease;
}
.primary { background: var(--ink); color: #fff; box-shadow: 0 0 0 6px rgba(255,255,255,.4); }
.primary:hover:not(:disabled) { transform: translateY(-1px); background: #262626; }
.secondary { background: rgba(255,255,255,.8); border: 1px solid var(--line); }
.secondary:hover:not(:disabled) { background: #fff; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* --- data --------------------------------------------------------------- */
dl.stats { display: grid; gap: 7px; margin: 0; font-size: 14px; }
dl.stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
dl.stats dt { color: var(--muted); }
dl.stats dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--good); }
.down { color: var(--bad); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; line-height: 1.5; border: 1px solid var(--line); background: rgba(255,255,255,.6); }
.badge.gold { background: var(--gold); border-color: rgba(0,0,0,.16); }
.badge.warn { background: #ffd2d2; border-color: #c98b8b; }
.badge.ok { background: #d6f0e2; border-color: #8cbfa6; }

.note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.notice { padding: 12px 14px; border-radius: 10px; background: rgba(255,255,255,.55); border: 1px solid var(--line); font-size: 14px; margin-bottom: 18px; }
.notice.warn { background: #ffe9e9; border-color: #d8a7a7; }
.notice.gold { background: var(--gold); border-color: rgba(0,0,0,.18); }
.error { color: var(--bad); font-size: 14px; margin-top: 12px; white-space: pre-wrap; }
.ok-text { color: var(--good); font-size: 14px; margin-top: 12px; }

.list { display: grid; gap: 14px; }
.coin-row { display: flex; gap: 14px; align-items: center; text-decoration: none; }
.coin-row .ico { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--gold); flex: none; }
.coin-row .meta { flex: 1; min-width: 0; }
.coin-row .meta strong { display: block; }
.coin-row .meta span { font-size: 13px; color: var(--muted); word-break: break-all; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.copy { border: 1px solid var(--line); background: rgba(255,255,255,.7); border-radius: 7px; padding: 3px 9px; font-size: 12px; margin-left: 8px; }

.chart { width: 100%; aspect-ratio: 16 / 10; min-height: 340px; border: 0; border-radius: 12px; background: rgba(255,255,255,.4); display: block; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { flex: 1; min-height: 38px; border: 1px solid var(--line); background: rgba(255,255,255,.55); border-radius: 9px; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.secondary .spinner, .loading .spinner { border-color: rgba(9,9,9,.25); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { color: var(--muted); display: flex; align-items: center; gap: 10px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

table.positions { width: 100%; border-collapse: collapse; font-size: 14px; }
table.positions th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12.5px; padding-bottom: 8px; }
table.positions td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: middle; }
table.positions td:last-child, table.positions th:last-child { text-align: right; }
table.positions button { min-height: 32px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.8); }
