:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #566176;
  --primary: #1d4e9e;
  --primary-dark: #143a78;
  --primary-soft: #e6eefb;
  --ok: #166534;
  --ok-bg: #e3f4e8;
  --warn: #8a4b08;
  --warn-bg: #fdf0cf;
  --bad: #9b1c1c;
  --bad-bg: #fbe6e6;
  --line: #d9d3c5;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(27, 36, 48, 0.08);
  font-size: 20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}
#app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); }
.screen { padding-top: calc(14px + env(safe-area-inset-top)); animation: fade 0.18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1 { font-size: 1.5rem; margin: 0.2rem 0 0.4rem; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 0.2rem 0 0.4rem; }
p { margin: 0.4rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
.en { font-weight: 600; }

.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 48px; }
.topbar .title { flex: 1; font-weight: 700; font-size: 1.05rem; }
.iconbtn {
  min-width: 48px; min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  font-size: 1.25rem; cursor: pointer; color: var(--ink);
}

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 12px 0; }
.card.soft { background: var(--primary-soft); box-shadow: none; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 56px; padding: 12px 18px; border-radius: 16px; border: 2px solid transparent;
  font-size: 1.05rem; font-weight: 700; cursor: pointer; text-align: center; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.99); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: var(--card); color: var(--primary); border-color: var(--primary); }
.btn-ghost { background: transparent; color: var(--primary); text-decoration: underline; min-height: 48px; font-weight: 600; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-warn { background: var(--warn-bg); color: var(--warn); border-color: #e7c76a; }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: #e3a3a3; }
.btn-big { min-height: 72px; font-size: 1.25rem; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

.countdown { display: flex; align-items: baseline; gap: 10px; }
.countdown .num { font-size: 3rem; font-weight: 800; color: var(--primary); line-height: 1; }
.countdown .lbl { font-size: 1.1rem; font-weight: 600; }

.bar { height: 22px; background: #e5e0d3; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #2f6fd1, #1d4e9e); border-radius: 999px; transition: width 0.6s ease; min-width: 2px; }
.bar.thin { height: 10px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  font-weight: 700; font-size: 0.95rem; cursor: pointer; color: var(--ink); font-family: inherit; box-shadow: var(--shadow);
}
.tile .ico { font-size: 1.7rem; }

.notice { border-radius: 14px; padding: 12px 14px; margin: 12px 0; font-size: 0.95rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.info { background: var(--primary-soft); color: var(--primary-dark); }
.notice b { font-weight: 800; }

label.field { display: block; margin: 14px 0; font-weight: 700; }
label.field .help { display: block; font-weight: 400; color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
input[type='text'], input[type='date'], select, textarea {
  width: 100%; min-height: 56px; font-size: 1.1rem; padding: 10px 12px; margin-top: 6px; border: 2px solid var(--line);
  border-radius: 14px; background: #fff; color: var(--ink); font-family: inherit;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid #86adf0; outline-offset: 2px; }
.err { color: var(--bad); font-weight: 600; font-size: 0.92rem; margin-top: 4px; }
.warnmsg { color: var(--warn); font-weight: 600; font-size: 0.92rem; margin-top: 4px; }

.dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 12px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #d4cebf; }
.dots i.on { background: var(--primary); }

.officer { background: var(--card); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); border: 2px solid #cfdcf3; position: relative; }
.officer .who { font-size: 0.85rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.04em; }
.officer .q { font-size: 1.45rem; font-weight: 700; line-height: 1.25; margin: 6px 0 10px; }
.officer .qes { font-size: 1.05rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }

.micwrap { text-align: center; margin: 18px 0 8px; }
.mic {
  width: 128px; height: 128px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 3rem;
  cursor: pointer; box-shadow: 0 6px 18px rgba(29, 78, 158, 0.35); -webkit-tap-highlight-color: transparent;
}
.mic.listening { background: #c2260c; animation: pulse 1.1s infinite; }
.mic.busy { background: #6b7280; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(194, 38, 12, 0.5); } 70% { box-shadow: 0 0 0 26px rgba(194, 38, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(194, 38, 12, 0); } }
.miclabel { margin-top: 8px; font-weight: 700; font-size: 1.05rem; }
.heard { background: #f1efe7; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-style: italic; min-height: 2.6em; }

.fb { border-radius: 18px; padding: 14px 16px; margin: 12px 0; }
.fb.good { background: var(--ok-bg); color: #0f4a26; }
.fb.meh { background: var(--warn-bg); color: var(--warn); }
.fb.bad { background: var(--bad-bg); color: #7f1d1d; }
.fb .big { font-size: 1.25rem; font-weight: 800; }
.fb .ans { margin-top: 6px; color: var(--ink); }
.words span { display: inline-block; padding: 2px 6px; margin: 2px; border-radius: 8px; font-weight: 700; }
.words .okw { background: #cdeed7; color: #0f4a26; }
.words .badw { background: #f7caca; color: #7f1d1d; text-decoration: underline wavy; }

.sessionbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sessionbar .count { font-weight: 700; white-space: nowrap; font-size: 0.95rem; }
.sessionbar .bar { flex: 1; margin: 0; height: 12px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.pill { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #1b2430; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: 90vw;
  z-index: 50; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); }
.modal h2 { margin-top: 0; }

.seg { display: flex; gap: 8px; margin: 8px 0; }
.seg button { flex: 1; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; font-family: inherit; color: var(--ink); }
.seg button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; font-weight: 600; }
.check input { width: 28px; height: 28px; margin-top: 2px; flex: none; }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 22px; }
a { color: var(--primary); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv b { text-align: right; }
.phrase .en { font-size: 1.2rem; }
.step-title { font-size: 1.35rem; font-weight: 800; }
.hide { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 600px) { :root { font-size: 21px; } }
