:root { font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif; color: #17364e; --blue: #2f5fb7; --hit: #f0b429; --line: #c3d2e0; }
* { box-sizing: border-box; }
body { margin: 0; background: linear-gradient(#f2f8ff, #fff 42%); }
.lab { width: min(100%, 720px); margin: auto; padding: 12px max(12px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.eyebrow { margin: 0 0 3px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
h1 { margin: 0 0 6px; font-size: 21px; line-height: 1.25; }
header p:last-child { margin: 0 0 10px; color: #5a6b83; font-size: 13px; line-height: 1.55; }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1 1 0; min-height: 44px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #17364e; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.tabs button.active { border-color: var(--blue); color: #fff; background: var(--blue); }

.picker { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.picker label { display: grid; gap: 4px; color: #61728a; font-size: 12px; font-weight: 700; }
.picker select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #17364e; font: inherit; font-size: 15px; }

.stage { padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.dice-head { margin-bottom: 6px; color: #7a889e; font-size: 11px; font-weight: 700; }
.dice-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.cell { display: grid; place-items: center; aspect-ratio: 1; border-radius: 7px; background: #eef3f9; color: #61728a; font-size: 13px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.cell.hit { background: var(--hit); color: #4a3708; }
.caption { margin: 9px 0 0; color: #61728a; font-size: 12px; line-height: 1.55; }

.coin-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.coin-row { display: flex; justify-content: center; gap: 3px; padding: 7px 4px; border-radius: 8px; background: #eef3f9; }
.coin-row.hit { background: var(--hit); }
.coin { font-style: normal; font-size: 12px; font-weight: 800; }
.coin.head { color: #b4521f; }
.coin.tail { color: #3c5a7a; }
.coin-row.hit .coin { color: #4a3708; }

.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 40px 1fr 56px; gap: 8px; align-items: center; font-size: 12px; font-weight: 700; }
.bar { height: 20px; border-radius: 999px; background: #e6edf5; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); transition: width .3s; }
.bar.theory i { background: var(--hit); }
.bar-row b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
.trial-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.trial-actions button { flex: 1 1 auto; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--blue); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.trial-actions button:last-child { color: #7a889e; }

.result { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.value-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding: 5px 0; border-bottom: 1px dashed #e2e9f2; }
.value-row:last-of-type { border-bottom: 0; }
.value-row span { min-width: 104px; color: #61728a; font-size: 12px; font-weight: 700; }
.value-row b { font-size: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.value-row b.answer { color: var(--blue); font-size: 19px; }
.note { margin: 8px 0 0; color: #55657d; font-size: 12.5px; line-height: 1.6; }

@media (min-width: 560px) { .picker { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) {
  h1 { font-size: 19px; }
  .tabs button { font-size: 12px; }
  .cell { font-size: 11px; border-radius: 6px; }
  .value-row span { min-width: 92px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
