:root {
  --page-start: #fff8ef;
  --page-mid: #f3fff7;
  --page-end: #eff6ff;
  --ink-strong: #403852;
  --ink-soft: #736985;
  --panel-bg: rgba(255, 255, 255, 0.8);
  --panel-stroke: rgba(255, 255, 255, 0.88);
  --shadow-soft: 0 24px 54px rgba(111, 93, 137, 0.16);
  --accent-pink: #ff85b6;
  --accent-blue: #82d7ff;
  --accent-mint: #86ddb2;
  --accent-gold: #ffd979;
  --tile-cover: #f6dff0;
  --tile-cover-shadow: 0 0 0 1px rgba(219, 188, 212, 0.75);
  --tile-open: #f5f1ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  color: var(--ink-strong);
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 203, 144, 0.42), transparent 24%),
    radial-gradient(circle at 90% 18%, rgba(133, 216, 255, 0.28), transparent 24%),
    radial-gradient(circle at 24% 82%, rgba(137, 226, 181, 0.28), transparent 22%),
    linear-gradient(180deg, var(--page-start), var(--page-mid) 48%, var(--page-end));
}

button,
select,
input {
  font: inherit;
}

.cloud-layer,
.sparkle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.cloud-layer {
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 255, 255, 0.58), transparent 11%),
    radial-gradient(circle at 70% 14%, rgba(255, 255, 255, 0.48), transparent 10%),
    radial-gradient(circle at 88% 34%, rgba(255, 255, 255, 0.35), transparent 9%),
    radial-gradient(circle at 24% 72%, rgba(255, 255, 255, 0.42), transparent 10%);
}

.sparkle-layer {
  background:
    radial-gradient(circle at 22% 24%, rgba(255, 133, 182, 0.2), transparent 1.5%),
    radial-gradient(circle at 32% 58%, rgba(130, 215, 255, 0.22), transparent 1.6%),
    radial-gradient(circle at 72% 26%, rgba(255, 217, 121, 0.24), transparent 1.6%),
    radial-gradient(circle at 82% 74%, rgba(134, 221, 178, 0.24), transparent 1.8%);
  mix-blend-mode: screen;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  margin-bottom: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.title-wrap h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1;
  letter-spacing: 0.02em;
  font-family: "Cooper Black", "Trebuchet MS", cursive;
}

.title-wrap h1 span {
  color: var(--accent-pink);
}

.eyebrow,
.section-kicker,
.overlay-tag,
.hud-item label,
.meta-chip label,
.legend-card label,
.brief-chip label {
  margin: 0 0 5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  color: var(--ink-soft);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-links a {
  color: var(--ink-strong);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(244, 210, 225, 0.86);
  font-size: 0.9rem;
}

.quick-links a:hover {
  transform: translateY(-1px);
}

.quick-links .mini-link {
  color: var(--ink-soft);
}

.hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  gap: 8px;
  min-width: min(360px, 100%);
}

