/* Layout: one centered column; the full-screen card is the main object; emergency red marks the brand */
[hidden] { display: none !important; }
:root {
  --bg: #f7f6f4; --surface: #ffffff; --ink: #1a1d21; --muted: #5d646d; --line: #e0ddd8;
  --accent: #c8102e; --accent-ink: #ffffff; --accent-soft: #fbe8eb; --link: #0b5cad; --sel: #fff4d6;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans", "Hiragino Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans Thai", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416; --surface: #1c1f23; --ink: #eceef0; --muted: #a2a9b1; --line: #30353b;
    --accent: #ff5a6e; --accent-ink: #1a0005; --accent-soft: #3a1a20; --link: #79b4ff; --sel: #3a3220; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body[data-lang=ko] { word-break: keep-all; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.6; padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); }
header.top .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { font-weight: 800; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .logo { background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 900; letter-spacing: .5px; padding: 2px 6px; border-radius: 6px; }
.lang-switch { font-size: 15px; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; color: var(--ink); }
.lang-hint { padding-top: 10px; font-size: 15px; }
.lang-hint a { display: inline-block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; text-decoration: none; }
main { padding-block: 22px 56px; display: grid; gap: 26px; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(25px, 5vw, 32px); }
h2 { font-size: 20px; }
p { margin: 0; }
.lede { color: var(--muted); font-size: 17px; }
.small { font-size: 14px; color: var(--muted); }
.stack { display: grid; gap: 12px; }
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn.ghost { background: transparent; color: var(--accent); }
.small-btn { min-height: 38px; padding: 0 12px; font-size: 15px; }

.countries { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.country { display: grid; gap: 2px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.country:hover { border-color: var(--accent); }
.country .flag { font-size: 30px; line-height: 1.2; }
.how { margin: 0; padding-left: 22px; display: grid; gap: 6px; }

.sec-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.sec-link { display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; }
.sec-link:hover { border-color: var(--accent); }
.sec-links.big .sec-link { min-height: 120px; }
.ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; font-size: 20px; color: #fff; }
.ico.hospital { background: #c8102e; } .ico.pharmacy { background: #1f7a45; } .ico.lost { background: #2856a8; }

.sos { border-color: var(--accent); }
.nums { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.num { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); text-decoration: none; color: var(--ink); }
.num b { flex: none; font-size: 21px; color: var(--accent); font-variant-numeric: tabular-nums; }
.embassies { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.embassies li { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.embassies li:last-child { border-bottom: 0; padding-bottom: 0; }
.notes { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.disclaimer { border-left: 3px solid var(--line); padding-left: 10px; }

.group { display: grid; gap: 10px; }
.hint { font-size: 14px; color: var(--muted); }
.picks, .phrases { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.picks li, .phrases li { display: grid; gap: 6px; }
.pick { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pick input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.pick:has(input:checked) { border-color: var(--accent); background: var(--sel); }
.mean { display: block; font-weight: 600; }
.loc { display: block; font-size: 15px; color: var(--muted); }
.phrase { width: 100%; text-align: left; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit; cursor: pointer; }
.phrase:hover { border-color: var(--accent); }
.mini { font: inherit; font-size: 16px; width: 130px; min-height: 40px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); margin-left: 36px; }
.builder { display: grid; gap: 24px; }
.showbar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.showbar .show { flex: 1; font-size: 17px; min-height: 54px; white-space: nowrap; padding: 0 12px; }
.showbar [data-clear] { flex: none; padding: 0 12px; font-size: 15px; }
.ad-slot { min-height: 100px; }
.prose { max-width: 65ch; }
footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 14px; color: var(--muted); }
footer p + p { margin-top: 6px; }

/* Full-screen card shown to locals: always light, high contrast, very large text */
body.ov-open { overflow: hidden; }
.overlay { position: fixed; inset: 0; z-index: 100; background: #ffffff; color: #111111; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.ov-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; position: sticky; top: 0; background: #ffffff; padding-bottom: 10px; }
.ov-tools .btn { --accent: #c8102e; --accent-ink: #fff; }
.ov-card { display: grid; gap: 18px; max-width: 900px; margin: 0 auto; padding-top: 8px; }
.ov-line { display: grid; gap: 4px; }
.ov-line.item { padding-left: 1.1em; position: relative; }
.ov-line.item::before { content: "•"; position: absolute; left: 0; top: 0; font-size: var(--ov); line-height: 1.3; color: #c8102e; }
.ov-local { font-size: var(--ov); font-weight: 800; line-height: 1.3; word-break: keep-all; overflow-wrap: anywhere; }
.ov-line.head .ov-local { font-size: calc(var(--ov) * .8); color: #c8102e; }
.ov-mean { font-size: 16px; color: #555555; }
.ov-card.size0 { --ov: clamp(28px, 7.5vw, 48px); }
.ov-card.size1 { --ov: clamp(36px, 10vw, 64px); }
.ov-card.size2 { --ov: clamp(46px, 13vw, 84px); }
/* Long phone numbers and CJK addresses must wrap on 320px screens */
.embassies, .nums { word-break: normal; overflow-wrap: anywhere; }
.btn { max-width: 100%; }
[lang=ja], [lang=zh-CN] { word-break: normal; }
