:root {
  --page-bg: #e8ddc4;
  --panel-bg: rgba(246, 239, 223, 0.92);
  --panel-border: #d6c8a8;
  --text-main: #2c2418;
  --text-soft: #655845;
  --accent: #b8872f;
  --theme-dark: #334138;
  --theme-mid: #465149;
  --theme-light: #5d6d62;
  --shadow-soft: 0 16px 40px rgba(24, 27, 20, 0.12);
  --cell-size: 40px;
  --board-border: #7c857a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.55), transparent 24%),
    linear-gradient(180deg, #efe5cf 0%, var(--page-bg) 60%, #dccda9 100%);
}

html, body { max-width: 100%; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.page-shell { width: min(1440px, calc(100vw - 48px)); margin: 0 auto; padding: 18px 0 max(48px, env(safe-area-inset-bottom)); }
.hero { display: block; margin-bottom: 14px; }
.hero-copy, .hero-panel, .intro-panel, .content-panel, .faq-panel, .control-bar, .mobile-play-panel {
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 22px; box-shadow: var(--shadow-soft);
}
.hero-copy { padding: 14px 18px; }
.hero-panel { padding: 24px 26px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.88rem; font-weight: 700; }
.crumb-link { text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.15; margin-bottom: 10px; }
.lead { max-width: 64ch; font-size: 1.15rem; line-height: 1.6; color: var(--text-soft); margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 0; }
.primary-button, .secondary-button {
  border-radius: 999px; border: 0; padding: 14px 22px; cursor: pointer; font-size: 1rem; font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.primary-button { background: linear-gradient(180deg, #d8ae53, #b8872f); color: #fff9ef; box-shadow: 0 8px 18px rgba(184,135,47,0.28); }
.secondary-button { background: #e7dcc2; color: var(--text-main); border: 1px solid #cfbf99; }
.secondary-button.is-active, .secondary-button[aria-pressed="true"] { background: #c7d2c6; border-color: #9aaa98; }
.primary-button.highlighted { box-shadow: 0 0 0 4px rgba(255, 239, 189, 0.45), 0 8px 18px rgba(184,135,47,0.28); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-1px); }
.primary-button:focus-visible, .secondary-button:focus-visible, .picker select:focus-visible, .cell:focus-visible { outline: 3px solid rgba(255, 249, 214, 0.96); outline-offset: 2px; }
.hero-panel h2 { margin-bottom: 14px; font-size: 1.5rem; }
.hero-panel ul { margin: 0; padding-left: 22px; color: var(--text-soft); line-height: 1.7; }
.intro-panel, .faq-panel { padding: 22px 24px; margin-bottom: 18px; }
.control-bar { padding: 12px 16px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.picker { display: flex; flex-direction: column; gap: 8px; }
.picker select { padding: 12px 14px; border-radius: 14px; border: 1px solid #cfbf99; background: #f7f1e4; color: var(--text-main); }
.status-group { display: flex; flex-direction: column; gap: 4px; }
.status-label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.76rem; color: var(--text-soft); }
.status-group strong { display: block; font-size: 1.25rem; line-height: 1.25; min-height: 1.4em; overflow-wrap: anywhere; word-break: break-word; }
.mobile-play-panel { padding: 12px 18px; margin-bottom: 12px; }
.mobile-play-note { margin: 0; color: var(--text-soft); line-height: 1.6; }
.board-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 16px; }
.intro-panel p, .faq-panel p, .content-panel p { margin: 10px 0 0; color: var(--text-soft); line-height: 1.7; }
.table-area {
  position: relative; background: radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 28%), linear-gradient(180deg, var(--theme-light), var(--theme-mid) 28%, var(--theme-dark));
  border-radius: 28px; padding: 16px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.14), var(--shadow-soft); border: 1px solid rgba(40,52,44,0.45); margin-bottom: 12px;
}
.game-surface { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.board-frame { width: fit-content; min-width: 100%; padding: 16px; border-radius: 20px; background: linear-gradient(180deg, #c8cdc6, #aeb5ad); border: 3px solid var(--board-border); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35); }
.game-board { display: grid; gap: 0; width: fit-content; background: #8b9389; border: 3px solid #7b8379; }
.game-board.beginner-board { --cell-size: 42px; }
.game-board.intermediate-board { --cell-size: 32px; }
.game-board.expert-board { --cell-size: 28px; }
.cell {
  position: relative; width: var(--cell-size); height: var(--cell-size); border: 1px solid #92998f; background: linear-gradient(180deg, #d9ddd7 0%, #bcc2ba 100%);
  color: #1d1d1d; font-family: Arial, Helvetica, sans-serif; font-weight: 700; font-size: clamp(0.95rem, 2vw, 1.2rem);
  display: grid; place-items: center; user-select: none; -webkit-user-select: none; touch-action: manipulation; cursor: pointer;
}
.cell::before { content: ""; position: absolute; inset: 0; box-shadow: inset 2px 2px 0 rgba(255,255,255,0.7), inset -2px -2px 0 rgba(110,119,111,0.55); pointer-events: none; }
.cell.is-open, .cell.is-detonated { background: #eceee9; }
.cell.is-open::before, .cell.is-detonated::before { box-shadow: inset 1px 1px 0 rgba(80,88,83,0.12); }
.cell.is-detonated { background: #e2b6aa; }
.cell.is-wrong-flag { background: #ead6cf; color: #7a3227; }
.cell.number-1 { color: #1e50b8; }
.cell.number-2 { color: #2d7c37; }
.cell.number-3 { color: #c12f2f; }
.cell.number-4 { color: #22398f; }
.cell.number-5 { color: #7f261e; }
.cell.number-6 { color: #13808a; }
.cell.number-7 { color: #202020; }
.cell.number-8 { color: #7e7e7e; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.seo-content { display: grid; gap: 18px; margin-top: 20px; }
.content-panel { padding: 22px 24px; }
.content-panel h2 { font-size: 1.6rem; margin-bottom: 8px; }
.faq-panel { margin-top: 0; }
.faq-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 16px; }
.faq-item { padding: 18px; border-radius: 18px; background: rgba(255,251,243,0.72); border: 1px solid #e4d6b7; }
.faq-item h3 { margin: 0 0 8px; font-size: 1.08rem; }
.faq-item p { margin: 0; }
.win-overlay { position: absolute; inset: 22px; display: grid; place-items: center; background: rgba(17,42,28,0.6); border-radius: 24px; z-index: 20; }
.win-overlay[hidden] { display: none; }
.win-panel { width: min(520px, calc(100% - 48px)); padding: 32px 30px; text-align: center; background: rgba(248,242,227,0.96); border: 1px solid #dbc89c; border-radius: 24px; box-shadow: 0 18px 40px rgba(20,28,21,0.28); }
.win-kicker { margin: 0 0 10px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.82rem; font-weight: 700; }
.win-panel h2 { font-size: 2.5rem; margin-bottom: 10px; }
.win-summary { margin: 0 0 22px; color: var(--text-soft); font-size: 1.08rem; line-height: 1.6; }
@media (max-width: 1100px) {
  .page-shell { width: min(100%, calc(100vw - 24px)); padding: 20px 0 32px; }
  .control-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-grid, .faq-list { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page-shell { width: min(100%, calc(100vw - 16px)); padding: 12px 0 24px; }
  .hero-copy, .hero-panel, .intro-panel, .content-panel, .faq-panel, .control-bar, .mobile-play-panel { padding: 16px; border-radius: 18px; }
  h1 { font-size: 2rem; }
  .hero-actions { gap: 8px; }
  .primary-button, .secondary-button { padding: 11px 16px; font-size: 0.96rem; min-height: 48px; }
  .control-bar { grid-template-columns: 1fr 1fr; gap: 10px; }
  .picker select { min-height: 48px; }
  .table-area { padding: 12px; }
  .game-surface { overflow-x: auto; max-width: 100%; }
  .board-frame { min-width: 0; padding: 6px; }
  .game-board.beginner-board { --cell-size: clamp(29px, calc((100vw - 58px) / 9), 40px); }
  .game-board.intermediate-board { --cell-size: clamp(22px, calc((100vw - 58px) / 16), 30px); }
  .game-board.expert-board { --cell-size: clamp(18px, calc((100vw - 58px) / 30), 24px); }
  .cell { min-width: 0; min-height: 0; width: var(--cell-size); height: var(--cell-size); font-size: clamp(0.72rem, 3.2vw, 1rem); }
  .status-group strong { font-size: 1rem; min-height: 1.3em; }
  .mobile-play-note { font-size: 0.9rem; line-height: 1.4; }
  .board-actions { flex-direction: column; align-items: stretch; }
  .board-actions .primary-button, .board-actions .secondary-button { width: 100%; }
  .win-overlay { inset: 12px; }
  .win-panel h2 { font-size: 2rem; }
}
