:root {
  color-scheme: light;
  --bg: #efe5d8;
  --surface: #fffaf4;
  --surface-strong: #ffffff;
  --ink: #241c17;
  --muted: #73665c;
  --accent: #963f2b;
  --accent-strong: #702918;
  --accent-soft: #efd2c4;
  --line: #dfcfc0;
  --success: #397155;
  --danger: #9c3030;
  --board: #7b422d;
  --board-dark: #5c2e20;
  --point-a: #d9a46b;
  --point-b: #6d2d24;
  --white-checker: #f7ead4;
  --black-checker: #292421;
  --shadow: 0 14px 38px rgba(62, 39, 25, 0.10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at top right, rgba(150,63,43,.1), transparent 33rem), var(--bg); }
button, input { font: inherit; }
button { min-height: 48px; border-radius: 14px; border: 0; padding: 0 15px; font-weight: 750; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .44; cursor: not-allowed; }
button:focus-visible, input:focus { outline: 3px solid rgba(150,63,43,.23); outline-offset: 2px; }
input { min-height: 50px; width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: var(--surface-strong); color: var(--ink); font-size: 16px; }

.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; padding: max(13px, env(safe-area-inset-top)) 16px 11px; background: rgba(239,229,216,.93); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(115,102,92,.14); }
.topbar h1 { margin: 0; font-size: clamp(1.7rem, 7vw, 2.25rem); letter-spacing: -.045em; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: .7rem; text-transform: uppercase; letter-spacing: .11em; font-weight: 850; }
.icon-button { width: 48px; padding: 0; background: var(--surface); border: 1px solid var(--line); }

