/* CoKhong portal. Brand: deep green, midnight navy, gold on cream. Light + dark (prefers-color-scheme). Mobile first. */
:root {
  --bg: #f6f3ec; --surface: #ffffff; --surface-2: #f1ede3; --text: #172033; --muted: #4a5568; --border: #d8d1c1;
  --primary: #1d5c4b; --primary-hover: #164a3c; --primary-ink: #ffffff; --gold: #b8913f; --gold-text: #7a5a17;
  --focus: #a8741a; --danger: #a61b1b; --danger-ink: #ffffff;
  --good-bg: #e2f2e8; --good: #14532d; --warn-bg: #fcf1d6; --warn: #6e4400; --bad-bg: #fbe4e4; --bad: #8f1d1d; --neutral-bg: #e9edf2; --neutral: #334155;
  --header: #111a28; --header-ink: #f1ead8; --shadow: 0 1px 2px rgba(17, 26, 40, .06), 0 4px 16px rgba(17, 26, 40, .06);
  --radius: 12px; --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d141f; --surface: #152030; --surface-2: #1b2839; --text: #eef1f5; --muted: #aab5c5; --border: #2c3b51;
    --primary: #d4b36a; --primary-hover: #e2c784; --primary-ink: #121a26; --gold: #d4b36a; --gold-text: #e2c784;
    --focus: #f0cf7e; --danger: #f08b8b; --danger-ink: #1b0b0b;
    --good-bg: #123325; --good: #a3e3bf; --warn-bg: #382a0b; --warn: #f6d68d; --bad-bg: #3b1616; --bad: #ffb8b8; --neutral-bg: #243146; --neutral: #d5dce7;
    --header: #0a111b; --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); overflow-x: hidden; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.12rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; margin: 0; }
p { margin: 0 0 .75em; }
a { color: var(--primary); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) { a { color: var(--gold-text); } }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--focus); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }
.mono, code, .mono-in { font-family: var(--mono); font-size: .92em; }
.muted, .sub { color: var(--muted); }
.sub { display: block; font-size: .85rem; }
.small { font-size: .9rem; }
.center { text-align: center; }
.big { font-size: 1.8rem; font-weight: 700; margin: 0 0 .3em; }
.wrap, .trunc, .addr-v { overflow-wrap: anywhere; word-break: break-word; }
.trunc { display: inline-block; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---------- chrome */
.mode-banner { padding: 8px 16px; text-align: center; font-weight: 600; font-size: .9rem; }
.mode-banner.mock { background: #fcd34d; color: #1c1400; }
.mode-banner.warn { background: #b91c1c; color: #ffffff; }
.topbar { background: var(--header); color: var(--header-ink); border-bottom: 2px solid var(--gold); position: relative; }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; }
.brand img { height: 40px; width: auto; display: block; }
.portal-tag { color: var(--header-ink); font-size: .8rem; border: 1px solid rgba(241, 234, 216, .5); border-radius: 999px; padding: 2px 10px; }
.portal-tag:empty { display: none; }
.menu-btn { margin-left: auto; background: transparent; border: 1px solid rgba(241, 234, 216, .5); border-radius: 8px; width: 44px; height: 44px; display: inline-grid; place-items: center; cursor: pointer; }
.menu-ico, .menu-ico::before, .menu-ico::after { display: block; width: 20px; height: 2px; background: var(--header-ink); position: relative; content: ""; }
.menu-ico::before { position: absolute; top: -6px; } .menu-ico::after { position: absolute; top: 6px; }
.nav { display: none; flex-basis: 100%; order: 5; }
.nav.open { display: block; }
.nav ul { list-style: none; margin: 0; padding: 4px 0 8px; display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav .linkish { display: block; color: var(--header-ink); text-decoration: none; padding: 10px 12px; border-radius: 8px; font: inherit; font-weight: 500; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.nav a:hover, .nav .linkish:hover { background: rgba(241, 234, 216, .1); }
.nav a[aria-current="page"] { background: rgba(212, 179, 106, .18); box-shadow: inset 3px 0 0 #d4b36a; }
.nav :focus-visible, .lang :focus-visible, .menu-btn:focus-visible { outline-color: #f0cf7e; }
.lang { display: inline-flex; border: 1px solid rgba(241, 234, 216, .5); border-radius: 8px; overflow: hidden; }
.lang button { background: transparent; color: var(--header-ink); border: 0; min-width: 44px; min-height: 40px; font: 600 .85rem var(--font); cursor: pointer; }
.lang button[aria-pressed="true"] { background: #d4b36a; color: #121a26; }
@media (min-width: 960px) {
  .menu-btn { display: none; }
  .nav { display: block; flex-basis: auto; order: 0; margin-left: auto; }
  .nav ul { flex-direction: row; padding: 0; }
  .nav a, .nav .linkish { padding: 8px 10px; width: auto; }
  .nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 #d4b36a; }
}

/* ---------- layout */
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 64px; outline: none; }
.narrow { max-width: 460px; margin: 0 auto; }
.lead { color: var(--muted); max-width: 70ch; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .grid.two, .grid.wd { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.addrs { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (min-width: 1000px) { .grid.wd { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid > .card, .grid > .stack > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.loading { color: var(--muted); padding: 24px 0; }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 600 .95rem var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { min-height: 40px; padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
a.btn.primary { color: var(--primary-ink); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 600; font-size: .95rem; }
.req { color: var(--bad); } .opt { color: var(--muted); font-weight: 400; font-size: .85rem; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--muted); background: var(--surface); color: var(--text); font: inherit; }
input[aria-invalid="true"] { border-color: var(--bad); border-width: 2px; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.ferr { color: var(--bad); font-size: .88rem; font-weight: 600; margin: 0; }
.ferr::before { content: "⚠ "; }
.pw { display: flex; gap: 6px; }
.pw input { flex: 1; min-width: 0; }
.pw-toggle { min-width: 64px; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 .85rem var(--font); cursor: pointer; }
.form-msg { padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.form-msg.err { background: var(--bad-bg); color: var(--bad); }
.form-msg.warn { background: var(--warn-bg); color: var(--warn); }
.form-msg.ok { background: var(--good-bg); color: var(--good); }
.form-msg[hidden] { display: none; }

/* ---------- data display */
.kv { margin: 0; display: grid; gap: 8px; }
.kv > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; line-height: 1.6; background: var(--neutral-bg); color: var(--neutral); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.env { background: #fcd34d; color: #1c1400; letter-spacing: .04em; }
.badge.env.mainnet { background: var(--bad-bg); color: var(--bad); }
.callout { border-radius: 10px; padding: 12px 14px; border-left: 4px solid currentColor; background: var(--neutral-bg); color: var(--neutral); overflow-wrap: anywhere; }
.callout.good { background: var(--good-bg); color: var(--good); }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout.bad { background: var(--bad-bg); color: var(--bad); }
.callout.big { font-size: 1.02rem; margin-bottom: 16px; }
.callout p:last-child { margin: 0; }
.note { font-size: .88rem; color: var(--muted); margin: 12px 0 0; }
.note.warn { color: var(--warn); font-weight: 600; }
.status-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt .cur { color: var(--muted); font-size: .85em; }
.amt.pos { color: var(--good); } .amt.neg { color: var(--bad); }
.bal { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bal li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; }
.bal-l { font-weight: 600; }
.bal-v { text-align: right; font-weight: 600; }
.bal-d { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; }
.bal li.total { background: transparent; border: 2px solid var(--gold); }
.bal li.total .bal-v { font-size: 1.2rem; color: var(--gold-text); }

/* deposit address cards */
.addr { display: flex; flex-direction: column; gap: 12px; margin: 0; border-top: 4px solid var(--gold); }
.addr-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.addr-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.addr-box .lbl { font-size: .85rem; color: var(--muted); font-weight: 600; }
.addr-v { font-size: 1rem; font-weight: 500; line-height: 1.4; }
.addr-box .copy { align-self: flex-start; }

/* timelines + legends */
details summary { cursor: pointer; font-weight: 600; color: var(--primary); min-height: 32px; padding: 4px 0; }
@media (prefers-color-scheme: dark) { details summary { color: var(--gold-text); } }
.legend { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 16px; margin-bottom: 16px; }
.card .legend { border: 0; padding: 0; margin: 8px 0 0; }
.legend-list { margin: 8px 0 0; display: grid; gap: 10px; }
.legend-list > div { display: grid; gap: 4px; }
.legend-list > div.current { padding: 8px; border-radius: 10px; outline: 2px solid var(--gold); }
.legend-list dd { margin: 0; color: var(--muted); font-size: .9rem; }
.legend-list dt { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.explain { margin-top: 4px; font-size: .9rem; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: flex; gap: 8px; align-items: flex-start; }
.steps .dot { flex: none; width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--muted); }
.steps li.done .dot { background: var(--good); border-color: var(--good); }
.steps li.now .dot { background: var(--gold); border-color: var(--gold-text); box-shadow: 0 0 0 3px var(--warn-bg); }
.steps li.todo { color: var(--muted); }
.steps li.now strong { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }

/* responsive tables: stacked cards on narrow screens */
.rt { width: 100%; border-collapse: collapse; font-size: .93rem; }
.rt th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--border); padding: 8px; }
.rt td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
@media (max-width: 800px) {
  .rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rt, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt tr { border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; margin-bottom: 10px; background: var(--surface); }
  .rt td { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px; border-bottom: 1px dashed var(--border); padding: 8px 0; }
  .rt td:last-child { border-bottom: 0; }
  .rt td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; font-weight: 600; }
  .rt td[data-label=""]::before { content: none; }
  .rt td[data-label=""] { display: block; }
}
.paged > .btn, .paged + .btn { margin-top: 12px; }
.codes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.codes li { display: grid; gap: 4px; padding: 12px; background: var(--surface-2); border-radius: 10px; }
.big-code { font-size: 1.3rem; font-weight: 600; color: var(--gold-text); }
.stmt { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.due { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; font-size: 1.05rem; }

/* toasts + modal */
.toasts { position: fixed; z-index: 40; right: 12px; bottom: 12px; left: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; max-width: 440px; width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  background: var(--good-bg); color: var(--good); border: 1px solid currentColor; font-weight: 600; }
.toast.err { background: var(--bad-bg); color: var(--bad); }
.toast.warn { background: var(--warn-bg); color: var(--warn); }
.toast span { flex: 1; min-width: 0; overflow-wrap: anywhere; }   /* D1: a long id (wdr_...) wraps instead of widening the page at 390px */
.toast .x { background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; min-width: 40px; min-height: 40px; }
.modal { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 12px 48px rgba(0, 0, 0, .35); }
.modal::backdrop { background: rgba(10, 17, 27, .6); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .18s ease-out; } @keyframes rise { from { transform: translateY(8px); opacity: 0; } } }

/* ---- R3: promotions, progress, destinations, assisted intents, locked bonus ---- */
.promo-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.promo-h h3 { margin: 0; overflow-wrap: anywhere; }
.callout.sandbox { font-size: .85rem; }
.restrictions { margin: .25rem 0 0; padding-left: 1.2rem; }
.restrictions li { margin: .2rem 0; }
.progress-wrap { margin: .5rem 0; }
.progress { position: relative; height: .7rem; border-radius: 999px; background: color-mix(in srgb, currentColor 12%, transparent); overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; background: #2e9d6a; border-radius: 999px; }
.bal li.locked { opacity: .9; border-top: 1px dashed color-mix(in srgb, currentColor 30%, transparent); }
.dest, .intent { display: grid; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent); }
.dest:last-child, .intent:last-child { border-bottom: 0; }
.code-form { gap: .5rem; align-items: center; flex-wrap: wrap; }
.code-in { width: 8.5rem; letter-spacing: .2em; min-height: 44px; }
.mono.wrap { overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 420px) { .code-form .btn { width: 100%; } .promo-h { align-items: flex-start; } }
.dest > button, .intent > button { justify-self: start; }

/* T1-TRC20 panel */
.t20-body { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.t20-qr { width: 180px; height: 180px; background: #fff; padding: 6px; border-radius: 8px; }
.t20-list { list-style: none; padding: 0; margin: 0; }
.t20-h { padding: .35rem 0; border-bottom: 1px solid rgba(127,127,127,.2); overflow-wrap: anywhere; }

/* P5-UX: posture banner on phones, "not open yet" chips, support path (footer, inline lines, fallback), FAQ */
@media (max-width: 480px) { .mode-banner { font-size: .8rem; padding: 6px 12px; text-align: left; } }
.badge.na { font-size: .7rem; padding: 0 8px; vertical-align: middle; }
.btn .badge.na { margin-left: 6px; }
.support-foot { max-width: 1120px; margin: 0 auto; padding: 12px 16px 72px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.support-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.support-line p { margin: 0; }
.support-fallback { margin: 0; overflow-wrap: anywhere; }
.support-action { overflow-wrap: anywhere; text-align: center; }
.owner-text .pre { white-space: pre-line; }
.faq { margin: 0; padding-left: 1.1em; display: grid; gap: 10px; }