.hud-item {
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 251, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.hud-item strong {
  display: block;
  font-size: 1.12rem;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.board-area,
.sidebar {
  min-width: 0;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.status-card,
.panel-block,
.board-frame {
  background: var(--panel-bg);
  border: 1px solid var(--panel-stroke);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.status-card {
  flex: 1;
  padding: 12px 14px;
  border-radius: 18px;
}

.status-line {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.4;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-button,
.mini-btn,
.overlay-actions button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.pill-button,
.overlay-actions button {
  padding: 10px 14px;
  color: white;
  background: linear-gradient(135deg, var(--accent-pink), #ffad7d);
  box-shadow: 0 16px 32px rgba(255, 133, 182, 0.26);
  font-size: 0.92rem;
}

.pill-button.secondary,
.overlay-actions .secondary,
.mini-btn {
  color: var(--ink-strong);
  background: linear-gradient(135deg, #ffffff, #eefcf7);
  box-shadow: 0 10px 22px rgba(109, 168, 145, 0.16);
}

.pill-button.soft {
  color: #18413d;
  background: linear-gradient(135deg, #aff3f2, #c5ffcb);
  box-shadow: 0 12px 28px rgba(111, 221, 201, 0.22);
}

.pill-button.soft.is-active {
  background: linear-gradient(135deg, #4ac6d7, #62d889);
  color: #ffffff;
}

.pill-button:hover,
.mini-btn:hover,
.overlay-actions button:hover,
.quick-links a:hover {
  transform: translateY(-2px);
}

.pill-button:disabled,
.mini-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.meta-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.meta-chip {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 28px rgba(119, 131, 157, 0.12);
}

.meta-chip strong {
  display: block;
  font-size: 1.08rem;
}

.board-frame {
  padding: 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(246, 255, 249, 0.9));
}

.board-scroll {
  overflow: auto;
  border-radius: 24px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 248, 252, 0.9), rgba(246, 255, 251, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.92);
  display: flex;
  justify-content: center;
}

.minefield {
  --cols: 6;
  --cell-size: 48px;
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell-size));
  gap: 6px;
  width: fit-content;
}

.minefield.is-wide {
  --cell-size: 44px;
  gap: 5px;
}

.minefield.is-huge {
  --cell-size: 40px;
  gap: 4px;
}

.mine-cell {
  position: relative;
  appearance: none;
  border: 0;
  padding: 0;
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
}

.mine-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--tile-cover);
  box-shadow: var(--tile-cover-shadow);
  border: 1px solid rgba(255, 255, 255, 0.58);
  transition: transform 120ms ease, background 120ms ease;
}

.mine-cell:hover::before {
  transform: translateY(-1px);
}

.mine-cell.is-revealed::before,
.mine-cell.is-lost::before {
  background: #f2eeff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.mine-cell.is-empty::before {
  background: #ddf7ec;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.92),
    inset 0 0 0 2px rgba(150, 222, 188, 0.48);
}

.mine-cell.has-flag::before {
  background: #ffe3ed;
}

.mine-cell.is-mine::before {
  background: #eadff7;
}

.mine-cell.is-exploded::before {
  background: #ffcfd8;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 240, 0.85);
}

.mine-cell.is-wrong::before {
  background: #ffe3d7;
}

.mine-cell:focus-visible {
  outline: 3px solid rgba(98, 188, 247, 0.65);
  outline-offset: 3px;
}

.mine-cell[aria-disabled="true"] {
  cursor: default;
}

.cell-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.number-badge {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.15rem;
  line-height: 1;
  background: transparent;
  color: var(--number-color, #4d79ff);
}

.minefield.is-wide .number-badge,
.minefield.is-huge .number-badge {
  font-size: 0.95rem;
}

.cell-icon {
  display: flex;
  width: 70%;
  height: 70%;
  align-items: center;
  justify-content: center;
}

.cell-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.board-bottom {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.legend-card {
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(244, 213, 227, 0.82);
  font-size: 0.92rem;
}

.sidebar {
  display: grid;
  gap: 14px;
}

.panel-block {
  padding: 18px 18px 20px;
  border-radius: 22px;
}

.panel-block h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
}

.panel-block p {
  margin: 0 0 12px;
  line-height: 1.5;
}

.hint {
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.inline-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.inline-controls select {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(230, 194, 217, 0.8);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink-strong);
}

.mini-btn {
  padding: 9px 12px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  margin-right: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 214, 239, 0.95);
  box-shadow: 0 4px 10px rgba(118, 109, 149, 0.1);
}

.progress-track {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.progress-pill {
  appearance: none;
  border: 0;
  border-radius: 18px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 18px rgba(121, 136, 156, 0.12);
}

.progress-pill strong,
.brief-chip strong,
.helper-chip strong {
  display: block;
  font-size: 1rem;
}

.progress-pill small,
.brief-chip span {
  display: block;
  color: var(--ink-soft);
  margin-top: 4px;
}

.progress-pill.current {
  background: linear-gradient(135deg, rgba(255, 241, 215, 0.94), rgba(255, 231, 242, 0.94));
  border-color: rgba(255, 195, 115, 0.5);
}

.progress-pill.completed {
  box-shadow: inset 0 0 0 1px rgba(130, 214, 175, 0.32), 0 10px 18px rgba(121, 136, 156, 0.12);
}

.progress-pill.locked {
  opacity: 0.48;
  cursor: default;
}

.progress-pill:hover:not(.locked) {
  transform: translateY(-1px);
}

.level-brief,
.helper-list {
  display: grid;
  gap: 10px;
}

.brief-chip,
.helper-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.88);
}

.helper-chip p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.helper-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  position: relative;
  flex-shrink: 0;
}

.helper-flower {
  background: radial-gradient(circle at center, #fff7be 20%, transparent 22%), radial-gradient(circle at 50% 25%, #ff9ec5 26%, transparent 27%), radial-gradient(circle at 72% 42%, #ffd483 26%, transparent 27%), radial-gradient(circle at 63% 72%, #8de1b4 26%, transparent 27%), radial-gradient(circle at 37% 72%, #8bd8ff 26%, transparent 27%), radial-gradient(circle at 28% 42%, #ffb9d8 26%, transparent 27%);
}

.helper-flag {
  background: linear-gradient(135deg, #fff6fb, #ffe7ef);
}

.helper-flag::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 7px;
  width: 4px;
  height: 26px;
  border-radius: 999px;
  background: #72556d;
}

.helper-flag::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 10px;
  width: 16px;
  height: 12px;
  border-radius: 3px 9px 9px 3px;
  background: linear-gradient(135deg, #ff79a1, #ffb25a);
}

.helper-mine {
  background: linear-gradient(135deg, #fff4fb, #fff0dc);
}

.helper-mine::before,
.helper-mine::after {
  content: "";
  position: absolute;
  background: #6f5f7d;
}

.helper-mine::before {
  inset: 10px;
  border-radius: 50%;
}

.helper-mine::after {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  top: 5px;
  left: 16px;
  box-shadow: 12px 0 0 #6f5f7d;
}

.ad-zone {
  position: relative;
  z-index: 1;
  width: min(1360px, calc(100% - 28px));
  margin: 0 auto 24px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(70, 55, 84, 0.34);
  backdrop-filter: blur(10px);
}

.overlay.is-visible {
  display: flex;
}

.overlay .panel {
  width: min(520px, 100%);
  padding: 26px 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 255, 249, 0.94));
  border: 1px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 58px rgba(88, 68, 110, 0.26);
}

.overlay .panel h2 {
  margin: 0 0 12px;
  font-size: 2rem;
  font-family: "Cooper Black", "Trebuchet MS", cursive;
}

.overlay .panel p {
  margin: 0 0 12px;
  line-height: 1.55;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .topbar {
    flex-direction: column;
  }

  .board-layout {
    grid-template-columns: 1fr;
  }

  .hud {
    width: 100%;
    min-width: 0;
  }

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

@media (max-width: 760px) {
  .game-shell {
    width: min(100% - 16px, 100%);
    padding-top: 16px;
  }

  .topbar,
  .board-frame,
  .panel-block,
  .ad-zone {
    padding-left: 14px;
    padding-right: 14px;
  }

  .board-toolbar,
  .board-bottom,
  .meta-row,
  .sidebar,
  .inline-controls,
  .overlay-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .toolbar-actions,
  .overlay-actions {
    display: flex;
  }

  .hud,
  .progress-track {
    grid-template-columns: 1fr 1fr;
  }

  .minefield {
    gap: 6px;
  }
}
