:root {
  color-scheme: light;
  --bg: #f3efe6;
  --bg-2: #e6dfd2;
  --surface: rgba(255, 252, 247, 0.9);
  --ink: #1a1612;
  --muted: #5a534a;
  --line: rgba(26, 22, 18, 0.14);
  --accent: #8c3b1c;
  --accent-ink: #fffaf6;
  --good: #145c3e;
  --danger: #8d1d2c;
  --focus: #1a1612;
  --shadow: 0 30px 70px rgba(48, 28, 12, 0.12);
  --radius: 28px;
  --font: "Avenir Next", "Segoe UI", sans-serif;
  --display: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --tap: 48px;
  --text: 100%;
  --space: 1;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #100e0c;
  --bg-2: #1c1814;
  --surface: rgba(34, 29, 24, 0.88);
  --ink: #f6f1e8;
  --muted: #d2c4b2;
  --line: rgba(246, 241, 232, 0.16);
  --accent: #f0c2a4;
  --accent-ink: #1a120c;
  --good: #b7ead4;
  --danger: #ffb4bc;
  --focus: #f6f1e8;
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
}
[data-contrast="high"] {
  --bg: #fff;
  --bg-2: #fff;
  --surface: #fff;
  --ink: #000;
  --muted: #1a1a1a;
  --line: #000;
  --accent: #6f2200;
  --accent-ink: #fff;
  --good: #044a28;
  --danger: #6d0010;
  --focus: #000;
}
[data-theme="dark"][data-contrast="high"] {
  --bg: #000;
  --bg-2: #000;
  --surface: #000;
  --ink: #fff;
  --muted: #f3f3f3;
  --line: #fff;
  --accent: #ffd7bd;
  --accent-ink: #000;
  --good: #c8ffe4;
  --danger: #ffd0d6;
  --focus: #fff;
}
[data-font="readable"] {
  --font: Verdana, "Trebuchet MS", sans-serif;
  --display: Verdana, sans-serif;
  --space: 1.04;
}
html { font-size: var(--text); }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; min-height: 100dvh; }
body {
  font-family: var(--font);
  letter-spacing: calc((var(--space) - 1) * 0.02em);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(232, 162, 122, 0.28), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--ink);
  line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; touch-action: manipulation; }
button { min-height: var(--tap); min-width: var(--tap); }
input, select, textarea { font-size: max(16px, 1rem); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip {
  position: absolute; left: 12px; top: -40px; background: var(--accent); color: var(--accent-ink);
  padding: 8px 12px; z-index: 5;
}
.skip:focus { top: 12px; }
.shell {
  max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(96px + env(safe-area-inset-bottom));
}
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.brand { font-family: var(--display); font-size: 1.7rem; line-height: 1; letter-spacing: -0.03em; }
.brand small { display: block; margin-top: 6px; font-family: var(--font); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.balance-pill {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 10px 14px; text-decoration: none; color: inherit; min-height: var(--tap);
  display: inline-flex; align-items: center;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; backdrop-filter: blur(16px);
}
label { display: block; font-size: 0.92rem; margin: 14px 0 6px; }
input, select {
  width: 100%; min-height: var(--tap); border-radius: 16px; border: 1px solid var(--line);
  background: transparent; padding: 0 14px;
}
.primary, .ghost, .danger {
  width: 100%; border-radius: 18px; border: 0; margin-top: 14px; padding: 0 16px; cursor: pointer;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger { background: var(--danger); color: #fff; }
[data-theme="dark"] .danger { color: #1a0a0d; }
.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; }
.check input { width: 24px; height: 24px; min-height: 24px; margin-top: 4px; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent); border-top: 1px solid var(--line);
}
.nav a, .nav button {
  text-decoration: none; color: inherit; background: transparent; border: 0; border-radius: 14px; padding: 8px 12px;
}
.nav [aria-current="page"] { background: var(--surface); }
.list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 50dvh; overflow: auto; }
.list button, .menu a {
  text-align: start; background: transparent; border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; text-decoration: none; color: inherit; display: flex; justify-content: space-between; width: 100%;
}
.flag { font-size: 1.4rem; margin-inline-end: 8px; }
.lang-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: stretch; }
.lang-pick, .swap, .sheet-close { width: auto; margin-top: 0; }
.lang-pick {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 2px; min-width: 0; text-align: start; padding: 10px 12px; border-radius: 18px;
  border: 1px solid var(--line); background: transparent; white-space: normal;
}
.lang-copy { display: flex; flex-direction: column; min-width: 0; }
.lang-copy .role, .lang-copy small { color: var(--muted); font-size: 0.78rem; }
.lang-copy .lang-en, .lang-copy small { white-space: normal; line-height: 1.15; }
.swap {
  width: 48px; min-width: 48px; padding: 0; border-radius: 16px; border: 1px solid var(--line); background: transparent;
}
.number-row {
  display: flex; align-items: center; gap: 8px; min-height: 48px;
  border: 1px solid var(--line); border-radius: 16px; padding-inline: 12px;
}
.number-row input { border: 0; background: transparent; min-width: 0; flex: 1; padding: 0; }
.dial-code { display: inline-flex; align-items: center; gap: 4px; flex: none; font-variant-numeric: tabular-nums; }
.dial-code:empty { display: none; }
.dial-code .flag { margin: 0; }
body.sheet-open { overflow: hidden; }
.sheet {
  position: fixed; z-index: 40; left: 0; right: 0; top: 0; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; height: 100dvh; max-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 1.35rem; }
.sheet-close { width: auto; padding: 0 14px; }
.sheet input { margin: 12px 0; }
#lang-list { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.section-label { margin: 16px 0 6px; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.lang-option { align-items: center; gap: 10px; }
.lang-option .mark { width: 1.2rem; margin-inline-start: auto; color: var(--accent); font-size: 1.1rem; }
.lang-option[aria-selected="true"] { border-color: var(--accent); }
.call-screen { min-height: 70dvh; display: flex; flex-direction: column; justify-content: space-between; }
.orb {
  width: 148px; height: 148px; margin: 12px auto; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, var(--accent) 42%, transparent 70%);
  box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 18%, transparent);
}
[data-motion="on"] .orb { animation: breathe 3.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); } }
.timer { font-variant-numeric: tabular-nums; font-size: 3rem; text-align: center; font-family: var(--display); margin: 0; }
.meters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.meters div { border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.meters span { display: block; color: var(--muted); font-size: 0.78rem; }
.controls { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pad button { border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 1.3rem; }
.warn { border-color: var(--danger); }
.footer { margin-top: 22px; color: var(--muted); font-size: 0.85rem; }
.banner {
  position: sticky; bottom: 84px; margin: 12px auto; max-width: 480px; background: var(--ink); color: var(--bg);
  border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: center;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after {
  animation: none !important; transition: none !important;
}
