/* Currency Bench: an amount-first workspace, with a charcoal result and readable bank quotes. */
:root {
  --color-paper: #f4f4f5;
  --color-sheet: #fff;
  --color-ink: #18181b;
  --color-muted: #606068;
  --color-rule: #e4e4e7;
  --color-accent: #232323;
  --color-danger: #b42318;
  --font-body: Inter, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-display: "Iowan Old Style", "Songti TC", "Noto Serif TC", serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, monospace;
  --radius: 4px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body { margin: 0; background: var(--color-paper); color: var(--color-ink); font-family: var(--font-body); font-size: 16px; line-height: 1.6; }
a { color: inherit; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button, input, select, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #9c6b2f; outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 16px; }
.skip:focus { left: 8px; z-index: 10; }
.site-header { background: #fff; border-bottom: 1px solid var(--color-rule); }
.site-header .wrap { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.6px; }
.brand a { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; background: #232323; color: #fff; border-radius: 4px; font-size: 24px; font-weight: 400; }
.brand-caption { border-left: 1px solid var(--color-rule); padding-left: 12px; color: var(--color-muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.status { margin: 0; color: var(--color-muted); font-size: 12px; }
.demo-badge { color: #77511d; background: #faf3e6; border: 1px solid #e9d7b8; border-radius: 4px; padding: 5px 10px; font-size: 12px; }
main.wrap { padding-top: 40px; padding-bottom: 60px; }
.page-intro { margin-bottom: 28px; }
h1, h2, h3 { margin: 0; overflow-wrap: anywhere; min-width: 0; }
h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.8rem, 3.5vw, 2.75rem); line-height: 1.25; letter-spacing: -0.03em; }
h2 { font-size: 23px; font-weight: 600; line-height: 1.4; letter-spacing: -0.03em; }
h3 { font-size: 16px; font-weight: 600; }
.lead { margin: 10px 0 0; color: var(--color-muted); font-size: 15px; }
.kicker { margin: 0 0 10px; color: var(--color-muted); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.07em; }
.workbench { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); border: 1px solid #232323; border-radius: var(--radius); overflow: clip; margin-bottom: 40px; background: #fff; }
.input-panel { padding: 32px; min-width: 0; container-type: inline-size; }
.conv h2 { margin-bottom: 24px; }
.conv-row { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 500; }
.amount-label { display: flex; justify-content: space-between; align-items: center; }
.field-unit { color: var(--color-muted); font-family: var(--font-mono); font-size: 11px; }
.amount-input, .text-input, select { width: 100%; min-width: 0; border: 1px solid #d9d9dd; border-radius: var(--radius); background: #fafafa; }
.amount-input { height: 64px; padding: 0 16px; font-size: 30px; font-weight: 500; font-variant-numeric: tabular-nums; }
.text-input, select { height: 48px; padding: 0 12px; }
select { font-size: 14px; }
.amount-input:hover, select:hover, .text-input:hover { border-color: #8d8d95; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); gap: 8px; align-items: end; }
.swap { width: 40px; height: 48px; background: #fff; border: 1px solid var(--color-rule); border-radius: var(--radius); font-size: 21px; }
.swap:hover { background: #efefef; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 48px; padding: 10px 18px; background: #232323; color: #fff; border: 1px solid #232323; border-radius: var(--radius); font-size: 14px; font-weight: 500; }
.btn:hover { background: #3d3d3d; }
.conv .actions .btn { width: 100%; }
.conv[data-live] .actions, .conv[data-live] > .sr-only { display: none; }
.help { margin: 10px 0 0; font-size: 12px; color: var(--color-muted); }
.amount-shortcuts { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.amount-shortcuts > span { color: var(--color-muted); font-size: 12px; margin-right: 2px; }
.amount-chip { min-height: 40px; padding: 4px 12px; font-size: 12px; font-family: var(--font-mono); background: #fff; border: 1px solid var(--color-rule); border-radius: var(--radius); }
.amount-chip:hover { background: #232323; color: #fff; border-color: #232323; }
.query-fold { grid-column: 1 / -1; margin: 0; padding: 12px 32px; background: #fff; border-top: 1px solid var(--color-rule); }
.query-fold > summary { display: flex; justify-content: space-between; align-items: center; min-height: 32px; font-size: 13px; color: #44444c; list-style: none; }
.query-fold > summary::-webkit-details-marker { display: none; }
.query-fold[open] > summary span { transform: rotate(45deg); }
.query-content { margin-top: 16px; }
.input-panel > .query-fold { padding: 0 0 20px; margin-bottom: 24px; border-top: 0; border-bottom: 1px solid var(--color-rule); }
.query-form { display: flex; flex-wrap: wrap; gap: 8px; }
.query-form .field { flex: 1 1 220px; }
.query-form .btn { align-self: flex-end; }
.query-content .query-form .field { flex-basis: 100%; }
.query-content .query-form .btn { min-height: 40px; width: 100%; justify-content: center; }
.field-error { font-size: 14px; color: var(--color-danger); margin: 8px 0; }
[aria-invalid="true"] { border-color: var(--color-danger); }
.result-display { min-width: 0; padding: 32px; background: #232323; color: #fff; display: flex; flex-direction: column; align-items: stretch; }
.result-display > h2:not(.sr-only) { color: #fff; font-family: var(--font-display); font-size: 28px; margin: 16px 0; }
.result-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.tag { font-size: 12px; color: #dedede; }
.tag.ok::before { content: ''; display: inline-block; height: 5px; width: 5px; margin: 0 6px 2px 0; border-radius: 50%; background: #dedede; }
.tag.warn { background: #503f25; color: #ffe3b1; padding: 3px 8px; border-radius: 4px; }
.result-from { margin: 32px 0 8px; font-size: 14px; color: #d4d4d8; }
.result-conv { margin: 0; font-variant-numeric: tabular-nums; line-height: 1.12; overflow-wrap: anywhere; }
.result-conv strong { font-weight: 500; }
.result-conv .num { display: block; font-size: clamp(2.8rem, 5vw, 4.5rem); letter-spacing: -0.055em; }
.result-conv .unit { display: block; margin-top: 12px; font-size: 18px; font-weight: 400; letter-spacing: 0; }
.result-caption { margin: 14px 0 22px; font-size: 12px; color: #bdbdc4; }
.result-big { margin: 0 0 7px; font-size: 15px; color: #f1f1f2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-big .unit { margin-left: .35em; }
.rate-details { color: #bdbdc4; font-size: 12px; }
.rate-details summary { min-height: 28px; }
.rates { margin: 8px 0; padding-left: 16px; font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.trust-strip { margin-top: auto; padding-top: 22px; color: #bdbdc4; font-size: 11px; }
.trust-strip p { margin: 0 0 5px; }
.trust-strip a { color: #e5e5e7; }
.data-details { padding-top: 8px; color: #bdbdc4; font-size: 12px; }
.data-details summary { min-height: 30px; }
.data-details .meta { margin-top: 14px; }
.result-display .kicker { color: #bdbdc4; }
.result-display .fine { color: #bdbdc4; }
.result-status { background: #f8e5c4; color: #4f3614; padding: 9px 12px; font-size: 13px; border-radius: 4px; margin: 14px 0 0; }
.result-display[data-pending] .result-conv { opacity: .5; }
.result-display:focus { outline-offset: -4px; }
.meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 13px; }
.meta dt { font-weight: 500; }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.utc { font-size: 12px; }
.fine { color: var(--color-muted); font-size: 12px; line-height: 1.7; margin: 14px 0 0; }
.notice { border: 1px solid var(--color-rule); border-radius: 4px; padding: 12px 16px; background: #fafafa; font-size: 13px; margin: 16px 0; }
.notice p { margin: 0; }
.notice p + p { margin-top: 8px; }
.notice.warn { background: #fff7e9; border-color: #e9d7b8; color: #77511d; }
.result-display .notice { background: #363638; color: #f4f4f5; border-color: #56565b; }
.result-display .notice.warn { background: #463925; color: #ffe3b1; border-color: #77603c; }
.result-display .notice a { color: inherit; }
.warn-text { color: var(--color-danger); }
.card { padding: 28px; border: 1px solid var(--color-rule); border-radius: var(--radius); background: #fff; margin-bottom: 24px; min-width: 0; }
.card h2 { margin-bottom: 16px; }
.card.quiet { background: transparent; border: 0; padding: 8px 0; }
.card.quiet h2 { font-size: 14px; margin-bottom: 8px; }
.card.quiet p { color: var(--color-muted); font-size: 12px; }
.btn-ghost { display: inline-flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 8px 16px; background: transparent; border: 1px solid var(--color-rule); border-radius: var(--radius); color: inherit; text-decoration: none; font-size: 14px; }
.btn-ghost:hover { border-color: #232323; }
.btn-ghost span { font-size: 11px; color: var(--color-muted); }
#bank-comparison-content { grid-column: 1 / -1; min-width: 0; }
#bank-comparison-content:empty { display: none; }
.context-status { grid-column: 1 / -1; margin: 0; border-radius: 0; }
.bank { padding: 20px 24px; border-top: 1px solid var(--color-rule); }
.bank-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.bank-heading h2 { font-size: 20px; font-weight: 600; }
.bank-intent { margin: 0; font-size: 13px; }
.bank-dir { margin: 0 0 12px; color: var(--color-muted); font-size: 12px; }
.bank-data-note { margin: 0 0 16px; color: #77511d; font-size: 11px; }
.bank-matrix { table-layout: fixed; width: 100%; border-collapse: collapse; }
.bank-matrix th, .bank-matrix td { text-align: left; padding: 10px 12px; vertical-align: top; border-bottom: 1px solid var(--color-rule); overflow-wrap: anywhere; }
.bank-matrix thead th { padding-top: 10px; padding-bottom: 12px; color: var(--color-ink); font-size: 14px; font-weight: 500; }
.bank-matrix thead th span { display: block; margin-top: 3px; color: var(--color-muted); font-size: 11px; font-weight: 400; }
.bank-matrix th:first-child { width: 25%; padding-left: 0; }
.bank-matrix td:last-child, .bank-matrix thead th:last-child { padding-right: 0; }
.bank-matrix tbody th { font-size: 14px; font-weight: 500; color: var(--color-ink); }
.bank-source-link { display: block; margin-top: 4px; font-size: 11px; font-weight: 400; }
.bank-matrix .quote-value, .bank-matrix .quote-empty { display: block; font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.4; letter-spacing: -.025em; }
.bank-matrix .quote-unit, .bank-matrix .quote-state, .bank-matrix time { display: block; margin-top: 5px; font-size: 11px; font-weight: 400; color: var(--color-muted); }
.bank-matrix .quote-state { color: #77511d; }
.bank-matrix time { font-variant-numeric: tabular-nums; }
.bank-matrix caption:not(.sr-only) { padding-bottom: 8px; font-size: 11px; color: var(--color-muted); }
.bank-footnote { margin: 12px 0 0; color: var(--color-muted); font-size: 11px; line-height: 1.7; }
.bank-source-list { padding: 0; margin: 0; list-style: none; }
.bank-source-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-rule); font-size: 13px; }
.bank-source-list li span:last-child { color: var(--color-muted); }
.currency-flag { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.1em; line-height: 1; }
.support-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { color: var(--color-muted); font-size: 12px; text-align: left; padding: 0 0 16px; }
th, td { text-align: right; border-bottom: 1px solid var(--color-rule); padding: 12px 8px; }
th { font-size: 12px; color: var(--color-muted); font-weight: 500; }
th:first-child, td:first-child { text-align: left; }
.ladder h2 { font-size: 18px; }
.ladder td a { display: inline-block; min-height: 28px; text-decoration-style: dotted; }
.currency-details > summary { font-size: 16px; font-weight: 500; }
.curs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-top: 20px; }
.cur h3 { margin-bottom: 12px; }
.cur .meta { grid-template-columns: 1fr; gap: 2px; }
.cur .meta dd { color: var(--color-muted); margin-bottom: 8px; }
.links { margin: 0; padding-left: 20px; }
.links.pairs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 20px; list-style: none; padding: 0; }
.links.pairs a { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 86px; padding: 12px 0; border-bottom: 1px solid var(--color-rule); text-decoration: none; font-size: 14px; }
.links.pairs a:hover { color: #77511d; }
.links .code { font-family: var(--font-mono); color: var(--color-muted); font-size: 11px; }
.support-grid .links.pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.more-pairs { margin-top: 18px; font-size: 13px; }
.more-pairs summary { min-height: 32px; }
.placeholder, .opt-disabled { color: var(--color-muted); }
.unavailable h2 { font-size: 24px; }
.site-footer { padding: 24px 0 32px; border-top: 1px solid var(--color-rule); color: var(--color-muted); font-size: 12px; }
.site-footer p { margin: 0 0 14px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 20px; list-style: none; padding: 0; margin: 0; }
.refresh-note { position: fixed; bottom: 16px; left: 16px; right: 16px; z-index: 5; width: fit-content; max-width: calc(100% - 32px); margin: 0 auto; border: 1px solid #c2a16b; border-radius: 4px; padding: 12px 18px; background: #fff7e9; color: #77511d; font-size: 13px; box-shadow: 0 4px 20px #0001; }
.calculator-meta { grid-column: 1 / -1; padding: 12px 24px; border-top: 1px solid var(--color-rule); display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 20px; }
.calculator-meta .trust-strip { margin: 0; padding: 0; color: var(--color-muted); }
.calculator-meta .trust-strip a { color: inherit; }
.calculator-meta .data-details, .calculator-meta .rate-details { color: var(--color-muted); padding: 0; }
.calculator-meta .data-details[open], .calculator-meta .rate-details[open] { flex-basis: 100%; }
@media (min-width: 681px) {
  .bank-dir { display: inline; margin: 0 12px 0 0; }
  .bank-data-note { display: inline; margin: 0; }
  .bank-matrix { margin-top: 12px; }
  main.wrap { padding-top: 24px; }
  .page-intro { margin-bottom: 20px; }
  .page-intro > .kicker { display: none; }
  .page-intro h1 { font-size: 32px; }
  .input-panel, .result-display { padding: 24px; }
  .conv > .kicker { display: none; }
  .conv h2 { font-size: 20px; margin-bottom: 16px; }
  .amount-input { height: 52px; }
  .result-from { margin-top: 18px; }
  .result-conv .num { font-size: 52px; }
  .result-conv .unit { font-size: 16px; margin-top: 8px; }
  .result-caption { margin: 10px 0 12px; }
}
@media (max-width: 900px) {
  .brand-caption { display: none; }
  .input-panel, .result-display { padding: 24px; }
  .support-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .wrap { padding: 0 16px; }
  .site-header .wrap { min-height: 64px; gap: 8px; }
  .brand { font-size: 16px; }
  .brand a { gap: 8px; }
  .brand-mark { width: 28px; height: 28px; font-size: 21px; }
  .demo-badge { max-width: 116px; padding: 3px 6px; font-size: 10px; line-height: 1.5; }
  .status { max-width: 90px; font-size: 10px; }
  main.wrap { padding-top: 24px; padding-bottom: 36px; }
  .page-intro { margin-bottom: 20px; }
  .page-intro .kicker { display: none; }
  .page-intro h1 { font-size: 26px; }
  .lead { margin-top: 8px; font-size: 13px; }
  .workbench { grid-template-columns: 1fr; margin-bottom: 24px; }
  .input-panel { padding: 20px; }
  .conv > .kicker { display: none; }
  .conv h2 { font-size: 18px; margin-bottom: 14px; }
  .conv-row { gap: 12px; }
  .field { gap: 4px; }
  .field label { font-size: 12px; }
  .amount-input { height: 52px; font-size: 26px; }
  select { padding: 0 8px; height: 44px; font-size: 13px; }
  .pair { grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr); gap: 6px; }
  .swap { width: 32px; height: 44px; font-size: 18px; }
  .conv .btn { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
  .conv .help { font-size: 10px; margin-top: 7px; }
  .amount-shortcuts { margin-top: 10px; gap: 6px; }
  .amount-shortcuts > span { font-size: 10px; }
  .amount-chip { min-height: 36px; padding: 4px 9px; font-size: 11px; }
  .query-fold { margin: 0; padding: 10px 20px; }
  .query-fold > summary { font-size: 12px; min-height: 28px; }
  .result-display { padding: 22px 20px; }
  .result-from { margin-top: 18px; font-size: 13px; }
  .result-conv .num { font-size: 44px; }
  .result-conv .unit { font-size: 15px; margin-top: 8px; }
  .result-caption { margin: 12px 0 16px; font-size: 11px; }
  .result-big { font-size: 13px; }
  .trust-strip { padding-top: 18px; font-size: 10px; }
  .data-details { font-size: 11px; }
  .meta { grid-template-columns: 1fr; gap: 3px; }
  .meta dd { margin-bottom: 8px; }
  .card { padding: 20px; margin-bottom: 20px; }
  .card h2 { font-size: 20px; }
  .bank { padding: 18px 12px; }
  .calculator-meta { padding: 12px 20px; }
  .bank-heading { display: block; padding: 0 4px; }
  .bank-heading h2 { font-size: 18px; }
  .bank-intent { font-size: 12px; margin-top: 5px; }
  .bank-dir { font-size: 11px; padding: 0 4px; margin-bottom: 8px; }
  .bank-data-note { font-size: 10px; padding: 0 4px; margin-bottom: 10px; }
  .bank-matrix th, .bank-matrix td { padding: 12px 4px; }
  .bank-matrix th:first-child { padding-left: 4px; }
  .bank-matrix td:last-child, .bank-matrix thead th:last-child { padding-right: 4px; }
  .bank-matrix thead th, .bank-matrix tbody th { font-size: 12px; }
  .bank-matrix thead th span { font-size: 10px; }
  .bank-matrix .quote-value, .bank-matrix .quote-empty { font-size: 15px; letter-spacing: -.04em; }
  .bank-matrix .quote-unit, .bank-matrix .quote-state, .bank-matrix time { font-size: 10px; }
  .bank-footnote { font-size: 10px; padding: 0 4px; }
  .support-grid { grid-template-columns: 1fr; gap: 0; }
  .links.pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
  .links.pairs a { min-height: 76px; font-size: 13px; }
  .notice { padding: 10px 12px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Keep the full currency label visible when the input panel cannot fit two selects. */
@container (max-width: 400px) {
  .amount-input { font-size: clamp(18px, 7.8cqi, 30px); }
  .pair { grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "from swap" "to swap"; gap: 12px 8px; }
  .pair .from { grid-area: from; }
  .pair .to { grid-area: to; }
  .pair .swap { grid-area: swap; width: 40px; align-self: center; }
}
