/* ─────────────────────────────────────────────────────────────
   Funnel. Midnight precision instrument, the Chainhand tool system
   shared with Dustpan (DESIGN.md: Refero Styles → Linear, mapping at
   its end). One canvas, panels that step up in surface and border, one
   typeface family, one chromatic action per view: the Move button.
   ───────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --void: #08090a;
  --carbon: #0f1011;
  --obsidian: #161718;
  --slate: #23252a;
  --smoke: #383b3f;
  --ash: #62666d;
  --fog: #8a8f98;
  --mist: #d0d6e0;
  --bone: #e5e5e6;
  --paper: #ffffff;
  --lime: #e4f222;
  --green: #27a644;
  --red: #eb5757;
  --amber: #d9a441;

  --sans: 'Inter', 'Pretendard Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --page: 1200px;
  --r-card: 12px;
  --r-btn: 6px;
  --r-full: 9999px;
  color-scheme: dark;
}
html[lang="ko"] { --sans: 'Pretendard Variable', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--smoke) var(--void); scrollbar-width: thin; }
body {
  margin: 0; background: var(--void); color: var(--mist);
  font-family: var(--sans); font-size: 15px; line-height: 1.6; letter-spacing: -.011em;
  font-feature-settings: 'cv01' on, 'ss03' on, 'zero' on;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html[lang="ko"] body { word-break: keep-all; overflow-wrap: break-word; letter-spacing: 0; }
::selection { background: rgba(228, 242, 34, .28); color: var(--paper); }

a { color: var(--mist); text-decoration-color: var(--smoke); text-underline-offset: 3px; }
a:hover { color: var(--paper); text-decoration-color: var(--fog); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--paper); color: #000; padding: 8px 12px; border-radius: var(--r-btn); z-index: 10; }
.skip:focus { left: 16px; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 24px; }
h1, h2, h3 { color: var(--paper); font-weight: 510; margin: 0; letter-spacing: -.022em; }
html[lang="ko"] h1, html[lang="ko"] h2 { font-weight: 600; letter-spacing: -.01em; }

/* header */
.top { border-bottom: 1px solid var(--slate); }
.top-row { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font-weight: 590; font-size: 16px; letter-spacing: -.012em; }
.mark { width: 18px; height: 18px; display: inline-block; background:
  linear-gradient(var(--paper), var(--paper)) 0 0 / 100% 3px no-repeat,
  linear-gradient(var(--paper), var(--paper)) 3px 7px / calc(100% - 6px) 3px no-repeat,
  linear-gradient(var(--lime), var(--lime)) 7px 14px / 4px 4px no-repeat; }
.by { color: var(--fog); font-size: 13px; }
.by a { color: var(--fog); }
.lang { margin-left: auto; display: flex; gap: 2px; }
.lang a { color: var(--fog); text-decoration: none; font-size: 12px; font-weight: 510; padding: 6px 8px; border-radius: var(--r-btn); min-width: 36px; text-align: center; }
.lang a[aria-current="true"] { color: var(--paper); background: var(--slate); }

/* hero */
.hero { padding-top: 64px; padding-bottom: 40px; }
.hero h1 { font-size: 48px; line-height: 1.08; max-width: none; }
html[lang="ko"] .hero h1 { max-width: none; font-size: 44px; line-height: 1.2; }
.hero h1 { color: var(--fog); }
.hero h1 em { font-style: normal; color: var(--paper); }
.lede { font-size: 17px; color: var(--mist); max-width: 60ch; margin: 18px 0 0; }
html[lang="ko"] .lede { max-width: 38em; }
.terms { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--fog); font-size: 13px; }
.terms li + li::before { content: ''; display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--smoke); margin: 0 14px 2px -14px; vertical-align: middle; }
.notice { margin: 20px 0 0; padding: 10px 14px; border: 1px solid rgba(217, 164, 65, .35); border-radius: var(--r-btn); color: var(--mist); font-size: 14px; max-width: 760px; }
.notice a { color: var(--paper); }
.safe-banner { margin-top: 20px; padding: 10px 14px; border: 1px solid var(--smoke); border-radius: var(--r-btn); background: var(--obsidian); color: var(--paper); font-size: 14px; }