main { width: min(100%, 850px); margin: 0 auto; padding: 14px 12px calc(92px + env(safe-area-inset-bottom)); }
.app-panel { display: grid; gap: 13px; }
.app-panel[hidden] { display: none; }
.panel-card { background: rgba(255,250,244,.96); border: 1px solid rgba(223,207,192,.92); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow); }
.hero-card h2, .panel-card h2, .panel-card h3 { margin: 0; letter-spacing: -.025em; }
.hero-card h2 { margin-top: 13px; font-size: clamp(1.65rem, 7.5vw, 2.5rem); }
.hero-card p { color: var(--muted); line-height: 1.5; }
.status-line { display: flex; align-items: center; gap: 8px; margin: 0 !important; font-size: .9rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #aaa; }
.dot.online { background: var(--success); box-shadow: 0 0 0 5px rgba(57,113,85,.12); }
.dot.listening { background: var(--accent); box-shadow: 0 0 0 5px rgba(150,63,43,.12); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.badge { flex: 0 0 auto; border-radius: 999px; padding: 7px 10px; background: #eee4da; color: var(--muted); font-size: .73rem; font-weight: 850; }
.badge.active { background: rgba(57,113,85,.12); color: var(--success); }
.badge.invalid { background: rgba(156,48,48,.11); color: var(--danger); }
.primary { background: var(--accent); color: white; }
.primary:hover { background: var(--accent-strong); }
.secondary { background: var(--accent-soft); color: var(--accent-strong); }
.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.danger { color: var(--danger); }
.compact { white-space: nowrap; }
.action-row, .camera-main-actions, .camera-controls, .voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.dice-actions { display: grid; grid-template-columns: 1.35fr 1fr; gap: 9px; margin-top: 12px; }
.dice-hint { text-align: center; }
.hint { margin: 11px 0 0; color: var(--muted); line-height: 1.45; font-size: .88rem; }
.empty-state { border: 1px dashed var(--line); border-radius: 16px; padding: 25px 15px; text-align: center; color: var(--muted); }

.dice-picker { display: grid; gap: 10px; }
.dice-picker fieldset { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 15px; }
.dice-picker legend { padding: 0 5px; color: var(--muted); font-size: .78rem; font-weight: 750; }
.die-buttons { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.die-button { min-height: 42px; padding: 0; border: 1px solid var(--line); background: var(--surface-strong); color: var(--ink); font-size: 1.05rem; }
.die-button.selected { background: var(--accent); color: white; border-color: var(--accent); }

.board-heading { margin-bottom: 9px; }
.board-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 11px; }
.board-shell { overflow-x: auto; padding-bottom: 2px; }
.board { min-width: 330px; aspect-ratio: 1.12 / 1; border: 8px solid var(--board-dark); border-radius: 15px; overflow: hidden; background: var(--board); display: grid; grid-template-rows: 1fr 1fr; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.board.editing { box-shadow: inset 0 0 0 3px rgba(255,235,119,.7), 0 0 0 3px rgba(150,63,43,.16); }
.board.previewing { box-shadow: inset 0 0 0 4px rgba(60,132,190,.74), 0 0 0 3px rgba(60,132,190,.16); }
.board-half { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)) .62fr repeat(6, minmax(0,1fr)); position: relative; }
.board-half.top { border-bottom: 2px solid var(--board-dark); }
.point { position: relative; min-width: 0; min-height: 0; padding: 0; border-radius: 0; background: transparent; overflow: hidden; display: flex; justify-content: center; z-index: 1; }
.point::before { content: ""; position: absolute; inset: 0 5%; background: var(--point-a); z-index: -1; }
.point.alt::before { background: var(--point-b); }
.board-half.top .point { align-items: flex-start; padding-top: 4px; }
.board-half.top .point::before { clip-path: polygon(0 0,100% 0,50% 100%); }
.board-half.bottom .point { align-items: flex-end; padding-bottom: 4px; }
.board-half.bottom .point::before { clip-path: polygon(50% 0,100% 100%,0 100%); }
.checker-stack { display: flex; flex-direction: column; align-items: center; width: 100%; z-index: 3; }
.board-half.bottom .checker-stack { flex-direction: column-reverse; }
.checker { width: min(82%, 30px); aspect-ratio: 1; border-radius: 50%; margin: -1px 0; border: 2px solid rgba(0,0,0,.28); box-shadow: 0 2px 3px rgba(0,0,0,.24); }
.checker.white { background: radial-gradient(circle at 35% 30%, #fffdf7, var(--white-checker) 58%, #cdbda7); }
.checker.black { background: radial-gradient(circle at 35% 30%, #615a55, var(--black-checker) 60%, #0f0e0d); border-color: rgba(255,255,255,.13); }
.stack-count { margin-top: 1px; min-width: 19px; height: 19px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.94); color: var(--ink); font-size: .67rem; font-weight: 900; border: 1px solid rgba(0,0,0,.16); }
.board-half.bottom .stack-count { margin-top: 0; margin-bottom: 1px; }
.bar-cell { grid-column: 7; position: relative; display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(90deg, var(--board-dark), var(--board-dark) 5px, #693725 5px, #693725 10px); border-left: 2px solid rgba(0,0,0,.2); border-right: 2px solid rgba(255,255,255,.08); padding: 3px; border-radius: 0; }
.bar-label { position: absolute; color: rgba(255,255,255,.62); font-size: .52rem; font-weight: 900; writing-mode: vertical-rl; text-transform: uppercase; letter-spacing: .08em; }
.bar-checkers { z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.board-half.bottom .bar-checkers { flex-direction: column-reverse; }
.point.selectable, .bar-cell.selectable { box-shadow: inset 0 0 0 3px rgba(255,235,119,.9); }
.point.selected, .bar-cell.selected { box-shadow: inset 0 0 0 4px #fff; }
.point.destination { box-shadow: inset 0 0 0 4px rgba(91,220,154,.95); }
.point.destination::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: rgba(91,220,154,.95); position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 0 4px rgba(255,255,255,.7); }
.board.editing .point:active, .board.editing .bar-cell:active { filter: brightness(1.2); }
.bear-off-button { width: 100%; margin-top: 10px; background: rgba(57,113,85,.12); color: var(--success); border: 1px solid rgba(57,113,85,.35); }

.position-editor { margin-top: 13px; padding: 14px; border: 1px solid rgba(150,63,43,.28); border-radius: 18px; background: linear-gradient(180deg, rgba(239,210,196,.35), rgba(255,255,255,.75)); }
.position-editor[hidden] { display: none; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor-hint { margin-bottom: 12px; }
.editor-tools { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.editor-tool { min-height: 58px; padding: 7px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: .74rem; display: grid; place-items: center; gap: 3px; }
.editor-tool.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent-soft); color: var(--accent-strong); }
.tool-checker { width: 23px; height: 23px; border-radius: 50%; border: 2px solid rgba(0,0,0,.22); }
.tool-checker.white { background: radial-gradient(circle at 35% 30%, #fffdf7, var(--white-checker) 58%, #cdbda7); }
.tool-checker.black { background: radial-gradient(circle at 35% 30%, #615a55, var(--black-checker) 60%, #0f0e0d); border-color: rgba(255,255,255,.15); }
.editor-turn { margin-top: 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor-turn > span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.editor-turn > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.choice-button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); background: white; color: var(--ink); }
.choice-button.selected { background: var(--accent); color: white; border-color: var(--accent); }
.editor-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.editor-summary div { display: flex; align-items: center; justify-content: space-between; padding: 9px 10px; border-radius: 12px; background: white; }
.editor-summary span { color: var(--muted); font-size: .77rem; }
.editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.editor-actions .primary { grid-column: 1/-1; }

.move-list { display: grid; gap: 9px; }
.move-card { width: 100%; min-height: unset; padding: 13px 14px; border: 1px solid var(--line); background: var(--surface-strong); color: var(--ink); text-align: left; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.move-card.recommended { border-color: rgba(150,63,43,.5); background: linear-gradient(135deg, rgba(239,210,196,.62), white); }
.move-card.selected-preview { border-color: rgba(60,132,190,.78); background: linear-gradient(135deg, rgba(199,227,247,.75), white); box-shadow: inset 0 0 0 2px rgba(60,132,190,.18); }
.move-card strong { display: block; font-size: 1rem; }
.move-card small { display: block; color: var(--muted); margin-top: 4px; font-weight: 600; line-height: 1.35; }
.move-rank { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #eee4da; color: var(--muted); font-weight: 900; }
.move-card.recommended .move-rank { background: var(--accent); color: white; }
.move-card.selected-preview .move-rank { background: #3c84be; color: white; }
.move-selection-bar { position: sticky; bottom: 76px; z-index: 30; margin-bottom: 10px; padding: 13px; border: 1px solid rgba(60,132,190,.58); border-radius: 16px; background: rgba(231,244,253,.97); backdrop-filter: blur(14px); box-shadow: 0 12px 30px rgba(32,73,105,.18); display: grid; gap: 10px; }
.move-selection-bar[hidden] { display: none; }
.move-selection-bar span { display: block; color: var(--muted); font-size: .75rem; font-weight: 750; }
.move-selection-bar strong { display: block; margin-top: 2px; font-size: 1.03rem; }
.move-selection-bar small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.35; font-weight: 650; }
.move-selection-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; }
.die-button.rolling { animation: diePulse 180ms ease-in-out infinite alternate; }
@keyframes diePulse { from { transform: scale(.92); opacity: .7; } to { transform: scale(1.04); opacity: 1; } }

.camera-stage { position: relative; width: 100%; aspect-ratio: 4/3; border-radius: 18px; overflow: hidden; background: #1d1916; }
.camera-stage video { width: 100%; height: 100%; object-fit: cover; display: none; }
.camera-stage video.active { display: block; }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: rgba(255,255,255,.74); padding: 24px; }
.camera-placeholder span { font-size: 2.5rem; }
.frame-guide { position: absolute; inset: 8%; pointer-events: none; }
.corner { position: absolute; width: 34px; height: 34px; border-color: rgba(255,255,255,.88); }
.corner.tl { top:0; left:0; border-top:3px solid; border-left:3px solid; }
.corner.tr { top:0; right:0; border-top:3px solid; border-right:3px solid; }
.corner.bl { bottom:0; left:0; border-bottom:3px solid; border-left:3px solid; }
.corner.br { bottom:0; right:0; border-bottom:3px solid; border-right:3px solid; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.recognized-box { margin-top: 12px; border-radius: 14px; padding: 12px 14px; background: #f4eade; display: flex; justify-content: space-between; gap: 14px; }
.recognized-box span { color: var(--muted); }
#snapshotImage { width: 100%; border-radius: 18px; display: block; background: #eee; }
.snapshot-empty { border: 1px dashed var(--line); border-radius: 18px; padding: 34px 18px; color: var(--muted); text-align: center; }
.analysis-box { margin-top: 12px; padding: 15px; border-radius: 16px; background: rgba(57,113,85,.08); }
.analysis-box h3 { margin: 3px 0 6px; }
.analysis-box p { margin: 0; line-height: 1.5; }
.analysis-label { color: var(--success); text-transform: uppercase; letter-spacing: .08em; font-weight: 850; font-size: .68rem; }
.event-log { display: grid; gap: 8px; padding-left: 20px; margin: 0; }
.event-log li { padding-left: 4px; color: var(--muted); line-height: 1.4; }
.turn-history-list { display: grid; gap: 9px; padding: 0; margin: 0; list-style: none; }
.turn-history-item { border: 1px solid var(--line); background: white; border-radius: 14px; padding: 11px 12px; }
.turn-history-item strong { display: block; }
.turn-history-item small { display: block; color: var(--muted); margin-top: 3px; }

.bottom-nav { position: fixed; z-index: 45; left: 50%; bottom: max(8px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 20px), 520px); display: grid; grid-template-columns: repeat(3,1fr); padding: 6px; border: 1px solid rgba(223,207,192,.95); border-radius: 20px; background: rgba(255,250,244,.94); backdrop-filter: blur(18px); box-shadow: 0 12px 34px rgba(55,35,24,.18); }
.nav-button { min-height: 55px; padding: 5px; background: transparent; color: var(--muted); display: grid; place-items: center; gap: 1px; }
.nav-button span { font-size: 1.1rem; }
.nav-button strong { font-size: .72rem; }
.nav-button.active { background: var(--accent-soft); color: var(--accent-strong); }
.toast { position: fixed; left: 50%; bottom: calc(83px + env(safe-area-inset-bottom)); transform: translate(-50%,130px); z-index: 60; width: min(calc(100% - 28px),460px); border-radius: 14px; padding: 13px 16px; background: #201b17; color: white; box-shadow: var(--shadow); transition: transform 180ms ease; text-align: center; }
.toast.show { transform: translate(-50%,0); }

@media (min-width: 680px) {
  main { padding-top: 22px; }
  .app-panel.active { grid-template-columns: 1fr 1fr; }
  .hero-card, .board-card, .moves-card, #cameraPanel > .panel-card:first-child { grid-column: 1/-1; }
  .dice-picker { grid-template-columns: 1fr 1fr; }
  .dice-actions { grid-template-columns: 1.35fr 1fr; }
  .board { aspect-ratio: 1.48 / 1; }
  .checker { width: min(78%,34px); }
  .editor-actions { grid-template-columns: 1fr 1fr 1.3fr; }
  .editor-actions .primary { grid-column: auto; }
}



.board.history-previewing {
  box-shadow: inset 0 0 0 4px rgba(128,93,169,.7), 0 0 0 3px rgba(128,93,169,.15);
}
.history-preview-bar {
  margin-top: 10px;
  padding: 11px;
  border: 1px solid rgba(128,93,169,.4);
  border-radius: 14px;
  background: rgba(239,231,248,.92);
  display: grid;
  gap: 9px;
}
.history-preview-bar[hidden] { display: none; }
.history-preview-bar span { display: block; color: var(--muted); font-size: .75rem; font-weight: 750; }
.history-preview-bar strong { display: block; margin-top: 2px; }

.preview-markers {
  position: absolute;
  z-index: 8;
  inset: 18% 5% auto;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  pointer-events: none;
}
.board-half.bottom .preview-markers { inset: auto 5% 18%; }
.preview-marker {
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #255d86;
  border: 2px solid #3c84be;
  font-size: .65rem;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.preview-marker.from { background: #fff5c7; border-color: #d09b18; color: #6b4c00; }
.preview-marker.hit { background: #ffe0df; border-color: #b8403c; color: #8d211e; }

.preview-steps {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}
.preview-steps[hidden] { display: none; }
.preview-step {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(60,132,190,.1);
  color: #255d86;
}
.preview-step strong {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #3c84be;
  color: white;
}
.preview-step.hit { background: rgba(184,64,60,.1); color: #8d211e; }
.preview-step.hit strong { background: #b8403c; }

.move-option {
  border: 1px solid transparent;
  border-radius: 16px;
  overflow: hidden;
}
.move-option.selected-preview { border-color: rgba(60,132,190,.4); }
.move-option .move-card { border-radius: 15px; }
.natural-move { color: var(--ink) !important; font-weight: 720 !important; }
.move-reason { font-size: .78rem; }
.move-why {
  margin: -2px 10px 7px;
  padding: 0 10px 8px;
  border-radius: 0 0 12px 12px;
  background: rgba(246,238,230,.75);
}
.move-why summary {
  cursor: pointer;
  padding: 8px 0 4px;
  color: var(--accent-strong);
  font-size: .8rem;
  font-weight: 800;
}
.move-why ul { margin: 5px 0 0; padding-left: 18px; color: var(--muted); font-size: .8rem; line-height: 1.45; }

.turn-history-item { padding: 0; overflow: hidden; }
.turn-history-button {
  width: 100%;
  min-height: unset;
  padding: 11px 12px;
  border-radius: 14px;
  background: white;
  color: var(--ink);
  text-align: left;
}
.turn-history-button:active { background: var(--accent-soft); }


.board-tools {
  grid-template-columns: 1fr 1fr;
}
.board-flip-button {
  grid-column: 1 / -1;
}
.board.black-bottom {
  outline: 2px solid rgba(57,113,85,.14);
  outline-offset: 2px;
}

.manual-turn-bar {
  position: sticky;
  bottom: 76px;
  z-index: 29;
  margin-top: 10px;
  padding: 13px;
  border: 1px solid rgba(57,113,85,.5);
  border-radius: 16px;
  background: rgba(237,248,242,.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(39,91,66,.18);
  display: grid;
  gap: 10px;
}
.manual-turn-bar[hidden] { display: none; }
.manual-turn-bar span { display:block; color:var(--muted); font-size:.75rem; font-weight:750; }
.manual-turn-bar strong { display:block; margin-top:2px; }
.manual-turn-bar small { display:block; margin-top:4px; color:var(--muted); line-height:1.35; }
.manual-turn-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.manual-turn-actions .primary { grid-column:1 / -1; }

.editor-summary { grid-template-columns: 1fr 1fr; }
.editor-validation-message {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(57,113,85,.1);
  color: var(--success);
  font-size: .82rem;
  font-weight: 700;
}
.editor-validation-message.invalid {
  background: rgba(156,48,48,.1);
  color: var(--danger);
}

@media (min-width: 680px) {
  .board-tools { grid-template-columns: 1fr 1fr 1fr; }
  .board-flip-button { grid-column: auto; }
  .manual-turn-actions { grid-template-columns: 1fr 1fr 1.2fr; }
  .manual-turn-actions .primary { grid-column: auto; }
}


.strategy-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.strategy-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(70,58,49,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}
.strategy-chip.risk-low { background: rgba(57,113,85,.11); color: #2f684f; border-color: rgba(57,113,85,.22); }
.strategy-chip.risk-medium { background: rgba(196,133,40,.13); color: #7d5317; border-color: rgba(196,133,40,.28); }
.strategy-chip.risk-high { background: rgba(184,64,60,.12); color: #8d211e; border-color: rgba(184,64,60,.28); }
.move-why li.strategy-detail {
  color: var(--ink);
  font-weight: 650;
}


/* v0.10: board-first mobile layout */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar {
  min-height: 48px;
  padding: max(6px, env(safe-area-inset-top)) 11px 6px;
}
.brand-line { display: flex; align-items: baseline; gap: 7px; }
.topbar h1 { font-size: 1.45rem; }
.version-label { color: var(--muted); font-size: .66rem; font-weight: 800; }
.icon-button { width: 38px; min-height: 38px; border-radius: 12px; }

main {
  padding: 7px 7px calc(78px + env(safe-area-inset-bottom));
}
.app-panel { gap: 7px; }
.panel-card { border-radius: 16px; padding: 11px; }

.compact-game-card { padding: 9px 10px; }
.quick-game-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}
.turn-summary {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 7px;
}
.turn-summary h2 { font-size: 1rem; line-height: 1.1; }
.turn-summary .badge { padding: 5px 8px; font-size: .67rem; }
.main-roll-button {
  min-height: 42px;
  padding: 0 13px;
  border-radius: 12px;
  white-space: nowrap;
}
.game-status-line {
  min-height: 17px;
  margin: 6px 1px 0 !important;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.25;
}

.manual-dice-details,
.board-options {
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.5);
}
.manual-dice-details > summary,
.board-options > summary {
  min-height: 34px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  list-style: none;
}
.manual-dice-details > summary::-webkit-details-marker,
.board-options > summary::-webkit-details-marker { display: none; }
.manual-dice-details > summary::after,
.board-options > summary::after {
  content: "⌄";
  margin-left: auto;
  font-size: 1rem;
}
.manual-dice-details[open] > summary::after,
.board-options[open] > summary::after { transform: rotate(180deg); }
.manual-dice-details[open] { padding-bottom: 9px; }
.manual-dice-details .dice-picker { padding: 0 8px; gap: 7px; }
.manual-dice-details .dice-picker fieldset { padding: 7px; border-radius: 11px; }
.manual-dice-details .die-buttons { gap: 4px; }
.manual-dice-details .die-button { min-height: 36px; font-size: .92rem; border-radius: 9px; }
.manual-dice-reset {
  width: calc(100% - 16px);
  min-height: 36px;
  margin: 7px 8px 0;
}

.board-first-card { padding: 5px; }
.board-shell { overflow: hidden; padding: 0; }
.board {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1.48 / 1;
  border-width: 5px;
  border-radius: 11px;
}
.board-half.top .point { padding-top: 2px; }
.board-half.bottom .point { padding-bottom: 2px; }
.checker { width: min(82%, 27px); border-width: 1.5px; }
.bar-label { font-size: .45rem; }

.board-first-card > .hint {
  margin: 6px 3px 0;
  font-size: .72rem;
  line-height: 1.25;
}
.board-options { margin: 7px 3px 2px; }
.board-options[open] { padding-bottom: 8px; }
.board-options .board-tools,
.board-options .action-row {
  margin: 0 8px;
  gap: 6px;
}
.board-options .board-tools {
  grid-template-columns: 1fr 1fr;
}
.board-options .action-row { margin-top: 6px; }
.board-options button { min-height: 39px; padding: 0 8px; font-size: .76rem; }
.board-options .board-flip-button { grid-column: auto; }

.bottom-nav {
  bottom: max(5px, env(safe-area-inset-bottom));
  width: min(calc(100% - 14px), 520px);
  padding: 4px;
  border-radius: 16px;
}
.nav-button { min-height: 46px; }
.nav-button span { font-size: .95rem; }
.nav-button strong { font-size: .66rem; }

@media (max-width: 379px) {
  .topbar h1 { font-size: 1.3rem; }
  .main-roll-button { padding: 0 10px; font-size: .82rem; }
  .turn-summary h2 { font-size: .92rem; }
  .board { border-width: 4px; }
  .checker { width: min(80%, 24px); }
}

@media (min-width: 680px) {
  main { padding-top: 14px; }
  .panel-card { padding: 15px; }
  .board-first-card { padding: 10px; }
  .board { aspect-ratio: 1.48 / 1; }
  .manual-dice-details .dice-picker { grid-template-columns: 1fr 1fr; }
}


/* v0.11: sade zar araçları, dış hane numaraları ve görsel hamle kartları */
.dice-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 7px;
}
.dice-toolbar .main-roll-button,
.dice-toolbar .manual-dice-details > summary {
  min-height: 44px;
}
.dice-toolbar .main-roll-button {
  width: 100%;
}
.dice-toolbar .manual-dice-details {
  margin: 0;
  background: transparent;
}
.dice-toolbar .manual-dice-details > summary {
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,250,244,.96);
  color: var(--ink);
  font-size: .82rem;
}
.dice-toolbar .manual-dice-details[open] {
  grid-column: 1 / -1;
  background: rgba(255,250,244,.96);
}
.dice-toolbar .manual-dice-details[open] > summary {
  justify-content: flex-start;
  border-width: 0 0 1px;
  border-radius: 12px 12px 0 0;
}

.board-shell {
  overflow: visible;
}
.board-number-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr)) .62fr repeat(6, minmax(0,1fr));
  align-items: center;
  width: 100%;
  padding-inline: 5px;
  color: rgba(63,48,39,.72);
  font-size: .54rem;
  font-weight: 900;
  line-height: 1;
  user-select: none;
}
.board-number-row.top { padding-bottom: 3px; }
.board-number-row.bottom { padding-top: 3px; }
.board-number-cell {
  min-width: 0;
  text-align: center;
}
.board-number-cell.bar-space { opacity: 0; }

.preview-markers {
  z-index: 9;
  inset: auto 1px 2% !important;
  flex-wrap: nowrap;
  gap: 1px;
  opacity: .76;
}
.board-half.bottom .preview-markers {
  inset: 2% 1px auto !important;
}
.preview-marker {
  min-width: 17px;
  height: 17px;
  padding: 0 3px;
  border-width: 1px;
  font-size: .54rem;
  background: rgba(255,255,255,.68);
  box-shadow: 0 1px 4px rgba(0,0,0,.16);
  backdrop-filter: blur(2px);
}
.preview-marker.from {
  background: rgba(255,245,199,.7);
}
.preview-marker.hit {
  background: rgba(255,224,223,.72);
}
.point.dense-stack .preview-markers {
  opacity: .6;
  transform: scale(.88);
  transform-origin: center;
}
.bar-cell .preview-markers {
  inset: 50% 1px auto !important;
  transform: translateY(-50%);
  flex-wrap: wrap;
}

.manual-move-comment {
  margin: 8px 0 0;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(57,113,85,.11);
  color: #2f684f;
  font-size: .76rem;
  font-weight: 750;
  line-height: 1.35;
}
.manual-move-comment[hidden] { display: none; }

.move-option.manual-selected {
  border-color: rgba(57,113,85,.55);
  box-shadow: 0 0 0 2px rgba(57,113,85,.1);
}
.move-card {
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 9px;
}
.move-card.manual-selected {
  border-color: rgba(57,113,85,.68);
  background: linear-gradient(135deg, rgba(215,238,225,.82), white);
  box-shadow: inset 0 0 0 2px rgba(57,113,85,.14);
}
.move-card-visual {
  position: relative;
  display: block;
  width: 104px;
  align-self: center;
}
.move-mini-board {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 7px;
  box-shadow: 0 2px 8px rgba(45,31,23,.18);
}
.move-mini-board svg {
  display: block;
  width: 100%;
  height: auto;
}
.move-card-visual .move-rank {
  position: absolute;
  right: -3px;
  top: -5px;
  width: 25px;
  height: 25px;
  border: 2px solid white;
  font-size: .72rem;
  box-shadow: 0 2px 7px rgba(0,0,0,.2);
}
.move-card.manual-selected .move-rank {
  background: var(--success);
  color: white;
}

@media (max-width: 379px) {
  .move-card {
    grid-template-columns: minmax(0, 1fr) 86px;
    padding: 11px;
  }
  .move-card-visual { width: 86px; }
  .strategy-chip:nth-child(n+3) { display: none; }
  .board-number-row { font-size: .49rem; }
}


/* v0.12: görünür zar sonucu, doğrudan kamera ve sayfa sonu kayıtlar */
main {
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.dice-toolbar {
  display: block;
}

.dice-toolbar-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 7px;
}

.dice-toolbar-actions .main-roll-button,
.dice-toolbar-actions .camera-mode-button,
.dice-toolbar-actions .manual-dice-details > summary {
  min-height: 44px;
  width: 100%;
  padding-inline: 7px;
  font-size: .78rem;
  white-space: nowrap;
}

.dice-toolbar-actions .main-roll-button { order: 1; }
.dice-toolbar-actions .manual-dice-details { order: 2; }
.dice-toolbar-actions .camera-mode-button { order: 3; }

.dice-toolbar-actions .manual-dice-details[open] {
  order: 4;
  grid-column: 1 / -1;
}

.dice-result-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 35px;
  margin-top: 7px;
  padding: 6px 10px;
  border: 1px solid rgba(150,63,43,.2);
  border-radius: 12px;
  background: rgba(255,250,244,.9);
  color: var(--muted);
  font-size: .73rem;
}

.dice-result-bar[hidden] {
  display: none;
}

.dice-result-bar strong {
  color: var(--ink);
  font-size: .92rem;
  font-weight: 900;
}

.panel-back-button {
  width: fit-content;
  min-height: 40px;
  margin-bottom: 1px;
  padding-inline: 13px;
}

.records-entry-button {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
  border-style: dashed;
  color: var(--muted);
}

.bottom-nav {
  display: none !important;
}

@media (max-width: 379px) {
  .dice-toolbar-actions {
    gap: 5px;
  }

  .dice-toolbar-actions .main-roll-button,
  .dice-toolbar-actions .camera-mode-button,
  .dice-toolbar-actions .manual-dice-details > summary {
    min-height: 42px;
    padding-inline: 4px;
    font-size: .7rem;
  }
}


/* v0.13: varsayılan basit görünüm */
.topbar {
  position: static;
  padding-block: max(9px, env(safe-area-inset-top)) 8px;
}

.simple-dice-toolbar .dice-toolbar-actions {
  grid-template-columns: 1fr 1fr;
}
.simple-dice-toolbar .manual-dice-details[open] {
  grid-column: 1 / -1;
}

.quick-help {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(150,63,43,.18);
  border-radius: 14px;
  background: rgba(255,250,244,.92);
}
.quick-help[hidden] { display: none; }
.quick-help-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.quick-help-steps span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 760;
  line-height: 1.15;
}
.quick-help-steps strong {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: .72rem;
}
.quick-help > button {
  min-height: 34px;
  width: 100%;
}

.board-first-card > .hint {
  text-align: center;
}

.simple-moves-card {
  padding: 12px;
}
.simple-moves-card[hidden] { display: none; }
.simple-moves-heading h2 {
  margin: 0 0 9px;
  font-size: 1.35rem;
}
.best-move-list { gap: 0; }
.simple-move-option { border: 0; }
.simple-move-card {
  min-height: 112px;
  padding: 12px;
}
.simple-move-card .natural-move {
  font-size: .88rem;
}
.simple-reason {
  color: var(--accent-strong) !important;
  font-size: .74rem !important;
}
.simple-move-details {
  margin: 5px 3px 0;
}
.simple-move-details > summary {
  text-align: center;
}
.other-moves {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.other-moves[hidden] { display: none; }
.other-moves > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,250,244,.86);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 850;
  list-style: none;
}
.other-moves > summary::-webkit-details-marker { display: none; }
.other-moves > summary::after { content: "⌄"; margin-left: 4px; }
.other-moves[open] > summary::after { transform: rotate(180deg); }
.other-move-list { margin-top: 8px; }

.advanced-actions {
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,250,244,.82);
}
.advanced-actions > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 13px;
  cursor: pointer;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 850;
  list-style: none;
}
.advanced-actions > summary::-webkit-details-marker { display: none; }
.advanced-actions > summary::after { content: "⌄"; margin-left: auto; }
.advanced-actions[open] > summary::after { transform: rotate(180deg); }
.advanced-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 0 9px 9px;
}
.advanced-action-grid button {
  min-height: 42px;
  padding-inline: 7px;
  font-size: .76rem;
}
.full-width-action { grid-column: 1 / -1; }

@media (max-width: 379px) {
  .quick-help-steps span { font-size: .63rem; }
  .quick-help-steps strong { width: 20px; height: 20px; flex-basis: 20px; }
  .simple-move-card { grid-template-columns: minmax(0,1fr) 82px; }
}


/* v0.14: doğal zar anlatımı, tanıtım turu ve renkli hamle izleği */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tour-help-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(150,63,43,.25);
  background: rgba(255,250,244,.92);
  color: var(--accent-strong);
  font-size: 1rem;
  font-weight: 950;
}

.simple-dice-toolbar .dice-toolbar-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.simple-dice-toolbar .manual-dice-details[open] {
  grid-column: 1 / -1;
}

.dice-toolbar-actions .camera-mode-button {
  order: 3;
  min-height: 44px;
  width: 100%;
  padding-inline: 6px;
  white-space: nowrap;
  font-size: .78rem;
}

.enhanced-dice-result {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 58px;
}

.dice-result-label {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 750;
}

.dice-pair-visual {
  display: flex;
  align-items: center;
  gap: 6px;
}

.visual-dice-separator {
  color: rgba(63,48,39,.45);
  font-size: 1.1rem;
  font-weight: 900;
}

.visual-die {
  --die-background: #3d7bb1;
  --die-pip: #fff;
  width: 38px;
  height: 38px;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border-radius: 9px;
  background: var(--die-background);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 3px 8px rgba(34,28,24,.18);
}

.visual-die.die-color-1 {
  --die-background: #d18b28;
}

.die-pip-cell {
  display: grid;
  place-items: center;
}

.die-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--die-pip);
  box-shadow: 0 1px 1px rgba(0,0,0,.22);
}

.dice-result-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
}

.dice-result-copy strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: .04em;
}

.dice-result-copy small {
  color: var(--accent-strong);
  font-size: .72rem;
  font-weight: 820;
  line-height: 1.2;
}

.preview-marker.die-color-0 {
  border-color: #3d7bb1;
  color: #245e8c;
  background: rgba(220,239,255,.76);
}

.preview-marker.die-color-1 {
  border-color: #d18b28;
  color: #87560d;
  background: rgba(255,235,194,.8);
}

.preview-step.die-color-0 {
  background: rgba(61,123,177,.11);
  color: #245e8c;
}

.preview-step.die-color-0 strong {
  background: #3d7bb1;
}

.preview-step.die-color-1 {
  background: rgba(209,139,40,.13);
  color: #87560d;
}

.preview-step.die-color-1 strong {
  background: #d18b28;
}

.bar-label {
  font-size: .39rem;
  letter-spacing: .04em;
}

.simple-move-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.simple-move-card > span:first-child {
  width: 100%;
}

.simple-move-card .move-card-visual {
  width: 100%;
  max-width: 286px;
  margin: 2px auto 0;
}

.simple-move-card .move-mini-board {
  width: 100%;
  border-radius: 9px;
}

.simple-move-card .move-card-visual .move-rank {
  right: -4px;
  top: -6px;
}

.feature-tour[hidden] {
  display: none;
}

.feature-tour {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.tour-shade {
  position: absolute;
  inset: 0;
  background: rgba(26,20,17,.46);
  backdrop-filter: blur(1.5px);
}

.tour-popover {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 123;
  max-width: 480px;
  margin-inline: auto;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 18px;
  background: rgba(255,250,244,.98);
  box-shadow: 0 18px 48px rgba(0,0,0,.3);
  pointer-events: auto;
}

.tour-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}

.tour-close-button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
}

.tour-popover h2 {
  margin: 7px 0 5px;
  font-size: 1.2rem;
}

.tour-popover p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.tour-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.tour-actions button {
  min-height: 42px;
}

.tour-highlight {
  position: relative !important;
  z-index: 122 !important;
  isolation: isolate;
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px rgba(209,139,40,.96), 0 12px 35px rgba(0,0,0,.32) !important;
  border-radius: 14px;
}

body.tour-open {
  overflow-x: hidden;
}

@media (max-width: 379px) {
  .simple-dice-toolbar .dice-toolbar-actions {
    gap: 5px;
  }

  .dice-toolbar-actions .main-roll-button,
  .dice-toolbar-actions .camera-mode-button,
  .simple-dice-toolbar .manual-dice-details > summary {
    padding-inline: 3px;
    font-size: .68rem;
  }

  .enhanced-dice-result {
    gap: 7px;
  }

  .visual-die {
    width: 34px;
    height: 34px;
  }

  .simple-move-card .move-card-visual {
    max-width: 250px;
  }
}
