:root {
  --sand: #fff4cf;
  --paper: #fffaf0;
  --ink: #2f2a4f;
  --muted: #6c6682;
  --gold: #f6bf32;
  --amber: #f59e0b;
  --green: #22b783;
  --blue: #2787d9;
  --teal: #35c0b0;
  --red: #ef5b4d;
  --rose: #ff4fa3;
  --purple: #7457e8;
  --earth: #c98a45;
  --shadow: 0 18px 36px rgba(75, 53, 28, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.seo-content,
.ad-slot-game-end {
  width: min(760px, 100%);
  margin: 22px auto 0;
}

.seo-content {
  padding: 20px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(85, 56, 32, 0.1);
}

.seo-content h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.seo-content p {
  margin: 0 0 16px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.5;
}

.seo-content p:last-child {
  margin-bottom: 0;
}

.seo-content ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.related-card {
  display: grid;
  gap: 5px;
  min-height: 118px;
  padding: 14px;
  border: 3px solid #ffffff;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #fff0c3 48%, #d7f4ec);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 7px 0 rgba(117, 84, 31, 0.12);
}

.related-card span {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.related-card strong,
.related-card small {
  display: block;
}

.related-card small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.25;
}

.seo-content a,
.legal-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  color: var(--purple);
  font-weight: 900;
  text-decoration: none;
}

.seo-content a:hover,
.legal-footer a:hover {
  text-decoration: underline;
}

.ad-slot-game-end {
  min-height: 90px;
  border: 3px dashed rgba(89, 127, 72, 0.28);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.4);
}

.ad-slot {
  display: none;
}

body.ads-enabled .ad-slot {
  display: block;
}

.legal-footer {
  width: min(760px, 100%);
  margin: 22px auto 0;
  padding: 18px;
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(85, 56, 32, 0.1);
}

.legal-footer strong {
  color: var(--ink);
}

.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin-top: 10px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Arial, system-ui, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(120, 91, 42, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(120, 91, 42, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 16% 14%, rgba(246, 191, 50, 0.38) 0 9%, transparent 10%),
    radial-gradient(circle at 86% 20%, rgba(53, 192, 176, 0.28) 0 10%, transparent 11%),
    linear-gradient(135deg, #fff6d8 0%, #f7e1b8 45%, #c9f0e8 100%);
  background-size: 34px 34px, 34px 34px, 100% 100%, 100% 100%, 100% 100%;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 4px solid rgba(116, 87, 232, 0.55);
  outline-offset: 4px;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1160px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 34px);
}

.start-screen,
.game-screen {
  width: 100%;
  border: 6px solid rgba(255, 255, 255, 0.88);
  border-radius: 28px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: var(--shadow);
}

.start-screen {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(22px, 5vw, 44px);
  text-align: center;
}

.game-screen {
  padding: clamp(16px, 3vw, 28px);
}

.is-hidden {
  display: none !important;
}

.brand-mark {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 26px;
  background: linear-gradient(145deg, #ffffff, #ffe4a6);
  font-size: 3rem;
  box-shadow: 0 10px 0 rgba(117, 84, 31, 0.14);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: #ffe08a;
  color: #704400;
  font-size: 0.95rem;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2.45rem, 7vw, 5rem);
  line-height: 0.98;
  overflow-wrap: anywhere;
  word-break: break-word;
}

h1 span {
  display: inline;
}

