:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1d1b18;
  --muted: #6b665d;
  --line: #e2ddd2;
  --accent: #c8102e;      /* Vietnamese red */
  --accent-2: #f2b705;    /* star yellow */
  --ok: #1f7a4d;
  --warn: #b26a00;
  --bad: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --surface: #1e1c19;
    --surface-2: #28251f;
    --text: #f1eee8;
    --muted: #a39d92;
    --line: #34302a;
    --accent: #ff5a6e;
    --accent-2: #ffcf3f;
    --ok: #5cc98f;
    --warn: #f0a93b;
    --bad: #ff7a70;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }

/* Header */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 14px 0 10px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; white-space: nowrap; text-decoration: none; color: var(--text); }
.brand svg { width: 28px; height: 28px; }
.top .spacer { flex: 1; }
@media (max-width: 400px) { .brand span { display: none; } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 10px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
select.cur {
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  padding: 6px 8px; font-size: 14px;
}

/* Tabs */
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; }
.tabs button {
  flex: 1; border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 9px 6px; font-size: 14px; cursor: pointer;
}
.tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.hidden { display: none !important; }

/* Input */
.amount {
  display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--line); border-radius: 12px; padding: 6px 12px;
  background: var(--surface);
}
.amount:focus-within { border-color: var(--accent); }
.amount input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  font-size: 30px; font-weight: 700; padding: 6px 0; font-variant-numeric: tabular-nums;
}
.amount .unit { font-size: 22px; color: var(--muted); font-weight: 600; }
.swap { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chips button {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.chips button:active { transform: scale(.97); }

/* Result */
.big { font-size: 38px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.others { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tip { margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; }

/* Notes */
.notes { display: flex; flex-direction: column; gap: 6px; }
.note { display: flex; align-items: center; gap: 10px; }
.note .bill {
  width: 86px; height: 40px; border-radius: 6px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px; text-shadow: 0 1px 1px rgba(0,0,0,.35);
  border: 1px solid rgba(0,0,0,.12);
}
.note .x { font-size: 18px; font-weight: 700; }
.note .warn { font-size: 12px; color: var(--warn); }
.small { font-size: 13px; color: var(--muted); }

/* Price check */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 13px; color: var(--muted); }
.field select, .field input {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); font-size: 16px;
}
.range { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict { margin-top: 10px; padding: 12px; border-radius: 10px; font-weight: 600; }
.verdict.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.verdict.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.verdict.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Essentials (affiliate) */
.pr { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; color: var(--muted); font-weight: 500; vertical-align: 2px; }
.ess { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ess a {
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface);
}
.ess a:hover { border-color: var(--accent); }
.ess .ico { font-size: 22px; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex: none; }
.ess b { display: block; font-size: 15px; }
.ess span { font-size: 13px; color: var(--muted); }
.ess .go { margin-left: auto; color: var(--muted); }

.guides a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); }
.guides a:last-child { border-bottom: 0; }
.guides a::after { content: " →"; color: var(--muted); }

.actions { display: flex; gap: 8px; margin-top: 12px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

footer { margin-top: 24px; font-size: 12px; color: var(--muted); }
footer p { margin: 6px 0; }
footer a { color: var(--muted); }

/* Article pages */
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.article h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; }
.article h2 { font-size: 19px; margin: 26px 0 8px; }
.article p, .article li { font-size: 16px; }
.article table { width: 100%; border-collapse: collapse; font-size: 15px; }
.article th, .article td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.phrase { font-weight: 700; }
.cta { display: block; text-align: center; margin: 20px 0; padding: 14px; border-radius: 12px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; }
.meta { color: var(--muted); font-size: 13px; }

/* Page heading + crawlable content */
.lead { font-size: 22px; line-height: 1.3; margin: 4px 0 2px; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.seo h2 { font-size: 17px; color: var(--text); margin: 18px 0 8px; }
.seo h2:first-child { margin-top: 0; }
.seo h3 { font-size: 15px; margin: 12px 0 2px; }
.seo p, .seo li { font-size: 14px; }
.seo table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.seo th, .seo td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.seo th { color: var(--muted); font-weight: 600; }
@media (max-width: 400px) {
  .article { padding: 14px; }
  .article table { font-size: 14px; }
  .article th, .article td { padding: 7px 4px; }
}
