

:root {
  --ink: #14202c;
  --paper: #f2f1ea;
  --felt: #15502f;
  --card: #1d2c3c;
  --edge: #32475e;
  --go: #2f7d52;
  --quiet: #e3e2f2;
  --hot: #ffd37a;
  --bad: #ff9b8a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink); color: var(--paper);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  
}

#app {
  max-width: 820px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(20px, env(safe-area-inset-bottom)) 14px;
}


.screen { display: none; }
.screen.is-on { display: block; }

.title { font-size: clamp(23px, 5vw, 36px); margin: 0 0 4px; line-height: 1.15; }
.sub { color: #9fb8d8; margin: 0 0 14px; font-size: clamp(15px, 2.6vw, 19px); }
.hint { color: #9fb8d8; font-size: clamp(14px, 2.2vw, 16px); margin: 4px 0; }
.msg { color: var(--hot); min-height: 1.3em; margin: 6px 0 0; font-size: 15px; }

.card {
  background: var(--card); border: 1px solid var(--edge);
  border-radius: var(--radius); padding: 14px; margin: 0 0 14px;
}
.card h2 { font-size: clamp(17px, 3vw, 21px); margin: 0 0 6px; }


.btn {
  display: block; width: 100%; min-height: 56px; border: 0;
  border-radius: var(--radius); font: inherit; font-weight: 700;
  font-size: clamp(17px, 3vw, 21px); padding: 14px 18px; margin: 10px 0 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn-go { background: var(--go); color: #fff; }
.btn-quiet { background: var(--quiet); color: #1d2c3c; }
.btn-teach { background: #2f4a66; color: #fff; margin: 0 0 14px; }


.players { display: grid; gap: 8px; }
.player-row { display: flex; gap: 8px; align-items: center; }
.player-row input {
  flex: 1 1 auto; min-width: 0; min-height: 50px; border-radius: 10px;
  border: 1px solid var(--edge); background: #10202c; color: var(--paper);
  font: inherit; font-size: 17px; padding: 8px 12px;
}
.player-drop {
  flex: 0 0 auto; min-width: 50px; min-height: 50px; border-radius: 10px;
  border: 1px solid var(--edge); background: #2b3e52; color: var(--paper);
  font-size: 20px; cursor: pointer;
}

.choices { display: grid; gap: 8px; }
.choice {
  min-height: 54px; border-radius: 10px; border: 2px solid var(--edge);
  background: #10202c; color: var(--paper); font: inherit; font-weight: 700;
  font-size: 17px; padding: 10px 14px; text-align: left; cursor: pointer;
}
.choice.on { border-color: var(--hot); background: #2b3e52; }

.best-note { color: #9fb8d8; margin: 4px 0 0; font-size: 16px; min-height: 1.4em; }

.how { margin: 18px 0 0; color: #9fb8d8; }
.how summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.how ol { margin: 6px 0; padding-left: 1.3em; }
.how li { margin: 4px 0; }


.demo-card { text-align: center; }
.demo-text { font-size: clamp(16px, 2.8vw, 20px); min-height: 4.2em; margin: 0 0 8px; }
.how-canvas {
  display: block; width: 100%; height: min(32vh, 260px);
  border-radius: var(--radius); background: #0f1a24;
}


.board-top { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.whose { flex: 1 1 auto; font-weight: 700; font-size: clamp(17px, 3vw, 21px); margin: 0; }
.count { color: #9fb8d8; margin: 0; font-size: 16px; }
.orders {
  margin: 0 0 8px; text-align: center; font-weight: 700; color: var(--hot);
  font-size: clamp(16px, 2.6vw, 20px); min-height: 1.4em;
}
.table {
  display: block; width: 100%; height: min(44vh, 370px);
  border-radius: var(--radius); background: #0f1a24;
}
.shot-result {
  text-align: center; margin: 8px 0 0; min-height: 2.6em;
  font-size: clamp(16px, 2.8vw, 21px); font-weight: 700;
}
.shot-result.sank { color: #8fe0b0; }
.shot-result .why {
  display: block; color: #9fb8d8; font-weight: 400; font-size: clamp(14px, 2.2vw, 17px);
}


.aimrow { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; }
.btn-step {
  flex: 0 0 auto; width: 64px; min-height: 64px; margin: 0;
  background: #2f4a66; color: #fff; font-size: 30px; line-height: 1; padding: 0;
}
.aimread {
  flex: 1 1 auto; text-align: center; font-weight: 800;
  font-size: clamp(34px, 9vw, 54px); font-variant-numeric: tabular-nums;
}
.aimread .deg { font-size: 0.6em; color: #9fb8d8; }
.aimslider {
  display: block; width: 100%; margin: 8px 0 0; height: 44px;
  accent-color: var(--hot); background: transparent;
}
.btn-fire { margin-top: 10px; }


.totals { display: grid; gap: 8px; margin: 10px 0 16px; }
.total-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); color: #1d2c3c; border-radius: var(--radius);
  padding: 12px 16px; font-size: clamp(17px, 2.6vw, 22px);
}
.total-row.leading { outline: 3px solid var(--hot); }
.total-name { flex: 1 1 auto; font-weight: 700; }
.total-score { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.2em; text-align: right; }

@media (min-width: 620px) {
  .choices { grid-template-columns: repeat(3, 1fr); }
  .btn-go, .btn-quiet, .btn-teach { width: auto; min-width: 220px; display: inline-block; margin-right: 10px; }
  .btn-fire { width: 100%; }
}


.name-memory { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.name-memory .btn { flex: 1 1 auto; min-width: 8rem; min-height: 44px; }
