:root {
  --ink: #25231f;
  --muted: #7d776e;
  --paper: #fbfaf7;
  --line: #e9e4db;
  --brown: #8c6f55;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", Arial, sans-serif;
}
button, input, select { font: inherit; }
button, summary, select { -webkit-tap-highlight-color: transparent; }

.site-shell {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  padding: 34px 44px 24px;
  isolation: isolate;
}
.background-orb {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(2px);
  opacity: .72;
  pointer-events: none;
}
.orb-one { width: 430px; height: 430px; top: -250px; left: -120px; background: #eadbcc; }
.orb-two { width: 520px; height: 520px; right: -290px; bottom: -330px; background: #e9dfd2; }
.page-wrap { width: min(1180px, 100%); margin: 0 auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.brand-lockup { display: flex; align-items: center; gap: 15px; }
.brand-logo {
  width: 47px;
  height: 47px;
  flex: 0 0 47px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 7px 18px rgb(60 48 35 / .15);
}
.eyebrow, .step-label {
  margin: 0 0 4px;
  color: var(--brown);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
}
.brand-lockup h1 {
  margin: 0;
  font-size: clamp(23px, 2.2vw, 30px);
  letter-spacing: -.04em;
  line-height: 1.1;
}
.reset-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #5f584e;
  background: rgb(255 255 255 / .78);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 160ms ease;
}
.reset-button:hover { color: var(--ink); border-color: #d7cec1; background: #fff; transform: translateY(-1px); }
.reset-button span { font-size: 18px; line-height: 1; }

.currency-tabs {
  width: 470px;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 6px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 255 255 / .72);
  box-shadow: 0 10px 30px rgb(70 55 38 / .04);
}
.currency-tab {
  min-height: 61px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 15px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}
.currency-tab:hover { color: var(--ink); background: #f7f3ed; }
.currency-tab.active { color: var(--ink); background: #fff; box-shadow: 0 4px 14px rgb(72 55 38 / .1); }
.flag { font-size: 25px; line-height: 1; filter: saturate(.88); }
.currency-tab span:last-child { display: grid; }
.currency-tab strong { font-size: 14px; }
.currency-tab small { margin-top: 2px; color: #9a9389; font-size: 10px; letter-spacing: .06em; }

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(380px, .75fr);
  gap: 14px;
  align-items: stretch;
}
.panel { border-radius: 27px; box-shadow: 0 18px 55px rgb(55 43 30 / .09); }
.input-panel {
  padding: 30px;
  border: 1px solid rgb(233 228 219 / .9);
  background: rgb(255 255 255 / .9);
  backdrop-filter: blur(15px);
}
.panel-heading, .result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.panel-heading h2, .result-topline h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.mode-badge {
  padding: 8px 11px;
  border-radius: 999px;
  color: #786655;
  background: #f4ede4;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
}
.form-stack { display: grid; gap: 20px; margin-top: 26px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-group { display: grid; gap: 9px; }
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #5e584f;
  font-size: 13px;
  font-weight: 750;
}
.label-row small { color: #a19a90; font-size: 10px; font-weight: 600; }
.input-shell {
  min-height: 59px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 17px;
  border: 1.5px solid #e7e1d7;
  border-radius: 16px;
  background: #fbfaf7;
  transition: 160ms ease;
}
.input-shell:focus-within { border-color: #b99c80; background: #fff; box-shadow: 0 0 0 4px rgb(185 156 128 / .13); }
.input-shell-large { min-height: 79px; gap: 14px; padding: 0 21px; border-color: #dbd1c4; background: #fff; }
.input-shell input, .input-shell select, .compact-input input {
  min-width: 0;
  flex: 1;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}
.input-shell input::placeholder { color: #c1bbb2; opacity: 1; }
.input-shell-large input { font-size: clamp(23px, 3vw, 34px); font-weight: 760; letter-spacing: -.025em; }
.currency-symbol { color: var(--brown); font-size: 29px; font-weight: 700; }
.currency-symbol.compact { font-size: 20px; }
.prefix { color: #8d857a; font-size: 13px; font-weight: 800; }
.input-suffix { color: #8d857a; font-size: 12px; font-weight: 800; }
.clear-input {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #938778;
  background: #efe9e1;
  cursor: pointer;
}
.settings-box { margin-top: 22px; border-top: 1px solid var(--line); }
.settings-box summary {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  list-style: none;
  cursor: pointer;
}
.settings-box summary::-webkit-details-marker { display: none; }
.settings-box summary > span:first-child { display: grid; gap: 3px; }
.settings-box summary strong { color: #5d554c; font-size: 12px; }
.settings-box summary small { color: #aaa299; font-size: 10px; }
.settings-chevron { color: #9b9286; transition: 160ms ease; }
.settings-box[open] .settings-chevron { transform: rotate(180deg); }
.settings-content { display: grid; gap: 13px; padding: 0 0 5px; }
.rate-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f5f0;
}
.rate-mode {
  min-height: 51px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  color: #8c8378;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}
.rate-mode:hover { color: #5c544b; }
.rate-mode.active { color: #4d443c; background: #fff; box-shadow: 0 3px 12px rgb(72 55 38 / .09); }
.rate-mode span { font-size: 11px; font-weight: 800; }
.rate-mode small { color: #aaa197; font-size: 9px; }
.latest-meta {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 3px;
  color: #958c82;
  font-size: 9px;
}
.latest-meta .status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #9ac078; }
.latest-meta.loading .status-dot { background: #d2ad74; }
.latest-meta.error .status-dot { background: #c78373; }
.latest-meta button {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid #e4ded5;
  border-radius: 7px;
  color: #7e7368;
  background: #fff;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}
.latest-meta button:disabled { opacity: .45; cursor: wait; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-grid label { display: grid; gap: 7px; color: #837b71; font-size: 10px; font-weight: 700; }
.compact-input {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f4;
}
.compact-input b { color: #8f8477; font-size: 11px; }
.compact-input.latest { background: #f4f0e9; }
.compact-input em {
  padding: 3px 5px;
  border-radius: 5px;
  color: #6b7c57;
  background: #e5eddc;
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
  letter-spacing: .08em;
}

.result-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  padding: 30px;
  color: #fff;
  background: radial-gradient(circle at 85% 15%, rgb(255 255 255 / .12), transparent 25%), linear-gradient(145deg, #6e5947, #342b25 70%);
  overflow: hidden;
}
.result-panel.vnd { background: radial-gradient(circle at 85% 15%, rgb(255 255 255 / .11), transparent 25%), linear-gradient(145deg, #715d47, #2e2b24 70%); }
.step-label.light { color: #d8c7b6; }
.result-topline h2 { color: #fff; }
.live-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid rgb(255 255 255 / .13);
  border-radius: 999px;
  color: #dfd6cc;
  background: rgb(255 255 255 / .06);
  font-size: 10px;
  font-weight: 700;
}
.live-dot i { width: 6px; height: 6px; border-radius: 50%; background: #bfe39c; box-shadow: 0 0 0 4px rgb(191 227 156 / .1); }
.price-display { display: flex; align-items: flex-start; gap: 10px; margin-top: 34px; }
.price-display span { margin-top: 10px; color: #d9cdc1; font-size: 18px; font-weight: 700; }
.price-display strong { font-size: clamp(55px, 6.4vw, 84px); line-height: .98; letter-spacing: -.065em; }
.rounding-note { margin: 9px 0 24px; color: #c8baad; font-size: 10px; }
.breakdown-card {
  padding: 19px;
  border: 1px solid rgb(255 255 255 / .11);
  border-radius: 18px;
  background: rgb(255 255 255 / .065);
}
.breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 7px 0; color: #cfc5bb; font-size: 11px; }
.breakdown-row strong { color: #fff; font-size: 12px; }
.breakdown-divider { height: 1px; margin: 12px 0; background: rgb(255 255 255 / .11); }
.formula { color: #bfb3a8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.5; }
.rate-caption { display: flex; align-items: center; gap: 11px; margin-top: auto; padding-top: 20px; }
.rate-caption > span { font-size: 24px; }
.rate-caption p { display: grid; gap: 2px; margin: 0; color: #b9aea4; font-size: 9px; }
.rate-caption strong { color: #f8f3ed; font-size: 11px; }
.rate-caption small { color: #a99d92; font-size: 8px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 4px 0;
  color: #948d83;
  font-size: 9px;
  letter-spacing: .04em;
}

@media (max-width: 900px) {
  .site-shell { padding: 24px 20px; }
  .calculator-grid { grid-template-columns: 1fr; }
  .result-panel { min-height: 480px; }
}

@media (max-width: 560px) {
  .site-shell { padding: 18px 13px; }
  .brand-logo { width: 41px; height: 41px; flex-basis: 41px; }
  .eyebrow { font-size: 9px; }
  .brand-lockup h1 { font-size: 20px; }
  .reset-button { min-height: 39px; padding: 0 12px; font-size: 12px; }
  .currency-tabs { width: 100%; }
  .currency-tab { min-height: 58px; padding: 8px 10px; }
  .flag { font-size: 21px; }
  .input-panel, .result-panel { padding: 23px 19px; border-radius: 23px; }
  .field-grid, .settings-grid { grid-template-columns: 1fr; }
  .input-shell-large { min-height: 72px; }
  .price-display strong { font-size: 61px; }
  footer { flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
