/* Newcomer Kit — styles. Come Alone family tokens; dark via prefers-color-scheme. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --text: #1d1a22;
  --muted: #625d69;
  --line: rgba(29,26,34,.12);
  --accent: #2fb3a6;
  --accent-ink: #10201e;
  --pink: #ff5c8a;
  --pos: #12806a;
  --neg: #c8324f;
  --gold: #b7791f;
  --warn-bg: #fff3d6;
  --warn-ink: #6b4a00;
  --shadow: 0 10px 30px rgba(29,26,34,.08);
  --radius: 20px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131a;
    --surface: #201d27;
    --surface-2: #2a2633;
    --text: #f3f0f7;
    --muted: #a8a2b1;
    --line: rgba(243,240,247,.12);
    --pos: #4fd1b0;
    --neg: #ff7a93;
    --gold: #f2c46d;
    --warn-bg: #3a2f14;
    --warn-ink: #ffd88a;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-weight: 500; background: var(--bg); color: var(--text);
  line-height: 1.45; min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; font-weight: 800; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main:focus, h1:focus { outline: none; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 900; font-size: 1.15rem; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); flex: 0 0 32px; }
.lang-wrap select { font-weight: 700; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; max-width: 46vw; }

/* Main */
.app { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 16px 32px; }
.screen { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding: 12px 0 16px; }
.hero h1 { font-size: clamp(2rem, 7vw, 2.8rem); }
.hero p { color: var(--muted); margin-top: 8px; font-size: 1.05rem; }
.how { list-style: none; margin-top: 14px; display: grid; gap: 8px; counter-reset: how; }
.how li { counter-increment: how; display: flex; gap: 10px; align-items: baseline; font-weight: 700; }
.how li::before { content: counter(how); flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 900; font-size: .85rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-top: 12px; }
.panel h2 { font-size: 1.15rem; }
.sec { font-size: 1.15rem; margin: 22px 4px 4px; }
.lead { color: var(--muted); font-size: 1.05rem; font-weight: 700; }
.hint { color: var(--muted); font-size: .92rem; margin-top: 6px; }
.hint.pad { padding: 0 4px; margin: 0 0 8px; }
.center { text-align: center; }
.err { color: var(--neg); font-weight: 800; }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 14px; padding: 12px 14px; font-weight: 700; margin-top: 12px; }

.badge { display: inline-block; margin-top: 12px; background: var(--surface-2); color: var(--pos); font-weight: 800; font-size: .85rem; padding: 6px 12px; border-radius: 999px; }
.muted { color: var(--muted); }

