:root {
  --bg: #000;
  --card: rgba(255,255,255,.06);
  --line: rgba(255,255,255,.10);
  --text: #f5f5f7;
  --dim: rgba(235,235,245,.6);
  --faint: rgba(235,235,245,.3);
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --blue: #0a84ff;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 84px);
  -webkit-font-smoothing: antialiased;
}
main { max-width: 520px; margin: 0 auto; }

h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 4px; }
h2 { font-size: 13px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; margin: 28px 4px 8px; }
p { margin: 0 0 12px; }
.sub { color: var(--dim); margin-bottom: 20px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; margin-bottom: 12px;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row b { font-weight: 600; }

.status { display: flex; align-items: center; gap: 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 12px var(--green); }
.dot.no { background: var(--red); box-shadow: 0 0 12px var(--red); }
.dot.wait { background: var(--orange); box-shadow: 0 0 12px var(--orange); }
.big { font-size: 22px; font-weight: 600; }

button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 14px; padding: 15px 18px;
  width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line);
  cursor: pointer; display: block; text-align: center; text-decoration: none;
}
button:active { transform: scale(.98); }
button.primary { background: var(--text); color: #000; border-color: transparent; }
button.danger { color: var(--red); }
button:disabled { opacity: .35; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices { display: grid; gap: 10px; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choices button.on { background: var(--text); color: #000; }
.stack > * + * { margin-top: 10px; }

input, select, textarea {
  font: inherit; color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--dim); margin: 14px 4px 6px; }

.q { font-size: 22px; font-weight: 600; line-height: 1.3; margin: 8px 0 24px; min-height: 3.9em; }
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 4px 0 20px; }
.progress i { display: block; height: 100%; background: var(--text); transition: width .25s; }

.ticket .row b { font-variant-numeric: tabular-nums; }
.grade { font-size: 64px; font-weight: 700; line-height: 1; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.tag.g { color: var(--green); } .tag.r { color: var(--red); } .tag.o { color: var(--orange); }
.quarters { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 12px; }
.quarters div { text-align: center; font-size: 12px; padding: 8px 0; border-radius: 8px; background: var(--card); color: var(--faint); }
.quarters div.hp { color: var(--dim); }
.quarters div.now { background: var(--text); color: #000; font-weight: 700; }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: rgba(20,20,22,.75); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border-top: 1px solid var(--line);
}
#tabs button { background: none; border: 0; color: var(--faint); font-size: 11px; padding: 10px 0; border-radius: 0; }
#tabs button.on { color: var(--text); }
#tabs.hidden { display: none; }
