:root {
  --bg: #0b1220;
  --panel: #111a2d;
  --text: #e9edf5;
  --muted: #a9b4c7;
  --primary: #5cc8ff;
  --good: #1ee3a2;
  --warn: #ffcc66;
  --bad: #ff6b6b;
  --outline: rgba(255, 255, 255, 0.12);
  --shadow: rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --maxw: 980px;
  --tapTargetMin: 56px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 30% 0%, #162443, var(--bg));
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px 16px 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand h1 {
  font-size: 20px;
  margin: 0;
}

.brand .pill {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  color: var(--muted);
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 60%), var(--panel);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 20px 50px var(--shadow);
}

.grid {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.muted {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tapTargetMin);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.btn:focus-visible {
  outline: 3px solid rgba(92, 200, 255, 0.65);
  outline-offset: 2px;
}

.btn.primary {
  background: linear-gradient(180deg, rgba(92, 200, 255, 0.35), rgba(92, 200, 255, 0.12));
  border-color: rgba(92, 200, 255, 0.55);
}

.btn.danger {
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.25), rgba(255, 107, 107, 0.1));
  border-color: rgba(255, 107, 107, 0.55);
}

.btn.ghost {
  background: transparent;
}

.btn.block {
  width: 100%;
}

.btn.small {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  font-size: 13px;
}

.badge.go {
  border-color: rgba(30, 227, 162, 0.6);
  background: rgba(30, 227, 162, 0.15);
}
.badge.caution {
  border-color: rgba(255, 204, 102, 0.75);
  background: rgba(255, 204, 102, 0.15);
}
.badge.no_go {
  border-color: rgba(255, 107, 107, 0.7);
  background: rgba(255, 107, 107, 0.15);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.kpi {
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.12);
}
.kpi .label {
  color: var(--muted);
  font-size: 12px;
}
.kpi .value {
  font-size: 22px;
  margin-top: 6px;
}

.center {
  text-align: center;
}

.big-letter {
  font-size: clamp(64px, 12vw, 140px);
  letter-spacing: 4px;
  font-weight: 750;
  margin: 8px 0;
}

.tapTarget {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  width: min(640px, 100%);
  height: min(520px, 60vh);
  margin: 0 auto;
  border-radius: 22px;
  border: 1px solid rgba(92, 200, 255, 0.4);
  background: radial-gradient(800px 420px at 50% 40%, rgba(92, 200, 255, 0.22), transparent 55%),
    rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
}

.tapTarget.active {
  transform: scale(0.995);
  box-shadow: 0 0 0 3px rgba(92, 200, 255, 0.25), 0 20px 50px rgba(0, 0, 0, 0.35);
}

.tapTarget.trialStart {
  animation: tapTrialFlash 280ms ease-out;
}

@keyframes tapTrialFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(30, 227, 162, 0.0), 0 20px 50px rgba(0, 0, 0, 0.35);
    border-color: rgba(30, 227, 162, 0.0);
  }
  35% {
    box-shadow: 0 0 0 4px rgba(30, 227, 162, 0.35), 0 20px 50px rgba(0, 0, 0, 0.35);
    border-color: rgba(30, 227, 162, 0.75);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(30, 227, 162, 0.0), 0 20px 50px rgba(0, 0, 0, 0.35);
    border-color: rgba(92, 200, 255, 0.4);
  }
}

.tapTarget .hint {
  font-size: 16px;
  color: var(--muted);
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
}
.chip[aria-pressed="true"] {
  border-color: rgba(92, 200, 255, 0.75);
  background: rgba(92, 200, 255, 0.14);
}

.list {
  display: grid;
  gap: 10px;
}
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.03);
}
.item .title {
  font-weight: 650;
}
.item .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 25px 80px var(--shadow);
}
.modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.toggleRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.toggleRow:last-child {
  border-bottom: none;
}

.select {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  padding: 6px 10px;
}

.noSelect {
  user-select: none;
  -webkit-user-select: none;
}