/* Balanced last lines wherever the browser can (Chromium, Safari 17.4+). */
p, li, .note, .sub, .check-line, .lede { text-wrap: pretty; }
h1, h2 { text-wrap: balance; }

/* layout */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.col-side { position: sticky; top: 16px; }

.panel { background: var(--carbon); border: 1px solid var(--slate); border-radius: var(--r-card); padding: 20px; }
.panel-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.step { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--smoke); color: var(--fog); font-size: 12px; font-weight: 590; display: grid; place-items: center; margin-top: 2px; }
.panel h2 { font-size: 20px; line-height: 1.3; }
.sub { margin: 4px 0 0; color: var(--fog); font-size: 14px; max-width: 64ch; }
html[lang="ko"] .sub { max-width: 42em; }

/* buttons */
.btn { font: inherit; font-size: 14px; font-weight: 510; border-radius: var(--r-btn); padding: 9px 14px; min-height: 40px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; letter-spacing: -.01em; }
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn-white { background: var(--paper); color: #08090a; }
.btn-white:hover:not(:disabled) { background: var(--bone); }
.btn-ghost { background: transparent; color: var(--mist); border-color: var(--smoke); }
.btn-ghost:hover:not(:disabled) { border-color: var(--fog); color: var(--paper); }
.btn-quiet { background: transparent; color: var(--fog); padding: 6px 10px; min-height: 32px; }
.btn-quiet:hover { color: var(--paper); background: var(--slate); }
.btn-lime { background: var(--lime); color: #08090a; width: 100%; justify-content: center; min-height: 44px; font-weight: 590; }
.btn-lime:hover:not(:disabled) { filter: brightness(1.06); }
.btn-lime:disabled { background: var(--slate); color: var(--fog); opacity: 1; }

/* destination */
.dest-body { display: grid; gap: 14px; }
.dest-wallet { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.addr-block { display: grid; gap: 2px; min-width: 0; }
.addr-block .label { color: var(--fog); font-size: 12px; }
.addr-full { color: var(--paper); font-size: 14px; overflow-wrap: anywhere; }
.dest-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; font-size: 12px; color: var(--fog); font-weight: 510; }
select, .input { font: inherit; font-size: 14px; color: var(--paper); background: var(--obsidian); border: 1px solid var(--smoke); border-radius: var(--r-btn); padding: 8px 10px; min-height: 40px; width: 100%; }
select:disabled { color: var(--ash); }
.check-line { margin: 0; font-size: 13px; color: var(--fog); min-height: 1em; }
.check-line.ok { color: #7bc68c; }
.check-line.warn { color: var(--amber); }
.check-line.bad { color: #f08a8a; }

/* sources */
.sources { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--slate); }
.src { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--slate); min-width: 0; }
.src code { color: var(--mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.src .label { color: var(--fog); font-size: 12px; min-width: 76px; }
.src .x { margin-left: auto; font-size: 18px; line-height: 1; width: 32px; justify-content: center; }
.dest-src code { color: var(--paper); }
.empty { color: var(--fog); font-size: 14px; padding: 10px 0; }
.tag { font-size: 11px; color: var(--fog); border: 1px solid var(--smoke); border-radius: var(--r-full); padding: 1px 8px; white-space: nowrap; }
.tag.warn { color: var(--amber); border-color: rgba(217, 164, 65, .45); }
.src-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.watch { display: flex; gap: 8px; flex: 1 1 320px; min-width: 0; }
.watch .input { flex: 1; min-width: 0; }
.offer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--mist); font-size: 14px; }
.dlg-actions { display: flex; gap: 10px; margin-top: 16px; }
.dlg-actions .btn-lime { width: auto; }
.form-error { color: #f08a8a; font-size: 13px; margin: 8px 0 0; min-height: 1em; }

.help { margin-top: 16px; border-top: 1px solid var(--slate); }
.help details { border-bottom: 1px solid var(--slate); }
.help summary { cursor: pointer; padding: 12px 0; color: var(--mist); font-size: 14px; font-weight: 510; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: '+'; color: var(--fog); font-weight: 400; }
.help details[open] summary::after { content: '−'; }
.help-body { padding: 0 0 14px; color: var(--fog); font-size: 14px; max-width: 70ch; }
.help-body p { margin: 0 0 8px; }
.help-body ul { margin: 0 0 8px; padding-left: 18px; }
.help-body li { margin-bottom: 4px; }

/* scan + ledger */
.scan-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.progress { color: var(--fog); font-size: 13px; margin: 0; }
.ledger { margin-top: 16px; display: grid; gap: 16px; }
.wgroup { border: 1px solid var(--slate); border-radius: 10px; overflow: hidden; }
.whead { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--obsidian); border-bottom: 1px solid var(--slate); min-width: 0; }
.whead code { color: var(--paper); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wtotal { margin-left: auto; color: var(--paper); font-variant-numeric: tabular-nums; font-weight: 510; }
.wgroup > .check-line { padding: 8px 14px 0; }
.wgroup > .check-line:last-child, .wgroup > .empty.pad { padding: 10px 14px 12px; }
.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
.rows th { text-align: left; color: var(--fog); font-weight: 510; font-size: 12px; padding: 8px 14px; border-bottom: 1px solid var(--slate); }
.rows td { padding: 9px 14px; border-bottom: 1px solid var(--slate); vertical-align: top; }
.rows tr:last-child td { border-bottom: 0; }
.rows .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .c-sel { width: 40px; padding-right: 0; }
.rows input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--lime); margin: 0; }
/* the whole cell is the hit area: 44px square around an 18px box */
.tick { display: grid; place-items: center; width: 44px; height: 44px; margin: -12px -8px -12px -13px; cursor: pointer; }
.asset { color: var(--paper); }
.cost { display: block; color: var(--fog); font-size: 12px; }
.asset { white-space: nowrap; }
.asset .amt { font-variant-numeric: tabular-nums; }
.asset .sym { display: inline-block; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.rows td.chain { white-space: nowrap; }
.status { min-width: 150px; }
.pill { display: inline-block; font-size: 12px; font-weight: 510; color: var(--mist); border: 1px solid var(--smoke); border-radius: var(--r-full); padding: 0 8px; white-space: nowrap; }
.note { display: block; color: var(--fog); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.txlink { display: inline-block; font-size: 12px; margin-top: 4px; }
.st-ready .pill { color: #08090a; background: var(--bone); border-color: var(--bone); }
.st-arrived .pill, .st-claimed .pill { color: #7bc68c; border-color: rgba(39, 166, 68, .5); }
.st-sent .pill, .st-moving .pill, .st-proposed .pill { color: var(--paper); border-color: var(--fog); }
.st-refused .pill, .st-failed .pill { color: #f08a8a; border-color: rgba(235, 87, 87, .5); }
.st-needsgas .pill { color: var(--amber); border-color: rgba(217, 164, 65, .45); }
.st-left .pill, .st-small .pill, .st-home .pill, .st-noroute .pill, .st-otherchain .pill, .st-skipped .pill, .st-refunded .pill { color: var(--fog); }
.st-left td, .st-small td, .st-home td, .st-noroute td { color: var(--fog); }
.st-left .asset, .st-small .asset, .st-home .asset { color: var(--fog); }

/* summary */
.summary { background: var(--obsidian); border-color: var(--smoke); }
.summary h2 { font-size: 16px; margin-bottom: 12px; }
.sum { margin: 0 0 14px; display: grid; gap: 0; }
.sum > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--slate); font-size: 14px; }
.sum dt { color: var(--fog); }
.sum dd { margin: 0; color: var(--mist); font-variant-numeric: tabular-nums; text-align: right; }
.sum .total { border-bottom: 0; padding-top: 10px; }
.sum .total dt { color: var(--paper); font-weight: 510; }
.sum .total dd { color: var(--paper); font-size: 20px; font-weight: 590; letter-spacing: -.012em; }
.sum-to { font-size: 12px; color: var(--fog); margin: 0 0 12px; }
.sum-to code { display: block; color: var(--mist); font-size: 12px; overflow-wrap: anywhere; word-break: break-all; margin-top: 2px; }
.summary .progress { margin-top: 10px; }
.fine { color: var(--fog); font-size: 12px; margin: 12px 0 0; line-height: 1.5; }

/* refusals */
.band { padding-top: 72px; padding-bottom: 24px; }
.band h2 { font-size: 24px; margin-bottom: 16px; }
.refuse { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; border-top: 1px solid var(--slate); }
.refuse li { padding: 14px 0; border-bottom: 1px solid var(--slate); color: var(--mist); font-size: 14px; }

.bottom { border-top: 1px solid var(--slate); margin-top: 48px; padding: 24px 0 40px; color: var(--fog); font-size: 12px; }
.bottom p { max-width: 90ch; margin: 0 0 8px; }
.bottom .links { display: flex; gap: 16px; flex-wrap: wrap; }
.bottom .links a { color: var(--fog); }

/* terms and privacy */
.legal { padding-top: 48px; padding-bottom: 64px; max-width: 760px; }
.legal h1 { font-size: 36px; margin-bottom: 4px; }
.legal h2 { font-size: 18px; margin: 32px 0 8px; }
.legal p, .legal li { color: var(--mist); max-width: 70ch; }
.legal .updated { color: var(--fog); font-size: 13px; }
.legal ul { padding-left: 18px; }

/* wallet chooser */
.chooser { background: var(--obsidian); color: var(--mist); border: 1px solid var(--smoke); border-radius: var(--r-card); padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 2px 4px rgba(0, 0, 0, .4); }
.chooser::backdrop { background: rgba(8, 9, 10, .72); }
.chooser h2 { font-size: 18px; margin-bottom: 12px; }
.chooser-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.btn-row { width: 100%; justify-content: flex-start; background: var(--carbon); color: var(--paper); border: 1px solid var(--slate); }
.btn-row:hover { border-color: var(--fog); }
.btn-row.muted { color: var(--fog); }
.btn-row .tag { margin-left: auto; }
.btn-row img, .icon-blank { width: 20px; height: 20px; border-radius: 4px; flex: none; }
.icon-blank { background: var(--slate); display: inline-block; }
.fatal { background: #3a1214; color: var(--paper); padding: 12px 24px; margin: 0; }

/* dev-only Safe harness */
.harness-frame { width: 100%; height: 900px; border: 1px solid var(--smoke); }

/* phones */
@media (max-width: 1100px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .hero { padding-top: 40px; padding-bottom: 28px; }
  .hero h1, html[lang="ko"] .hero h1 { font-size: 32px; }
  .lede { font-size: 16px; }
  .terms { flex-direction: column; gap: 4px; }
  .terms li + li::before { display: none; }
  .panel { padding: 16px; }
  .dest-fields { grid-template-columns: 1fr; }
  .refuse { grid-template-columns: 1fr; }
  .by { display: none; }
  /* rows stack: asset and status on top, numbers below */
  .rows thead { display: none; }
  .rows tr { display: grid; grid-template-columns: 30px 1fr auto; gap: 2px 8px; padding: 10px 12px; border-bottom: 1px solid var(--slate); }
  .rows tr:last-child { border-bottom: 0; }
  .rows td { padding: 0; border: 0; }
  .rows .c-sel { grid-row: 1 / span 3; }
  .rows td:nth-child(2) { grid-column: 2 / 4; }
  .rows td:nth-child(3) { grid-column: 2; color: var(--fog); font-size: 13px; }
  .rows td:nth-child(4) { grid-column: 3; grid-row: 2; }
  .rows td:nth-child(5) { grid-column: 3; grid-row: 3; color: var(--fog); }
  /* the header row is hidden here, so each figure carries its own label */
  .rows td.num[data-label]::before { content: attr(data-label); margin-right: 6px; color: var(--fog); font-size: 12px; }
  .rows td.status { grid-column: 2 / 4; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
