

:root {
  --ink: #101934;
  --paper: #f2f1ea;
  --sky: #16203f;
  --card: #1b2544;
  --edge: #2f3a60;
  --go: #2f7d52;
  --quiet: #e3e2f2;
  --hot: #ffd37a;
  --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(24px, 5.2vw, 38px); margin: 0 0 4px; line-height: 1.15; }
.sub { color: #9fb0dd; margin: 0 0 14px; font-size: clamp(15px, 2.6vw, 19px); }
.hint { color: #9fb0dd; 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: #1b2544; }
.btn-teach { background: #3a4a7d; color: #fff; margin: 0 0 14px; }
.btn-letgo { margin-top: 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: #0f1730; 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: #2a3357; 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: #0f1730; 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: #2a3357; }

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

.how { margin: 18px 0 0; color: #9fb0dd; }
.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(34vh, 280px);
  border-radius: var(--radius); background: var(--sky);
}


.board-top { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.whose { flex: 1 1 auto; font-weight: 700; font-size: clamp(17px, 3vw, 21px); margin: 0; }
.count { color: #9fb0dd; margin: 0; font-size: 16px; }

.plank {
  display: block; width: 100%; height: min(38vh, 340px);
  border-radius: var(--radius); background: var(--sky);
}

.tip-result {
  text-align: center; margin: 10px 0 0; min-height: 2.4em;
  font-size: clamp(18px, 3.2vw, 24px); font-weight: 700;
}
.tip-result .out { display: block; color: #9fb0dd; font-weight: 400; font-size: clamp(15px, 2.2vw, 18px); }
.tip-result.level { color: #8fe0b0; }


.readout { display: grid; gap: 6px; margin: 8px 0 0; }
.readout:empty { margin: 0; }
.effort-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--edge); border-radius: 10px;
  padding: 8px 12px; font-size: clamp(15px, 2.4vw, 18px);
}
.effort-blk { font-weight: 800; min-width: 1.6em; text-align: center; border-radius: 6px; padding: 2px 6px; color: #16182f; }
.effort-txt { flex: 1 1 auto; color: #cfd8f2; }
.effort-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.totals-row {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--edge); border-radius: 10px;
  padding: 10px 12px; font-size: clamp(16px, 2.6vw, 20px); font-weight: 700;
}
.totals-row .t-heavy { color: var(--hot); }


.slotrow { display: flex; gap: 6px; margin: 10px 0 0; justify-content: center; flex-wrap: wrap; }
.slot-btn {
  min-width: 46px; min-height: 46px; border-radius: 10px;
  border: 2px dashed var(--edge); background: #0f1730; color: #9fb0dd;
  font: inherit; font-weight: 700; font-size: 16px; cursor: pointer;
}
.slot-btn.free { border-color: var(--hot); color: var(--hot); }
.slot-btn[disabled] { opacity: 0.35; cursor: default; }

.board-hint { color: #9fb0dd; text-align: center; margin: 8px 0 0; min-height: 1.4em; font-size: 15px; }


.totals { display: grid; gap: 8px; margin: 10px 0 16px; }
.total-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--paper); color: #1b2544; 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; }


.replay[hidden] { display: none !important; }
.replay { margin: 0 0 18px; }
.replay-head { color: #9fb0dd; margin: 0 0 2px; font-size: clamp(15px, 2.2vw, 18px); text-align: center; }
.replay-round {
  color: var(--paper); margin: 0 0 8px; text-align: center; font-weight: 700;
  font-size: clamp(16px, 2.4vw, 20px); min-height: 1.4em;
}
.replay-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.replay-cell { position: relative; }
.replay-cell canvas {
  display: block; width: 100%; height: min(22vh, 190px);
  border-radius: var(--radius); background: var(--sky);
}
.replay-name {
  position: absolute; left: 8px; right: 8px; bottom: 6px;
  display: flex; align-items: baseline; gap: 6px;
  font-size: clamp(13px, 2vw, 16px); font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}
.replay-name .r-who { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-name .r-n { font-weight: 800; font-variant-numeric: tabular-nums; }
.replay-cell.r-best canvas { outline: 3px solid var(--hot); }


@media (min-width: 700px) {
  .replay-grid { grid-template-columns: repeat(3, 1fr); }
}

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


.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; }



@media (hover: hover) and (pointer: fine) {

    
    button,
    select,
    summary,
    [role="button"] {
        transition: filter 0.12s ease;
    }

    button:not(:disabled):hover,
    select:not(:disabled):hover,
    summary:hover,
    [role="button"]:not([aria-disabled="true"]):hover {
        filter: brightness(1.25);
        cursor: pointer;
    }

    
    button:not(:disabled):active,
    select:not(:disabled):active,
    [role="button"]:not([aria-disabled="true"]):active {
        filter: brightness(0.95);
    }
}