.start-screen h2 {
  max-width: 760px;
  margin: 0 auto 12px;
  color: #3f3a68;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.intro {
  max-width: 680px;
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: clamp(1.02rem, 2.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.game-instruction {
  margin-top: -10px;
  padding: 12px 14px;
  border: 3px solid #ffffff;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.difficulty-card {
  min-height: 180px;
  padding: 20px;
  border: 4px solid #ffffff;
  border-radius: 22px;
  background: linear-gradient(145deg, #ffffff, #fff0c3 46%, #d7f4ec);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 0 rgba(117, 84, 31, 0.14);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.difficulty-card:hover {
  transform: translateY(-4px);
  filter: saturate(1.08);
  box-shadow: 0 14px 0 rgba(117, 84, 31, 0.11);
}

.difficulty-card:active {
  transform: translateY(4px);
  box-shadow: 0 5px 0 rgba(117, 84, 31, 0.16);
}

.difficulty-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 3.2vw, 1.8rem);
  line-height: 1.05;
}

.difficulty-card span {
  display: block;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.global-actions,
.game-links,
.result-actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.menu-button,
.subscribe-button,
.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  text-align: center;
  text-decoration: none;
  font-weight: 900;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.menu-button {
  width: min(100%, 300px);
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 8px 0 rgba(39, 135, 217, 0.28);
}

.subscribe-button {
  position: relative;
  isolation: isolate;
  width: min(100%, 390px);
  min-height: 64px;
  padding: 14px 22px;
  border: 5px solid #ffffff;
  background: linear-gradient(135deg, #ff001f 0%, var(--rose) 48%, var(--purple) 100%);
  overflow: hidden;
  box-shadow:
    0 10px 0 #b6004b,
    0 16px 30px rgba(255, 0, 80, 0.34);
  animation: subscribePulse 1.45s ease-in-out infinite;
}

.subscribe-button::before {
  content: "";
  position: absolute;
  inset: -45% auto -45% -55%;
  z-index: -1;
  width: 44%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: subscribeShine 2.1s ease-in-out infinite;
}

.subscribe-button::after {
  content: "▶";
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-left: 10px;
  border-radius: 50%;
  background: #ffffff;
  color: #ff001f;
  font-size: 0.85em;
  line-height: 1;
}

.compact {
  width: auto;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.95rem;
}

.subscribe-button.compact {
  min-height: 48px;
  border-width: 3px;
  box-shadow:
    0 7px 0 #b6004b,
    0 12px 22px rgba(255, 0, 80, 0.28);
}

.menu-button:hover,
.subscribe-button:hover,
.action-button:hover {
  transform: translateY(-3px);
  filter: saturate(1.08);
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.game-header h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
}

.status-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  min-height: 76px;
  padding: 11px 12px;
  border: 3px solid #ffffff;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #fff0c2);
  text-align: center;
}

.stat-card span {
  display: block;
  margin-bottom: 5px;
  color: #766c8f;
  font-size: 0.88rem;
  font-weight: 900;
}

.stat-card strong {
  display: block;
  font-size: clamp(1.02rem, 2.4vw, 1.35rem);
  line-height: 1.1;
}

.controls {
  margin-bottom: 14px;
}

.action-button {
  min-width: 164px;
  background: linear-gradient(135deg, var(--amber), var(--earth));
  box-shadow: 0 7px 0 rgba(145, 91, 29, 0.28);
}

.action-button.secondary {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 7px 0 rgba(39, 135, 217, 0.26);
}

.flag-button.is-active {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  box-shadow:
    0 7px 0 rgba(63, 54, 145, 0.28),
    0 0 0 4px rgba(116, 87, 232, 0.18);
}

.game-message {
  min-height: 48px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  background: #ffffff;
  color: var(--ink);
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(75, 53, 28, 0.08);
}

.game-message.success {
  background: #e6fff5;
}

.game-message.warning {
  background: #fff0e8;
}

.game-message.info {
  background: #eef8ff;
}

.board-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow-x: hidden;
}

.board {
  --board-size: 6;
  --board-max: 384px;
  display: grid;
  grid-template-columns: repeat(var(--board-size), minmax(0, 1fr));
  gap: clamp(6px, 1.4vw, 10px);
  width: min(100%, var(--board-max));
}

.cell {
  display: grid;
  aspect-ratio: 1 / 1;
  width: 100%;
  min-width: 0;
  place-items: center;
  border: 0;
  border-radius: clamp(10px, 2.2vw, 16px);
  background: linear-gradient(145deg, #d69a58, #b9783d);
  color: #ffffff;
  font-size: clamp(1.05rem, 5vw, 1.8rem);
  font-weight: 900;
  box-shadow:
    0 6px 0 #8b552d,
    0 10px 16px rgba(86, 54, 27, 0.16);
  transition:
    transform 130ms ease,
    box-shadow 130ms ease,
    background 180ms ease;
}

.cell:not(:disabled):hover {
  transform: translateY(-2px);
}

.cell:disabled {
  cursor: default;
}

.cell.is-flagged {
  background: linear-gradient(145deg, #7c68f0, #387fd8);
  box-shadow:
    0 6px 0 #3353a2,
    0 10px 16px rgba(51, 83, 162, 0.18);
}

.cell.is-revealed {
  transform: translateY(4px);
  background: linear-gradient(145deg, #fffdf3, #f8e9bf);
  color: var(--ink);
  box-shadow:
    inset 0 2px 10px rgba(100, 76, 38, 0.12),
    0 2px 0 rgba(139, 85, 45, 0.22);
  animation: revealCell 180ms ease-out;
}

.cell.is-treasure {
  background: linear-gradient(145deg, #fff8b7, #f5bf28);
  color: #5e3c00;
  animation: treasurePop 520ms ease-out;
}

.cell.is-trap {
  background: linear-gradient(145deg, #ffe0d8, #f06c58);
  color: #531a12;
  animation: trapShake 360ms ease-out;
}

.cell.number-1 {
  color: #2563eb;
}

.cell.number-2 {
  color: #15803d;
}

.cell.number-3,
.cell.number-4,
.cell.number-5,
.cell.number-6,
.cell.number-7,
.cell.number-8 {
  color: #c2410c;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(33, 27, 56, 0.66);
}

.result-card {
  width: min(560px, 100%);
  padding: clamp(22px, 5vw, 34px);
  border: 6px solid #ffffff;
  border-radius: 28px;
  background: linear-gradient(145deg, #ffffff, #fff1ce);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  animation: modalIn 240ms ease-out;
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.result-card h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
}

.result-card p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 20px;
}

.result-stats div {
  padding: 12px;
  border-radius: 16px;
  background: #ffffff;
}

.result-stats dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.result-stats dd {
  margin: 4px 0 0;
  font-size: 1.18rem;
  font-weight: 900;
}

@keyframes revealCell {
  from {
    transform: scale(0.88);
    opacity: 0.6;
  }

  to {
    transform: translateY(4px) scale(1);
    opacity: 1;
  }
}

@keyframes treasurePop {
  0% {
    transform: scale(0.75);
  }

  60% {
    transform: scale(1.12);
  }

  100% {
    transform: translateY(4px) scale(1);
  }
}

@keyframes trapShake {
  0%,
  100% {
    transform: translateX(0) translateY(4px);
  }

  30% {
    transform: translateX(-5px) translateY(4px);
  }

  60% {
    transform: translateX(5px) translateY(4px);
  }
}

@keyframes modalIn {
  from {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes subscribePulse {
  0%,
  100% {
    filter: saturate(1);
  }

  50% {
    filter: saturate(1.28) brightness(1.08);
  }
}

@keyframes subscribeShine {
  0% {
    left: -55%;
  }

  55%,
  100% {
    left: 120%;
  }
}

@media (max-width: 860px) {
  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-card {
    min-height: 130px;
    text-align: center;
  }

  .game-header {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .status-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  h1 {
    max-width: 250px;
    margin-right: auto;
    margin-left: auto;
    font-size: clamp(1.08rem, 5.1vw, 1.25rem);
    line-height: 1.12;
    word-break: normal;
  }

  h1 span {
    display: block;
    font-size: 0.72em;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .start-screen h2 {
    max-width: 250px;
    margin-right: auto;
    margin-left: auto;
    font-size: 1.08rem;
  }

  .intro {
    max-width: 250px;
    font-size: 0.92rem;
    word-break: break-word;
  }

  .game-instruction {
    max-width: 250px;
  }

  .difficulty-card span {
    max-width: 260px;
    margin-right: auto;
    margin-left: auto;
  }

  .app-shell {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 10px;
  }

  .start-screen,
  .game-screen {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    border-width: 4px;
    border-radius: 22px;
  }

  .start-screen > *,
  .game-screen > *,
  .difficulty-grid,
  .difficulty-card,
  .global-actions,
  .game-links {
    min-width: 0;
    max-width: 100%;
  }

  .start-screen,
  .game-screen {
    padding: 16px;
  }

  .global-actions,
  .game-links,
  .result-actions,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .menu-button,
  .subscribe-button,
  .action-button,
  .compact {
    width: 100%;
    max-width: 100%;
  }

  .board {
    gap: 4px;
    width: 100%;
  }

  .cell {
    border-radius: 10px;
    font-size: clamp(0.95rem, 4.7vw, 1.3rem);
    box-shadow:
      0 4px 0 #8b552d,
      0 7px 12px rgba(86, 54, 27, 0.14);
  }

  .result-stats {
    grid-template-columns: 1fr;
  }
}