/* Home tools */
.tools { list-style: none; display: grid; gap: 10px; margin-top: 8px; }
.tool { display: flex; align-items: center; gap: 14px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-height: 72px; box-shadow: var(--shadow); transition: transform .12s ease; }
.tool:active { transform: scale(.98); }
.tool-ico { flex: 0 0 46px; height: 46px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); }
.tool-ico svg { width: 24px; height: 24px; }
.tool-main { display: flex; flex-direction: column; min-width: 0; }
.tool-name { font-weight: 900; font-size: 1.1rem; }
.tool-sub { color: var(--muted); font-size: .9rem; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; min-width: 0; flex: 1 1 140px; }
.field:first-child { margin-top: 0; }
.field-l { font-weight: 800; font-size: .92rem; color: var(--muted); }
.field-l.top { display: block; margin-top: 14px; }
.panel input, .panel select, .search {
  font: inherit; font-weight: 800; font-size: 1.15rem; color: var(--text); background: var(--surface-2); border: 2px solid transparent;
  border-radius: 14px; padding: 12px 14px; width: 100%; min-height: 50px; -webkit-appearance: none; appearance: none;
}
.panel select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.panel input:focus, .panel select:focus, .search:focus { border-color: var(--accent); outline: none; }
.code { text-transform: uppercase; letter-spacing: .06em; }
.pair { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.pair .field { margin-top: 0; }
.pair.codes { margin-bottom: 4px; }
.pair.codes .field { flex: 1 1 90px; }
.pair.codes .btn { flex: 0 0 auto; margin-bottom: 4px; }
.eq { text-align: center; font-weight: 900; font-size: 1.4rem; color: var(--muted); margin: 8px 0; }
.search { background: var(--surface); border: 1px solid var(--line); margin: 6px 0 12px; }

/* Segments & chips */
.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; margin-top: 6px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 11px; padding: 10px 6px; font-weight: 900; color: var(--muted); cursor: pointer; min-height: 44px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 14px; font-weight: 800; cursor: pointer; min-height: 42px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Results */
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
@media (min-width: 520px) { .result-grid { grid-template-columns: repeat(4, 1fr); } .result-grid.two { grid-template-columns: repeat(2, 1fr); } }
.res { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; border: 2px solid transparent; }
.res.me { border-color: var(--accent); }
.res-l { font-weight: 800; color: var(--muted); font-size: .85rem; }
.res-v { font-weight: 900; font-size: 1.5rem; overflow-wrap: anywhere; }
.res-v.none, .kv-v.none { font-size: .9rem; color: var(--muted); font-weight: 700; }
.outs { list-style: none; display: grid; gap: 8px; margin-top: 14px; }
.out { display: flex; align-items: baseline; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.out-v { font-weight: 900; font-size: 1.35rem; overflow-wrap: anywhere; }
.out-u { color: var(--muted); font-weight: 800; }
.big-res { font-weight: 900; font-size: clamp(1.3rem, 5.5vw, 1.7rem); margin-top: 16px; overflow-wrap: anywhere; }
.big-res.muted { font-size: 1rem; color: var(--muted); }

/* Tables */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { font-weight: 900; color: var(--muted); font-size: .9rem; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.hit td { background: color-mix(in srgb, var(--accent) 22%, transparent); font-weight: 900; }

/* Countries */
.countries { list-style: none; display: grid; gap: 10px; }
@media (min-width: 600px) { .countries { grid-template-columns: 1fr 1fr; } }
.country { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.country[hidden] { display: none; }
.country-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.country-top h3 { font-size: 1.05rem; }
.cc { flex: 0 0 38px; height: 30px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; font-weight: 900; font-size: .8rem; letter-spacing: .04em; }
.kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.kv { display: flex; flex-direction: column; min-width: 0; }
.kv-k { color: var(--muted); font-size: .8rem; font-weight: 800; }
.kv-v { font-weight: 900; overflow-wrap: anywhere; white-space: pre-wrap; }
.calls { display: flex; flex-wrap: wrap; gap: 8px; }
.call { display: flex; align-items: baseline; gap: 8px; text-decoration: none; background: var(--surface-2); border-radius: 14px; padding: 10px 14px; min-height: 48px; }
.call-n { font-weight: 900; font-size: 1.4rem; color: var(--neg); }
.call-l { font-weight: 700; color: var(--muted); font-size: .9rem; }
.sos { display: flex; align-items: center; gap: 16px; }
.sos-n { flex: 0 0 auto; font-weight: 900; font-size: 2.4rem; color: #fff; background: var(--neg); border-radius: 18px; padding: 6px 18px; text-decoration: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 800; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); z-index: 20; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Footer */
.foot { max-width: 720px; width: 100%; margin: 0 auto; padding: 20px 16px 36px; color: var(--muted); font-size: .92rem; text-align: center; border-top: 1px solid var(--line); }
.foot-line + .foot-line { margin-top: 8px; }
.foot-line a { color: var(--text); font-weight: 800; }
.foot-line.sis a { font-weight: 700; color: var(--muted); }
.foot-line.small { font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { .screen { animation: none; } .btn, .toast, .tool { transition: none; } }

/* Buttons & screen head (from the family template) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px;
  padding: 14px 20px; font-weight: 900; font-size: 1.05rem; cursor: pointer; background: var(--surface-2); color: var(--text);
  text-decoration: none; transition: transform .12s ease; min-height: 48px; text-align: center;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; display: flex; }
.btn.big { padding: 16px 22px; font-size: 1.1rem; }
.btn.small { padding: 8px 14px; font-size: .9rem; min-height: 40px; border-radius: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.row .btn { flex: 1 1 120px; }
.center-row { justify-content: center; margin-top: 22px; }
.center-row .btn { flex: 0 1 auto; }

/* Screen head */
.g-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.g-head .back { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; }
.g-head h1 { font-size: 1.4rem; flex: 1; overflow-wrap: anywhere; }
.ico { display: inline-grid; place-items: center; }
.ico svg { width: 22px; height: 22px; display: block; }
