:root {
  --bg: #1a1c21;
  --panel: rgba(27, 29, 35, 0.94);
  --panel-soft: rgba(37, 40, 48, 0.92);
  --ink: #f4f6fb;
  --muted: #aeb4c2;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #ff6a5d;
  --safe: #78c542;
  --danger: #ff5f70;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --cell-size: 38px;:root {
  --bg: #1a1c21;
  --panel: rgba(27, 29, 35, 0.94);
  --panel-soft: rgba(37, 40, 48, 0.92);
  --ink: #f4f6fb;
  --muted: #aeb4c2;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #ff6a5d;
  --safe: #78c542;
  --danger: #ff5f70;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --cell-size: 38px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top center, rgba(255, 106, 93, 0.08), transparent 24%),
    radial-gradient(circle at bottom center, rgba(146, 87, 215, 0.08), transparent 28%),
    linear-gradient(180deg, #1d1f25 0%, #17191d 100%);
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top center, rgba(250, 204, 21, 0.08), transparent 22%),
    radial-gradient(circle at bottom center, rgba(255, 106, 93, 0.07), transparent 24%),
    #121214;
}

.splash-screen.fade-out {
  animation: splash-fade-out 520ms ease forwards;
}

.splash-content {
  text-align: center;
  animation: splash-rise-in 900ms ease both;
}

.splash-logo-shell {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.splash-logo-square {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #33363d, #1f2025);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  animation: splash-pulse 2.2s ease-in-out infinite;
}

.splash-logo-symbol {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  position: relative;
  transform: rotate(45deg);
  background: #facc15;
}

.splash-logo-symbol::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #121214;
  transform: translate(-50%, -50%);
}

.splash-title {
  font-size: clamp(3.2rem, 12vw, 5.8rem);
  letter-spacing: -0.05em;
  background: linear-gradient(180deg, #ffffff 0%, #aeb4c2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.fa-solid {
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 8px 14px 14px;
  position: relative;
}

.screen {
  min-height: calc(100vh - 36px);
}

.eyebrow {
  margin: 0 0 8px;
  color: #ffd15c;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Black Han Sans", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.screen-header {
  text-align: center;
  margin-bottom: 16px;
}

.home-actions {
  position: static;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.screen-header h1 {
  font-size: clamp(2.6rem, 11vw, 4.8rem);
}

.screen-copy {
  margin: 10px auto 0;
  max-width: 520px;
  line-height: 1.5;
  font-size: 0.94rem;
  color: var(--muted);
}

.mode-select-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  max-height: min(68vh, 820px);
  overflow-y: auto;
  padding-right: 10px;
  overscroll-behavior: contain;
}

.mode-grid::-webkit-scrollbar {
  width: 10px;
}

.mode-grid::-webkit-scrollbar-track {
  background: rgba(127, 140, 167, 0.14);
  border-radius: 999px;
}

.mode-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(98, 221, 207, 0.82), rgba(92, 141, 255, 0.82));
  border-radius: 999px;
  border: 2px solid rgba(17, 19, 24, 0.65);
}

.mode-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(124, 236, 223, 0.96), rgba(115, 160, 255, 0.96));
}

.mode-card {
  min-height: 188px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.mode-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.03);
}

.mode-card-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(17, 19, 24, 0.72);
}

.mode-card strong {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.mode-card p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.9rem;
  color: #eff3ff;
}

.basic-card {
  background:
    linear-gradient(180deg, rgba(77, 167, 255, 0.18), rgba(77, 167, 255, 0.05)),
    #232630;
}

.noflag-card {
  background:
    linear-gradient(180deg, rgba(255, 181, 77, 0.18), rgba(255, 181, 77, 0.05)),
    #2a241f;
}

.health-card {
  background:
    linear-gradient(180deg, rgba(120, 197, 66, 0.2), rgba(120, 197, 66, 0.05)),
    #1f2920;
}

.plusminus-card {
  background:
    linear-gradient(180deg, rgba(173, 119, 255, 0.22), rgba(173, 119, 255, 0.05)),
    #241f2c;
}

.multimine-card {
  background:
    linear-gradient(180deg, rgba(255, 106, 93, 0.22), rgba(255, 106, 93, 0.05)),
    #2a2020;
}

.hex-card {
  background:
    linear-gradient(180deg, rgba(56, 224, 208, 0.2), rgba(56, 224, 208, 0.05)),
    #1e2928;
}

.dark-card {
  background:
    linear-gradient(180deg, rgba(97, 119, 255, 0.2), rgba(97, 119, 255, 0.05)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 42%),
    #1c2032;
}

.triangle-card {
  background:
    linear-gradient(180deg, rgba(255, 158, 95, 0.22), rgba(255, 158, 95, 0.05)),
    #2a211d;
}

.mode-detail-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.corner-button {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 18, 22, 0.84);
  color: var(--ink);
  font-size: 2rem;
  cursor: pointer;
}

.detail-hero {
  padding-top: 10px;
  text-align: center;
}

.detail-hero h2 {
  font-size: clamp(2.35rem, 10vw, 4.2rem);
}

.detail-tagline {
  margin: 10px auto 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.detail-panel,
.board-frame,
.modal-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.detail-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 22px 20px;
  text-align: center;
}

.detail-mascot {
  width: 118px;
  height: 118px;
  margin: 0 auto 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.1rem;
  background: linear-gradient(180deg, rgba(255, 106, 93, 0.22), rgba(255, 106, 93, 0.08));
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.04);
}

.detail-mascot i {
  font-size: 3rem;
}

.difficulty-label {
  margin: 0;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(1.95rem, 8vw, 3.4rem);
  color: var(--safe);
}

.difficulty-label.diff-easy {
  color: #78c542;
}

.difficulty-label.diff-normal {
  color: #ffb14a;
}

.difficulty-label.diff-hard {
  color: #ff5f70;
}

.difficulty-slider.diff-easy {
  accent-color: #78c542;
}

.difficulty-slider.diff-normal {
  accent-color: #ffb14a;
}

.difficulty-slider.diff-hard {
  accent-color: #ff5f70;
}

.difficulty-slider-wrap {
  margin-top: 14px;
}

.difficulty-slider {
  width: min(520px, 100%);
  accent-color: var(--accent);
}

.difficulty-scale {
  width: min(520px, 100%);
  margin: 8px auto 0;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-stat,
.status-pill,
.difficulty-item {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.detail-stat span,
.status-pill span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.detail-stat strong,
.status-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 1.06rem;
}

.health-hearts {
  display: flex !important;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}

.health-heart {
  color: #ff3347 !important;
  filter: drop-shadow(0 0 8px rgba(255, 51, 71, 0.34));
  transform-origin: center;
}

.health-heart.lost {
  color: rgba(255, 255, 255, 0.18) !important;
  filter: none;
}

.health-heart.hit {
  animation: heart-pop 420ms ease;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.detail-action-spacer {
  min-height: 1px;
}

.detail-actions .detail-play-button {
  justify-self: center;
}

.detail-actions .secondary-button {
  justify-self: start;
}

.detail-actions .detail-info-button {
  justify-self: end;
}

.detail-play-button,
.primary-button,
.secondary-button,
.detail-info-button,
.close-button {
  border: 0;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.detail-play-button,
.primary-button {
  border-radius: 20px;
  background: linear-gradient(180deg, #ff6b5e, #f6574b);
  color: white;
  font-size: 1.32rem;
  font-weight: 800;
  box-shadow: 0 18px 28px rgba(255, 96, 86, 0.2);
}

.topbar .primary-button {
  min-width: 64px;
  min-height: 56px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.detail-play-button {
  min-width: 240px;
  padding: 18px 28px;
}

.detail-info-button {
  width: 78px;
  height: 78px;
  border-radius: 20px;
  background: linear-gradient(180deg, #9964d8, #8652c9);
  color: white;
  font-size: 2.15rem;
  font-weight: 800;
  box-shadow: 0 16px 28px rgba(134, 82, 201, 0.24);
}

.detail-play-button:hover,
.primary-button:hover,
.secondary-button:hover,
.detail-info-button:hover,
.mode-card:hover,
.corner-button:hover,
.close-button:hover {
  transform: translateY(-2px);
}

.secondary-button,
.close-button {
  border-radius: 16px;
  padding: 10px 16px;
  background: rgba(14, 16, 21, 0.88);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
}

.secondary-button i {
  margin-right: 8px;
}

.icon-only-button {
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.icon-only-button i {
  margin-right: 0;
}

.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  font-size: 1.2rem;
}

.game-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: center;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.board-frame {
  padding: 20px;
  overflow: auto;
  background: rgba(20, 22, 27, 0.96);
}

.board-help {
  margin: 0 0 12px;
  text-align: center;
  color: var(--muted);
}

.mobile-action-bar {
  display: none;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
}

.mobile-action-button {
  min-width: 90px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(34, 37, 45, 0.92);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

.mobile-action-button i {
  font-size: 1.15rem;
}

.mobile-action-button.active {
  background: linear-gradient(180deg, #ff6b5e, #f6574b);
  color: #fff;
  box-shadow: 0 10px 20px rgba(255, 96, 86, 0.18);
}

.tutorial-modal-card {
  max-width: 560px;
}

.tutorial-stage {
  min-height: 150px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(23, 25, 31, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tutorial-board-grid {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
  justify-content: center;
}

.tutorial-demo-cell {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.55rem;
  background: linear-gradient(180deg, #d5d5d7 0%, #bebec1 100%);
  color: #111319;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 10px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.tutorial-demo-cell:hover {
  filter: brightness(1.04);
}

.tutorial-demo-cell:disabled {
  cursor: default;
}

.tutorial-demo-cell.covered {
  background: linear-gradient(180deg, #d5d5d7 0%, #bebec1 100%);
  color: transparent;
}

.tutorial-demo-cell.revealed,
.tutorial-demo-cell.safe {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1.5px rgba(224, 229, 240, 0.18);
}

.tutorial-demo-cell.safe {
  color: transparent;
}

.tutorial-demo-cell.mine {
  background: linear-gradient(180deg, #df6070 0%, #bd394a 100%);
}

.tutorial-demo-cell.safe {
  background: linear-gradient(180deg, #79c62d 0%, #5aa31f 100%);
}

.tutorial-demo-cell.number {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1.5px rgba(224, 229, 240, 0.18);
  color: #44cfff;
}

.tutorial-demo-cell.flag {
  background: rgba(153, 100, 216, 0.18);
  color: #fff;
}

.tutorial-demo-cell.target {
  background: linear-gradient(180deg, #ffcf63 0%, #f2a91c 100%);
  color: #fff7d1;
  text-shadow: 0 0 10px rgba(255, 247, 209, 0.45);
  box-shadow:
    inset 0 0 0 2px rgba(255, 245, 206, 0.72),
    0 0 0 4px rgba(255, 209, 92, 0.18),
    0 8px 18px rgba(242, 169, 28, 0.28);
  animation: tutorial-pop 1.25s ease-in-out infinite;
}

.tutorial-demo-cell.done {
  cursor: default;
}

.tutorial-stage-note {
  margin-top: 14px;
  text-align: center;
  color: #ffd15c;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.45;
}

.tutorial-stage-2 .tutorial-demo-cell.number,
.tutorial-stage-3 .tutorial-demo-cell.flag,
.pulse-safe,
.pulse-danger {
  animation: tutorial-pop 1.25s ease-in-out infinite;
}

.tutorial-actions {
  margin-top: 18px;
}

.tutorial-actions .primary-button,
.tutorial-actions .secondary-button {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 1rem;
  border-radius: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(15, var(--cell-size));
  gap: 4px;
  justify-content: center;
  padding: 16px;
  border-radius: 28px;
  background: #17191f;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hex-board {
  --hex-visual-width: calc(var(--cell-size) * 1.18);
  --hex-visual-height: calc(var(--cell-size) * 1.03);
  --hex-step-x: calc(var(--hex-visual-width) * 0.76);
  --hex-step-y: calc(var(--hex-visual-height) * 0.7);
  --hex-offset-x: calc(var(--hex-step-x) * 0.5);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
  padding-top: 10px;
  gap: 0;
}

.hex-row {
  display: flex;
  justify-content: flex-start;
  gap: 0;
  margin-top: 0;
  height: var(--hex-step-y);
  width: fit-content;
}

.hex-row.offset {
  padding-left: var(--hex-offset-x);
}

.hex-cell-wrap {
  width: var(--hex-step-x);
  height: var(--hex-step-y);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--hex-step-x);
  position: relative;
  overflow: visible;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 0;
  border-radius: 11px;
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(180deg, #d5d5d7 0%, #bebec1 100%);
  color: #101216;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 10px rgba(0, 0, 0, 0.28);
}

.hex-cell {
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
  border-radius: 0;
  width: var(--hex-visual-width);
  height: var(--hex-visual-height);
  padding: 0;
  background: linear-gradient(180deg, #ede9d8 0%, #d9d4bf 100%);
  box-shadow:
    inset 0 0 0 1px rgba(120, 112, 86, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.triangle-board {
  --tri-visual-width: calc(var(--cell-size) * 2.72);
  --tri-visual-height: calc(var(--cell-size) * 1.86);
  --tri-step-x: calc(var(--cell-size) * 0.992);
  --tri-step-y: calc(var(--tri-visual-height) * 1.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
  padding-top: 10px;
  gap: 0;
}

.triangle-row {
  display: flex;
  justify-content: flex-start;
  gap: 0;
  margin-top: 0;
  height: var(--tri-step-y);
  width: fit-content;
}

.triangle-row:first-child {
  margin-top: 0;
}

.triangle-cell-wrap {
  width: var(--tri-step-x);
  height: var(--tri-step-y);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--tri-step-x);
  position: relative;
  overflow: visible;
}

.triangle-cell {
  width: var(--tri-visual-width);
  height: var(--tri-visual-height);
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ece7d8 0%, #d7cfb8 100%);
  box-shadow:
    inset 0 0 0 1px rgba(122, 105, 74, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  font-size: 0.95rem;
}

.triangle-cell.up {
  clip-path: polygon(50% 3%, 2% 97%, 98% 97%);
}

.triangle-cell.down {
  clip-path: polygon(2% 3%, 98% 3%, 50% 97%);
}

.darkness-board .cell.dark-hidden {
  background: rgba(255, 255, 255, 0.03);
  color: transparent;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 2px 8px rgba(0, 0, 0, 0.16);
  filter: none;
}

.darkness-board .cell.revealed.dark-memory {
  background: rgba(255, 255, 255, 0.045);
  color: transparent;
  box-shadow:
    inset 0 0 0 1.5px rgba(176, 191, 222, 0.18),
    0 0 0 1px rgba(10, 12, 16, 0.18);
  text-shadow: none;
}

.darkness-board .cell.revealed.dark-memory::after {
  content: "";
  width: 22%;
  height: 22%;
  border-radius: 999px;
  background: rgba(220, 229, 243, 0.28);
  display: block;
}

.cell i {
  font-size: 1.05rem;
}

.cell:hover {
  filter: brightness(1.06);
}

.cell.revealed {
  background: transparent;
  color: inherit;
  box-shadow: none;
  font-size: 1.65rem;
  font-weight: 800;
}

.cell.revealed.revealed-number {
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    inset 0 0 0 1.5px rgba(224, 229, 240, 0.18),
    0 0 0 1px rgba(10, 12, 16, 0.18);
}

.cell.flagged {
  background: linear-gradient(180deg, #79c62d 0%, #5aa31f 100%);
}

.cell.mine {
  background: linear-gradient(180deg, #df6070 0%, #bd394a 100%);
}

.cell.mine-hit {
  background: linear-gradient(180deg, #ffad5a 0%, #ff7f3c 100%);
}

.cell.mine-reveal {
  animation: mine-pop 360ms ease both;
}

.cell.zero {
  color: transparent;
}

.cell.balanced-zero {
  color: #c779ff;
  text-shadow: 0 0 10px rgba(199, 121, 255, 0.35);
}

.cell.revealed.n1 { color: #44cfff; text-shadow: 0 0 10px rgba(68, 207, 255, 0.35); }
.cell.revealed.n2 { color: #47df52; text-shadow: 0 0 10px rgba(71, 223, 82, 0.35); }
.cell.revealed.n3 { color: #ff5b73; text-shadow: 0 0 10px rgba(255, 91, 115, 0.3); }
.cell.revealed.n4 { color: #a977ff; text-shadow: 0 0 10px rgba(169, 119, 255, 0.32); }
.cell.revealed.n5 { color: #ff9f43; text-shadow: 0 0 10px rgba(255, 159, 67, 0.35); }
.cell.revealed.n6 { color: #29e1d9; text-shadow: 0 0 10px rgba(41, 225, 217, 0.32); }
.cell.revealed.n7 { color: #f6f7fb; text-shadow: 0 0 8px rgba(246, 247, 251, 0.22); }
.cell.revealed.n8 { color: #ffd84f; text-shadow: 0 0 10px rgba(255, 216, 79, 0.35); }
.cell.revealed.nneg { color: #ff90ff; text-shadow: 0 0 10px rgba(255, 144, 255, 0.35); }

.flag-mark,
.mine-stack {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flag-mark b,
.mine-stack em {
  position: absolute;
  right: -8px;
  bottom: -6px;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  color: #fff;
}

.plus-flag b {
  background: #2ea84f;
}

.minus-flag b {
  background: #9b59d0;
}

.multi-flag b {
  background: #ff9f1c;
}

.flag-mark.plus-plain b {
  display: none;
}

.mine-stack em {
  background: #ff6a5d;
}

.modal,
.result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 18, 23, 0.7);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.result-overlay.result-show {
  animation: result-fade-in 320ms ease both;
}

.modal-card,
.result-card {
  width: min(620px, 100%);
  padding: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rules-section + .rules-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.rules-section h3 {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 800;
}

.rules-copy,
.rules-list,
.difficulty-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.rules-list {
  padding-left: 20px;
}

.difficulty-list {
  display: grid;
  gap: 10px;
}

.difficulty-item strong {
  display: block;
  margin-bottom: 6px;
}

.achievement-item.unlocked {
  border-color: rgba(120, 197, 66, 0.35);
  box-shadow: inset 0 0 0 1px rgba(120, 197, 66, 0.15);
}

.achievement-badge-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.achievement-copy {
  min-width: 0;
  flex: 1;
}

.achievement-progress {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.achievement-badge {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 58px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge::before,
.achievement-badge::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 14px;
  height: 18px;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.achievement-badge::before {
  left: 50%;
  transform: translateX(-50%);
}

.achievement-badge::after {
  display: none;
}

.achievement-badge-core {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: #14161b;
  background: rgba(255, 255, 255, 0.75);
}

.achievement-badge-bronze {
  background: #87453d;
  box-shadow:
    inset 0 0 0 1px rgba(70, 32, 28, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge-bronze::before,
.achievement-badge-bronze::after {
  background: #6b342e;
}

.achievement-badge-bronze .achievement-badge-core {
  width: 38px;
  height: 38px;
  font-size: 0;
  color: transparent;
  background: #87453d;
  box-shadow:
    inset 0 0 0 6px rgba(108, 52, 46, 0.95),
    inset 0 0 0 7px rgba(67, 28, 24, 0.15);
  position: relative;
}

.achievement-badge-bronze .achievement-badge-core::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #4e241f;
  transform: translate(-50%, -50%);
}

.achievement-badge-silver {
  background: #bcc4d2;
  box-shadow:
    inset 0 0 0 1px rgba(90, 101, 122, 0.16),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge-silver::before,
.achievement-badge-silver::after {
  background: #8f97a8;
}

.achievement-badge-silver .achievement-badge-core {
  width: 38px;
  height: 38px;
  font-size: 0;
  color: transparent;
  background: #bcc4d2;
  box-shadow:
    inset 0 0 0 6px rgba(144, 153, 169, 0.96),
    inset 0 0 0 7px rgba(73, 82, 99, 0.12);
  position: relative;
}

.achievement-badge-silver .achievement-badge-core::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #687184;
  transform: translate(-50%, -50%);
}

.achievement-badge-gold {
  background: #d6ad31;
  box-shadow:
    inset 0 0 0 1px rgba(101, 72, 9, 0.16),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge-gold::before,
.achievement-badge-gold::after {
  background: #b38413;
}

.achievement-badge-gold .achievement-badge-core {
  width: 38px;
  height: 38px;
  font-size: 0;
  color: transparent;
  background: #d6ad31;
  box-shadow:
    inset 0 0 0 6px rgba(181, 132, 19, 0.96),
    inset 0 0 0 7px rgba(90, 62, 7, 0.12);
  position: relative;
}

.achievement-badge-gold .achievement-badge-core::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #77570e;
  transform: translate(-50%, -50%);
}

.achievement-item.locked .achievement-badge {
  filter: grayscale(0.9) brightness(0.68);
  opacity: 0.7;
}

.achievement-item.locked strong {
  color: #d4d8e3;
}

.achievement-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.result-card {
  text-align: center;
}

.result-overlay.result-show .result-card {
  animation: result-card-pop 460ms cubic-bezier(0.2, 0.9, 0.22, 1) both;
}

.result-label {
  margin: 0 0 8px;
  color: #ffd15c;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#resultTitle {
  font-size: clamp(2.35rem, 6vw, 3.8rem);
  margin-bottom: 14px;
  font-family: "Black Han Sans", sans-serif;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.achievement-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: min(320px, calc(100vw - 36px));
  padding: 16px 18px;
  border: 1px solid rgba(120, 197, 66, 0.28);
  border-radius: 18px;
  background: rgba(20, 24, 18, 0.96);
  box-shadow: var(--shadow);
  animation: toast-in 260ms ease;
}

.achievement-toast-label {
  margin: 0 0 6px;
  color: #ffd15c;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.achievement-toast strong {
  display: block;
  color: #ffffff;
  font-size: 1.1rem;
}

.achievement-toast span {
  display: block;
  margin-top: 4px;
  color: #cfd6e7;
  line-height: 1.5;
}

@keyframes mine-pop {
  0% {
    transform: scale(0.72);
    opacity: 0.15;
  }

  65% {
    transform: scale(1.08);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes splash-rise-in {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splash-fade-out {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes splash-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  }

  50% {
    transform: scale(1.045);
    box-shadow: 0 18px 42px rgba(250, 204, 21, 0.14);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  }
}

@keyframes toast-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes result-fade-in {
  0% {
    opacity: 0;
    backdrop-filter: blur(0px);
  }

  100% {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

@keyframes result-card-pop {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.88);
  }

  65% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
  }

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

@keyframes heart-pop {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.35) rotate(-8deg);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes tutorial-pop {
  0% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-4px) scale(1.06);
  }

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

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

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

  .detail-actions {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .detail-action-spacer {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --cell-size: 30px;
  }

  .app-shell {
    padding: 10px;
  }

  .screen {
    padding: 18px 16px 20px;
  }

  .screen-header h1,
  .splash-title {
    font-size: clamp(2.1rem, 12vw, 3.2rem);
  }

  .screen-copy,
  .detail-tagline,
  .rules-copy,
  .mode-card p {
    font-size: 0.94rem;
    line-height: 1.5;
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .mode-grid {
    gap: 12px;
    max-height: min(66vh, 720px);
    padding-right: 6px;
  }

  .mode-card {
    min-height: 168px;
    padding: 14px;
    border-radius: 22px;
  }

  .mode-card strong {
    font-size: 1.28rem;
    margin-bottom: 8px;
  }

  .mode-card-badge {
    margin-bottom: 10px;
    padding: 5px 9px;
    font-size: 0.68rem;
  }

  .corner-button,
  .secondary-button,
  .close-button,
  .primary-button,
  .icon-only-button {
    transform: scale(0.92);
    transform-origin: center;
  }

  .topbar-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  .status-pill {
    min-width: 92px;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .status-pill span {
    font-size: 0.68rem;
  }

  .status-pill strong {
    font-size: 1.2rem;
  }

  .board-frame,
  .modal-card,
  .result-card {
    border-radius: 22px;
  }

  .board-frame {
    padding: 14px;
  }

  .board-help {
    margin-bottom: 10px;
    font-size: 0.84rem;
  }

  .mobile-action-bar {
    display: flex;
  }

  .triangle-board {
    --tri-visual-width: calc(var(--cell-size) * 2.65);
    --tri-visual-height: calc(var(--cell-size) * 1.675);
    --tri-step-x: calc(var(--cell-size) * 1.4004);
    --tri-step-y: calc(var(--tri-visual-height) * 1.08);
  }

  .detail-play-button {
    width: 100%;
    min-width: 0;
    min-height: 76px;
    font-size: 1.8rem;
  }

  .detail-info-button {
    width: 68px;
    height: 68px;
    font-size: 1.9rem;
  }

  .detail-panel {
    padding: 18px 16px;
  }

  .detail-mascot {
    width: 108px;
    height: 108px;
    font-size: 3.4rem;
  }

  .detail-difficulty-label,
  .difficulty-label {
    font-size: 3rem;
  }

  .mode-detail-screen {
    gap: 10px;
    justify-content: flex-start;
  }

  .mode-detail-screen .detail-hero {
    padding-top: 0;
    margin-top: -8px;
  }

  .mode-detail-screen .detail-hero h2 {
    font-size: clamp(1.95rem, 8vw, 2.6rem);
  }

  .mode-detail-screen .detail-tagline {
    margin-top: 6px;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .mode-detail-screen .detail-panel {
    padding: 14px 14px;
  }

  .mode-detail-screen .detail-mascot {
    width: 88px;
    height: 88px;
    margin-bottom: 8px;
    font-size: 2.6rem;
  }

  .mode-detail-screen .detail-mascot i {
    font-size: 2.45rem;
  }

  .mode-detail-screen .difficulty-label {
    font-size: 2.35rem;
  }

  .mode-detail-screen .difficulty-slider-wrap {
    margin-top: 10px;
  }

  .mode-detail-screen .difficulty-scale {
    margin-top: 6px;
    font-size: 0.74rem;
  }

  .mode-detail-screen .detail-stats {
    margin-top: 12px;
    gap: 8px;
  }

  .mode-detail-screen .detail-stat {
    padding: 10px 8px;
  }

  .mode-detail-screen .detail-stat span {
    font-size: 0.68rem;
  }

  .mode-detail-screen .detail-stat strong {
    font-size: 0.96rem;
  }

  .mode-detail-screen .detail-actions {
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 8px;
  }

  .mode-detail-screen .secondary-button {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .mode-detail-screen .detail-play-button {
    width: auto;
    min-width: 0;
    min-height: 62px;
    font-size: 1.5rem;
    padding: 14px 30px;
  }

  .mode-detail-screen .detail-info-button {
    width: 58px;
    height: 58px;
    font-size: 1.55rem;
  }

  .result-card {
    width: min(92vw, 360px);
    padding: 26px 18px;
  }

  .modal-card {
    padding: 22px 16px;
  }

  .tutorial-modal-card {
    padding: 18px 14px;
  }

  .tutorial-modal-card .modal-header {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
  }

  .tutorial-modal-card .modal-header h2 {
    flex: 1;
    min-width: 0;
    font-size: 1.45rem;
    line-height: 1.2;
    word-break: keep-all;
  }

  .tutorial-modal-card .close-button {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.2rem;
  }

  .tutorial-stage {
    min-height: 130px;
  }

  .tutorial-actions {
    margin-top: 14px;
  }

  .tutorial-board-grid {
    grid-template-columns: repeat(3, 48px);
    gap: 7px;
  }

  .tutorial-demo-cell {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.32rem;
  }

  .tutorial-stage-note {
    margin-top: 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  :root {
    --cell-size: 27px;
  }

  .screen {
    padding: 16px 12px 18px;
  }

  .mode-card {
    min-height: 152px;
    padding: 12px;
  }

  .mode-card strong {
    font-size: 1.12rem;
  }

  .detail-hero h2 {
    font-size: clamp(2.2rem, 10vw, 3rem);
  }

  .mode-detail-screen {
    gap: 8px;
  }

  .mode-detail-screen .detail-hero h2 {
    font-size: clamp(1.8rem, 8.4vw, 2.3rem);
  }

  .mode-detail-screen .detail-tagline {
    font-size: 0.82rem;
  }

  .mode-detail-screen .detail-hero {
    margin-top: -12px;
  }

  .mode-detail-screen .detail-panel {
    padding: 12px 12px;
  }

  .mode-detail-screen .detail-mascot {
    width: 78px;
    height: 78px;
    font-size: 2.25rem;
  }

  .mode-detail-screen .detail-mascot i {
    font-size: 2.1rem;
  }

  .mode-detail-screen .difficulty-label {
    font-size: 2.05rem;
  }

  .mode-detail-screen .detail-stats {
    margin-top: 10px;
    gap: 7px;
  }

  .mode-detail-screen .detail-stat {
    padding: 9px 8px;
  }

  .mode-detail-screen .detail-play-button {
    width: auto;
    min-width: 0;
    min-height: 56px;
    font-size: 1.35rem;
    padding: 12px 24px;
  }

  .mode-detail-screen .detail-info-button {
    width: 54px;
    height: 54px;
    font-size: 1.45rem;
  }

  .mode-detail-screen .secondary-button {
    padding: 9px 12px;
    font-size: 0.82rem;
  }

  .triangle-board {
    --tri-visual-width: calc(var(--cell-size) * 2.45);
    --tri-visual-height: calc(var(--cell-size) * 1.475);
    --tri-step-x: calc(var(--cell-size) * 1.1368);
    --tri-step-y: calc(var(--tri-visual-height) * 1.04);
  }

  .status-pill {
    min-width: 84px;
    padding: 9px 10px;
  }

  .status-pill strong {
    font-size: 1.05rem;
  }

  .board-frame {
    padding: 12px;
  }

  .detail-play-button {
    min-height: 68px;
    font-size: 1.6rem;
  }

  .tutorial-modal-card {
    padding: 16px 12px;
  }

  .tutorial-modal-card .modal-header {
    gap: 8px;
  }

  .tutorial-modal-card .modal-header h2 {
    font-size: 1.2rem;
    line-height: 1.18;
  }

  .tutorial-modal-card .close-button {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.05rem;
  }

  .tutorial-stage {
    min-height: 116px;
    border-radius: 18px;
  }

  .tutorial-actions .primary-button,
  .tutorial-actions .secondary-button {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.92rem;
  }

  .tutorial-board-grid {
    grid-template-columns: repeat(3, 42px);
    gap: 6px;
  }

  .tutorial-demo-cell {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.12rem;
  }

  .tutorial-stage-note {
    font-size: 0.74rem;
  }
}

}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top center, rgba(255, 106, 93, 0.08), transparent 24%),
    radial-gradient(circle at bottom center, rgba(146, 87, 215, 0.08), transparent 28%),
    linear-gradient(180deg, #1d1f25 0%, #17191d 100%);
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top center, rgba(250, 204, 21, 0.08), transparent 22%),
    radial-gradient(circle at bottom center, rgba(255, 106, 93, 0.07), transparent 24%),
    #121214;
}

.splash-screen.fade-out {
  animation: splash-fade-out 520ms ease forwards;
}

.splash-content {
  text-align: center;
  animation: splash-rise-in 900ms ease both;
}

.splash-logo-shell {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
}

.splash-logo-square {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #33363d, #1f2025);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  animation: splash-pulse 2.2s ease-in-out infinite;
}

.splash-logo-symbol {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  position: relative;
  transform: rotate(45deg);
  background: #facc15;
}

.splash-logo-symbol::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #121214;
  transform: translate(-50%, -50%);
}

.splash-title {
  font-size: clamp(3.2rem, 12vw, 5.8rem);
  letter-spacing: -0.05em;
  background: linear-gradient(180deg, #ffffff 0%, #aeb4c2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.fa-solid {
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 8px 14px 14px;
  position: relative;
}

.screen {
  min-height: calc(100vh - 36px);
}

.eyebrow {
  margin: 0 0 8px;
  color: #ffd15c;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Black Han Sans", sans-serif;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.screen-header {
  text-align: center;
  margin-bottom: 16px;
}

.home-actions {
  position: static;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.screen-header h1 {
  font-size: clamp(2.6rem, 11vw, 4.8rem);
}

.screen-copy {
  margin: 10px auto 0;
  max-width: 520px;
  line-height: 1.5;
  font-size: 0.94rem;
  color: var(--muted);
}

.mode-select-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  max-height: min(68vh, 820px);
  overflow-y: auto;
  padding-right: 10px;
  overscroll-behavior: contain;
}

.mode-grid::-webkit-scrollbar {
  width: 10px;
}

.mode-grid::-webkit-scrollbar-track {
  background: rgba(127, 140, 167, 0.14);
  border-radius: 999px;
}

.mode-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(98, 221, 207, 0.82), rgba(92, 141, 255, 0.82));
  border-radius: 999px;
  border: 2px solid rgba(17, 19, 24, 0.65);
}

.mode-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(124, 236, 223, 0.96), rgba(115, 160, 255, 0.96));
}

.mode-card {
  min-height: 188px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.mode-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.03);
}

.mode-card-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(17, 19, 24, 0.72);
}

.mode-card strong {
  display: block;
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.mode-card p {
  margin: 0;
  line-height: 1.5;
  font-size: 0.9rem;
  color: #eff3ff;
}

.basic-card {
  background:
    linear-gradient(180deg, rgba(77, 167, 255, 0.18), rgba(77, 167, 255, 0.05)),
    #232630;
}

.noflag-card {
  background:
    linear-gradient(180deg, rgba(255, 181, 77, 0.18), rgba(255, 181, 77, 0.05)),
    #2a241f;
}

.health-card {
  background:
    linear-gradient(180deg, rgba(120, 197, 66, 0.2), rgba(120, 197, 66, 0.05)),
    #1f2920;
}

.plusminus-card {
  background:
    linear-gradient(180deg, rgba(173, 119, 255, 0.22), rgba(173, 119, 255, 0.05)),
    #241f2c;
}

.multimine-card {
  background:
    linear-gradient(180deg, rgba(255, 106, 93, 0.22), rgba(255, 106, 93, 0.05)),
    #2a2020;
}

.hex-card {
  background:
    linear-gradient(180deg, rgba(56, 224, 208, 0.2), rgba(56, 224, 208, 0.05)),
    #1e2928;
}

.dark-card {
  background:
    linear-gradient(180deg, rgba(97, 119, 255, 0.2), rgba(97, 119, 255, 0.05)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 42%),
    #1c2032;
}

.triangle-card {
  background:
    linear-gradient(180deg, rgba(255, 158, 95, 0.22), rgba(255, 158, 95, 0.05)),
    #2a211d;
}

.mode-detail-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.corner-button {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 18, 22, 0.84);
  color: var(--ink);
  font-size: 2rem;
  cursor: pointer;
}

.detail-hero {
  padding-top: 10px;
  text-align: center;
}

.detail-hero h2 {
  font-size: clamp(2.35rem, 10vw, 4.2rem);
}

.detail-tagline {
  margin: 10px auto 0;
  max-width: 560px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.detail-panel,
.board-frame,
.modal-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.detail-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 22px 20px;
  text-align: center;
}

.detail-mascot {
  width: 118px;
  height: 118px;
  margin: 0 auto 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.1rem;
  background: linear-gradient(180deg, rgba(255, 106, 93, 0.22), rgba(255, 106, 93, 0.08));
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.04);
}

.detail-mascot i {
  font-size: 3rem;
}

.difficulty-label {
  margin: 0;
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(1.95rem, 8vw, 3.4rem);
  color: var(--safe);
}

.difficulty-label.diff-easy {
  color: #78c542;
}

.difficulty-label.diff-normal {
  color: #ffb14a;
}

.difficulty-label.diff-hard {
  color: #ff5f70;
}

.difficulty-slider.diff-easy {
  accent-color: #78c542;
}

.difficulty-slider.diff-normal {
  accent-color: #ffb14a;
}

.difficulty-slider.diff-hard {
  accent-color: #ff5f70;
}

.difficulty-slider-wrap {
  margin-top: 14px;
}

.difficulty-slider {
  width: min(520px, 100%);
  accent-color: var(--accent);
}

.difficulty-scale {
  width: min(520px, 100%);
  margin: 8px auto 0;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-stat,
.status-pill,
.difficulty-item {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.detail-stat span,
.status-pill span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.detail-stat strong,
.status-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 1.06rem;
}

.health-hearts {
  display: flex !important;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}

.health-heart {
  color: #ff3347 !important;
  filter: drop-shadow(0 0 8px rgba(255, 51, 71, 0.34));
  transform-origin: center;
}

.health-heart.lost {
  color: rgba(255, 255, 255, 0.18) !important;
  filter: none;
}

.health-heart.hit {
  animation: heart-pop 420ms ease;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.detail-action-spacer {
  min-height: 1px;
}

.detail-actions .detail-play-button {
  justify-self: center;
}

.detail-actions .secondary-button {
  justify-self: start;
}

.detail-actions .detail-info-button {
  justify-self: end;
}

.detail-play-button,
.primary-button,
.secondary-button,
.detail-info-button,
.close-button {
  border: 0;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.detail-play-button,
.primary-button {
  border-radius: 20px;
  background: linear-gradient(180deg, #ff6b5e, #f6574b);
  color: white;
  font-size: 1.32rem;
  font-weight: 800;
  box-shadow: 0 18px 28px rgba(255, 96, 86, 0.2);
}

.topbar .primary-button {
  min-width: 64px;
  min-height: 56px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.detail-play-button {
  min-width: 240px;
  padding: 18px 28px;
}

.detail-info-button {
  width: 78px;
  height: 78px;
  border-radius: 20px;
  background: linear-gradient(180deg, #9964d8, #8652c9);
  color: white;
  font-size: 2.15rem;
  font-weight: 800;
  box-shadow: 0 16px 28px rgba(134, 82, 201, 0.24);
}

.detail-play-button:hover,
.primary-button:hover,
.secondary-button:hover,
.detail-info-button:hover,
.mode-card:hover,
.corner-button:hover,
.close-button:hover {
  transform: translateY(-2px);
}

.secondary-button,
.close-button {
  border-radius: 16px;
  padding: 10px 16px;
  background: rgba(14, 16, 21, 0.88);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
}

.secondary-button i {
  margin-right: 8px;
}

.icon-only-button {
  min-width: 48px;
  min-height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}

.icon-only-button i {
  margin-right: 0;
}

.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  font-size: 1.2rem;
}

.game-screen {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.topbar {
  display: flex;
  justify-content: center;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.board-frame {
  padding: 20px;
  overflow: auto;
  background: rgba(20, 22, 27, 0.96);
}

.board-help {
  margin: 0 0 12px;
  text-align: center;
  color: var(--muted);
}

.mobile-action-bar {
  display: none;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
}

.mobile-action-button {
  min-width: 90px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(34, 37, 45, 0.92);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
}

.mobile-action-button i {
  font-size: 1.15rem;
}

.mobile-action-button.active {
  background: linear-gradient(180deg, #ff6b5e, #f6574b);
  color: #fff;
  box-shadow: 0 10px 20px rgba(255, 96, 86, 0.18);
}

.tutorial-modal-card {
  max-width: 560px;
}

.tutorial-stage {
  min-height: 150px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(23, 25, 31, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tutorial-board-grid {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
  justify-content: center;
}

.tutorial-demo-cell {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.55rem;
  background: linear-gradient(180deg, #d5d5d7 0%, #bebec1 100%);
  color: #111319;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 10px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.tutorial-demo-cell:hover {
  filter: brightness(1.04);
}

.tutorial-demo-cell:disabled {
  cursor: default;
}

.tutorial-demo-cell.covered {
  background: linear-gradient(180deg, #d5d5d7 0%, #bebec1 100%);
  color: transparent;
}

.tutorial-demo-cell.revealed,
.tutorial-demo-cell.safe {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1.5px rgba(224, 229, 240, 0.18);
}

.tutorial-demo-cell.safe {
  color: transparent;
}

.tutorial-demo-cell.mine {
  background: linear-gradient(180deg, #df6070 0%, #bd394a 100%);
}

.tutorial-demo-cell.safe {
  background: linear-gradient(180deg, #79c62d 0%, #5aa31f 100%);
}

.tutorial-demo-cell.number {
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1.5px rgba(224, 229, 240, 0.18);
  color: #44cfff;
}

.tutorial-demo-cell.flag {
  background: rgba(153, 100, 216, 0.18);
  color: #fff;
}

.tutorial-demo-cell.target {
  background: linear-gradient(180deg, #ffcf63 0%, #f2a91c 100%);
  color: #fff7d1;
  text-shadow: 0 0 10px rgba(255, 247, 209, 0.45);
  box-shadow:
    inset 0 0 0 2px rgba(255, 245, 206, 0.72),
    0 0 0 4px rgba(255, 209, 92, 0.18),
    0 8px 18px rgba(242, 169, 28, 0.28);
  animation: tutorial-pop 1.25s ease-in-out infinite;
}

.tutorial-demo-cell.done {
  cursor: default;
}

.tutorial-stage-note {
  margin-top: 14px;
  text-align: center;
  color: #ffd15c;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.45;
}

.tutorial-stage-2 .tutorial-demo-cell.number,
.tutorial-stage-3 .tutorial-demo-cell.flag,
.pulse-safe,
.pulse-danger {
  animation: tutorial-pop 1.25s ease-in-out infinite;
}

.tutorial-actions {
  margin-top: 18px;
}

.tutorial-actions .primary-button,
.tutorial-actions .secondary-button {
  min-height: 44px;
  padding: 10px 18px;
  font-size: 1rem;
  border-radius: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(15, var(--cell-size));
  gap: 4px;
  justify-content: center;
  padding: 16px;
  border-radius: 28px;
  background: #17191f;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hex-board {
  --hex-visual-width: calc(var(--cell-size) * 1.18);
  --hex-visual-height: calc(var(--cell-size) * 1.03);
  --hex-step-x: calc(var(--hex-visual-width) * 0.76);
  --hex-step-y: calc(var(--hex-visual-height) * 0.7);
  --hex-offset-x: calc(var(--hex-step-x) * 0.5);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
  padding-top: 10px;
  gap: 0;
}

.hex-row {
  display: flex;
  justify-content: flex-start;
  gap: 0;
  margin-top: 0;
  height: var(--hex-step-y);
  width: fit-content;
}

.hex-row.offset {
  padding-left: var(--hex-offset-x);
}

.hex-cell-wrap {
  width: var(--hex-step-x);
  height: var(--hex-step-y);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--hex-step-x);
  position: relative;
  overflow: visible;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border: 0;
  border-radius: 11px;
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(180deg, #d5d5d7 0%, #bebec1 100%);
  color: #101216;
  cursor: pointer;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 10px rgba(0, 0, 0, 0.28);
}

.hex-cell {
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
  border-radius: 0;
  width: var(--hex-visual-width);
  height: var(--hex-visual-height);
  padding: 0;
  background: linear-gradient(180deg, #ede9d8 0%, #d9d4bf 100%);
  box-shadow:
    inset 0 0 0 1px rgba(120, 112, 86, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.triangle-board {
  --tri-visual-width: calc(var(--cell-size) * 2.72);
  --tri-visual-height: calc(var(--cell-size) * 1.86);
  --tri-step-x: calc(var(--cell-size) * 0.992);
  --tri-step-y: calc(var(--tri-visual-height) * 1.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  margin: 0 auto;
  padding-top: 10px;
  gap: 0;
}

.triangle-row {
  display: flex;
  justify-content: flex-start;
  gap: 0;
  margin-top: 0;
  height: var(--tri-step-y);
  width: fit-content;
}

.triangle-row:first-child {
  margin-top: 0;
}

.triangle-cell-wrap {
  width: var(--tri-step-x);
  height: var(--tri-step-y);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--tri-step-x);
  position: relative;
  overflow: visible;
}

.triangle-cell {
  width: var(--tri-visual-width);
  height: var(--tri-visual-height);
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ece7d8 0%, #d7cfb8 100%);
  box-shadow:
    inset 0 0 0 1px rgba(122, 105, 74, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  font-size: 0.95rem;
}

.triangle-cell.up {
  clip-path: polygon(50% 3%, 2% 97%, 98% 97%);
}

.triangle-cell.down {
  clip-path: polygon(2% 3%, 98% 3%, 50% 97%);
}

.darkness-board .cell.dark-hidden {
  background: rgba(255, 255, 255, 0.03);
  color: transparent;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 2px 8px rgba(0, 0, 0, 0.16);
  filter: none;
}

.darkness-board .cell.revealed.dark-memory {
  background: rgba(255, 255, 255, 0.045);
  color: transparent;
  box-shadow:
    inset 0 0 0 1.5px rgba(176, 191, 222, 0.18),
    0 0 0 1px rgba(10, 12, 16, 0.18);
  text-shadow: none;
}

.darkness-board .cell.revealed.dark-memory::after {
  content: "";
  width: 22%;
  height: 22%;
  border-radius: 999px;
  background: rgba(220, 229, 243, 0.28);
  display: block;
}

.cell i {
  font-size: 1.05rem;
}

.cell:hover {
  filter: brightness(1.06);
}

.cell.revealed {
  background: transparent;
  color: inherit;
  box-shadow: none;
  font-size: 1.65rem;
  font-weight: 800;
}

.cell.revealed.revealed-number {
  background: rgba(255, 255, 255, 0.03);
  box-shadow:
    inset 0 0 0 1.5px rgba(224, 229, 240, 0.18),
    0 0 0 1px rgba(10, 12, 16, 0.18);
}

.cell.flagged {
  background: linear-gradient(180deg, #79c62d 0%, #5aa31f 100%);
}

.cell.mine {
  background: linear-gradient(180deg, #df6070 0%, #bd394a 100%);
}

.cell.mine-hit {
  background: linear-gradient(180deg, #ffad5a 0%, #ff7f3c 100%);
}

.cell.mine-reveal {
  animation: mine-pop 360ms ease both;
}

.cell.zero {
  color: transparent;
}

.cell.balanced-zero {
  color: #c779ff;
  text-shadow: 0 0 10px rgba(199, 121, 255, 0.35);
}

.cell.revealed.n1 { color: #44cfff; text-shadow: 0 0 10px rgba(68, 207, 255, 0.35); }
.cell.revealed.n2 { color: #47df52; text-shadow: 0 0 10px rgba(71, 223, 82, 0.35); }
.cell.revealed.n3 { color: #ff5b73; text-shadow: 0 0 10px rgba(255, 91, 115, 0.3); }
.cell.revealed.n4 { color: #a977ff; text-shadow: 0 0 10px rgba(169, 119, 255, 0.32); }
.cell.revealed.n5 { color: #ff9f43; text-shadow: 0 0 10px rgba(255, 159, 67, 0.35); }
.cell.revealed.n6 { color: #29e1d9; text-shadow: 0 0 10px rgba(41, 225, 217, 0.32); }
.cell.revealed.n7 { color: #f6f7fb; text-shadow: 0 0 8px rgba(246, 247, 251, 0.22); }
.cell.revealed.n8 { color: #ffd84f; text-shadow: 0 0 10px rgba(255, 216, 79, 0.35); }
.cell.revealed.nneg { color: #ff90ff; text-shadow: 0 0 10px rgba(255, 144, 255, 0.35); }

.flag-mark,
.mine-stack {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.flag-mark b,
.mine-stack em {
  position: absolute;
  right: -8px;
  bottom: -6px;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  color: #fff;
}

.plus-flag b {
  background: #2ea84f;
}

.minus-flag b {
  background: #9b59d0;
}

.multi-flag b {
  background: #ff9f1c;
}

.flag-mark.plus-plain b {
  display: none;
}

.mine-stack em {
  background: #ff6a5d;
}

.modal,
.result-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 18, 23, 0.7);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.result-overlay.result-show {
  animation: result-fade-in 320ms ease both;
}

.modal-card,
.result-card {
  width: min(620px, 100%);
  padding: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rules-section + .rules-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.rules-section h3 {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 800;
}

.rules-copy,
.rules-list,
.difficulty-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.rules-list {
  padding-left: 20px;
}

.difficulty-list {
  display: grid;
  gap: 10px;
}

.difficulty-item strong {
  display: block;
  margin-bottom: 6px;
}

.achievement-item.unlocked {
  border-color: rgba(120, 197, 66, 0.35);
  box-shadow: inset 0 0 0 1px rgba(120, 197, 66, 0.15);
}

.achievement-badge-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.achievement-copy {
  min-width: 0;
  flex: 1;
}

.achievement-progress {
  display: inline-block;
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.achievement-badge {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 58px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge::before,
.achievement-badge::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 14px;
  height: 18px;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.achievement-badge::before {
  left: 50%;
  transform: translateX(-50%);
}

.achievement-badge::after {
  display: none;
}

.achievement-badge-core {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: #14161b;
  background: rgba(255, 255, 255, 0.75);
}

.achievement-badge-bronze {
  background: #87453d;
  box-shadow:
    inset 0 0 0 1px rgba(70, 32, 28, 0.18),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge-bronze::before,
.achievement-badge-bronze::after {
  background: #6b342e;
}

.achievement-badge-bronze .achievement-badge-core {
  width: 38px;
  height: 38px;
  font-size: 0;
  color: transparent;
  background: #87453d;
  box-shadow:
    inset 0 0 0 6px rgba(108, 52, 46, 0.95),
    inset 0 0 0 7px rgba(67, 28, 24, 0.15);
  position: relative;
}

.achievement-badge-bronze .achievement-badge-core::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #4e241f;
  transform: translate(-50%, -50%);
}

.achievement-badge-silver {
  background: #bcc4d2;
  box-shadow:
    inset 0 0 0 1px rgba(90, 101, 122, 0.16),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge-silver::before,
.achievement-badge-silver::after {
  background: #8f97a8;
}

.achievement-badge-silver .achievement-badge-core {
  width: 38px;
  height: 38px;
  font-size: 0;
  color: transparent;
  background: #bcc4d2;
  box-shadow:
    inset 0 0 0 6px rgba(144, 153, 169, 0.96),
    inset 0 0 0 7px rgba(73, 82, 99, 0.12);
  position: relative;
}

.achievement-badge-silver .achievement-badge-core::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #687184;
  transform: translate(-50%, -50%);
}

.achievement-badge-gold {
  background: #d6ad31;
  box-shadow:
    inset 0 0 0 1px rgba(101, 72, 9, 0.16),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

.achievement-badge-gold::before,
.achievement-badge-gold::after {
  background: #b38413;
}

.achievement-badge-gold .achievement-badge-core {
  width: 38px;
  height: 38px;
  font-size: 0;
  color: transparent;
  background: #d6ad31;
  box-shadow:
    inset 0 0 0 6px rgba(181, 132, 19, 0.96),
    inset 0 0 0 7px rgba(90, 62, 7, 0.12);
  position: relative;
}

.achievement-badge-gold .achievement-badge-core::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #77570e;
  transform: translate(-50%, -50%);
}

.achievement-item.locked .achievement-badge {
  filter: grayscale(0.9) brightness(0.68);
  opacity: 0.7;
}

.achievement-item.locked strong {
  color: #d4d8e3;
}

.achievement-item small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.result-card {
  text-align: center;
}

.result-overlay.result-show .result-card {
  animation: result-card-pop 460ms cubic-bezier(0.2, 0.9, 0.22, 1) both;
}

.result-label {
  margin: 0 0 8px;
  color: #ffd15c;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#resultTitle {
  font-size: clamp(2.35rem, 6vw, 3.8rem);
  margin-bottom: 14px;
  font-family: "Black Han Sans", sans-serif;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.achievement-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: min(320px, calc(100vw - 36px));
  padding: 16px 18px;
  border: 1px solid rgba(120, 197, 66, 0.28);
  border-radius: 18px;
  background: rgba(20, 24, 18, 0.96);
  box-shadow: var(--shadow);
  animation: toast-in 260ms ease;
}

.achievement-toast-label {
  margin: 0 0 6px;
  color: #ffd15c;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.achievement-toast strong {
  display: block;
  color: #ffffff;
  font-size: 1.1rem;
}

.achievement-toast span {
  display: block;
  margin-top: 4px;
  color: #cfd6e7;
  line-height: 1.5;
}

@keyframes mine-pop {
  0% {
    transform: scale(0.72);
    opacity: 0.15;
  }

  65% {
    transform: scale(1.08);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes splash-rise-in {
  0% {
    opacity: 0;
    transform: translateY(24px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes splash-fade-out {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes splash-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  }

  50% {
    transform: scale(1.045);
    box-shadow: 0 18px 42px rgba(250, 204, 21, 0.14);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  }
}

@keyframes toast-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes result-fade-in {
  0% {
    opacity: 0;
    backdrop-filter: blur(0px);
  }

  100% {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

@keyframes result-card-pop {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.88);
  }

  65% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
  }

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

@keyframes heart-pop {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.35) rotate(-8deg);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes tutorial-pop {
  0% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-4px) scale(1.06);
  }

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

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

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

  .detail-actions {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .detail-action-spacer {
    display: none;
  }
}

@media (max-width: 760px) {
  :root {
    --cell-size: 30px;
  }

  .app-shell {
    padding: 10px;
  }

  .screen {
    padding: 18px 16px 20px;
  }

  .screen-header h1,
  .splash-title {
    font-size: clamp(2.1rem, 12vw, 3.2rem);
  }

  .screen-copy,
  .detail-tagline,
  .rules-copy,
  .mode-card p {
    font-size: 0.94rem;
    line-height: 1.5;
  }

  .eyebrow {
    font-size: 0.72rem;
  }

  .mode-grid {
    gap: 12px;
    max-height: min(66vh, 720px);
    padding-right: 6px;
  }

  .mode-card {
    min-height: 168px;
    padding: 14px;
    border-radius: 22px;
  }

  .mode-card strong {
    font-size: 1.28rem;
    margin-bottom: 8px;
  }

  .mode-card-badge {
    margin-bottom: 10px;
    padding: 5px 9px;
    font-size: 0.68rem;
  }

  .corner-button,
  .secondary-button,
  .close-button,
  .primary-button,
  .icon-only-button {
    transform: scale(0.92);
    transform-origin: center;
  }

  .topbar-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  .status-pill {
    min-width: 92px;
    padding: 10px 12px;
    border-radius: 16px;
  }

  .status-pill span {
    font-size: 0.68rem;
  }

  .status-pill strong {
    font-size: 1.2rem;
  }

  .board-frame,
  .modal-card,
  .result-card {
    border-radius: 22px;
  }

  .board-frame {
    padding: 14px;
  }

  .board-help {
    margin-bottom: 10px;
    font-size: 0.84rem;
  }

  .mobile-action-bar {
    display: flex;
  }

  .triangle-board {
    --tri-visual-width: calc(var(--cell-size) * 2.65);
    --tri-visual-height: calc(var(--cell-size) * 1.675);
    --tri-step-x: calc(var(--cell-size) * 1.4004);
    --tri-step-y: calc(var(--tri-visual-height) * 1.08);
  }

  .detail-play-button {
    width: 100%;
    min-width: 0;
    min-height: 76px;
    font-size: 1.8rem;
  }

  .detail-info-button {
    width: 68px;
    height: 68px;
    font-size: 1.9rem;
  }

  .detail-panel {
    padding: 18px 16px;
  }

  .detail-mascot {
    width: 108px;
    height: 108px;
    font-size: 3.4rem;
  }

  .detail-difficulty-label,
  .difficulty-label {
    font-size: 3rem;
  }

  .mode-detail-screen {
    gap: 10px;
    justify-content: flex-start;
  }

  .mode-detail-screen .detail-hero {
    padding-top: 0;
    margin-top: -8px;
  }

  .mode-detail-screen .detail-hero h2 {
    font-size: clamp(1.95rem, 8vw, 2.6rem);
  }

  .mode-detail-screen .detail-tagline {
    margin-top: 6px;
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .mode-detail-screen .detail-panel {
    padding: 14px 14px;
  }

  .mode-detail-screen .detail-mascot {
    width: 88px;
    height: 88px;
    margin-bottom: 8px;
    font-size: 2.6rem;
  }

  .mode-detail-screen .detail-mascot i {
    font-size: 2.45rem;
  }

  .mode-detail-screen .difficulty-label {
    font-size: 2.35rem;
  }

  .mode-detail-screen .difficulty-slider-wrap {
    margin-top: 10px;
  }

  .mode-detail-screen .difficulty-scale {
    margin-top: 6px;
    font-size: 0.74rem;
  }

  .mode-detail-screen .detail-stats {
    margin-top: 12px;
    gap: 8px;
  }

  .mode-detail-screen .detail-stat {
    padding: 10px 8px;
  }

  .mode-detail-screen .detail-stat span {
    font-size: 0.68rem;
  }

  .mode-detail-screen .detail-stat strong {
    font-size: 0.96rem;
  }

  .mode-detail-screen .detail-actions {
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 8px;
  }

  .mode-detail-screen .secondary-button {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .mode-detail-screen .detail-play-button {
    width: auto;
    min-width: 0;
    min-height: 62px;
    font-size: 1.5rem;
    padding: 14px 30px;
  }

  .mode-detail-screen .detail-info-button {
    width: 58px;
    height: 58px;
    font-size: 1.55rem;
  }

  .result-card {
    width: min(92vw, 360px);
    padding: 26px 18px;
  }

  .modal-card {
    padding: 22px 16px;
  }

  .tutorial-modal-card {
    padding: 18px 14px;
  }

  .tutorial-modal-card .modal-header {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
  }

  .tutorial-modal-card .modal-header h2 {
    flex: 1;
    min-width: 0;
    font-size: 1.45rem;
    line-height: 1.2;
    word-break: keep-all;
  }

  .tutorial-modal-card .close-button {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.2rem;
  }

  .tutorial-stage {
    min-height: 130px;
  }

  .tutorial-actions {
    margin-top: 14px;
  }

  .tutorial-board-grid {
    grid-template-columns: repeat(3, 48px);
    gap: 7px;
  }

  .tutorial-demo-cell {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 1.32rem;
  }

  .tutorial-stage-note {
    margin-top: 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  :root {
    --cell-size: 27px;
  }

  .screen {
    padding: 16px 12px 18px;
  }

  .mode-card {
    min-height: 152px;
    padding: 12px;
  }

  .mode-card strong {
    font-size: 1.12rem;
  }

  .detail-hero h2 {
    font-size: clamp(2.2rem, 10vw, 3rem);
  }

  .mode-detail-screen {
    gap: 8px;
  }

  .mode-detail-screen .detail-hero h2 {
    font-size: clamp(1.8rem, 8.4vw, 2.3rem);
  }

  .mode-detail-screen .detail-tagline {
    font-size: 0.82rem;
  }

  .mode-detail-screen .detail-hero {
    margin-top: -12px;
  }

  .mode-detail-screen .detail-panel {
    padding: 12px 12px;
  }

  .mode-detail-screen .detail-mascot {
    width: 78px;
    height: 78px;
    font-size: 2.25rem;
  }

  .mode-detail-screen .detail-mascot i {
    font-size: 2.1rem;
  }

  .mode-detail-screen .difficulty-label {
    font-size: 2.05rem;
  }

  .mode-detail-screen .detail-stats {
    margin-top: 10px;
    gap: 7px;
  }

  .mode-detail-screen .detail-stat {
    padding: 9px 8px;
  }

  .mode-detail-screen .detail-play-button {
    width: auto;
    min-width: 0;
    min-height: 56px;
    font-size: 1.35rem;
    padding: 12px 24px;
  }

  .mode-detail-screen .detail-info-button {
    width: 54px;
    height: 54px;
    font-size: 1.45rem;
  }

  .mode-detail-screen .secondary-button {
    padding: 9px 12px;
    font-size: 0.82rem;
  }

  .triangle-board {
    --tri-visual-width: calc(var(--cell-size) * 2.45);
    --tri-visual-height: calc(var(--cell-size) * 1.475);
    --tri-step-x: calc(var(--cell-size) * 1.1368);
    --tri-step-y: calc(var(--tri-visual-height) * 1.04);
  }

  .status-pill {
    min-width: 84px;
    padding: 9px 10px;
  }

  .status-pill strong {
    font-size: 1.05rem;
  }

  .board-frame {
    padding: 12px;
  }

  .detail-play-button {
    min-height: 68px;
    font-size: 1.6rem;
  }

  .tutorial-modal-card {
    padding: 16px 12px;
  }

  .tutorial-modal-card .modal-header {
    gap: 8px;
  }

  .tutorial-modal-card .modal-header h2 {
    font-size: 1.2rem;
    line-height: 1.18;
  }

  .tutorial-modal-card .close-button {
    min-width: 40px;
    min-height: 40px;
    font-size: 1.05rem;
  }

  .tutorial-stage {
    min-height: 116px;
    border-radius: 18px;
  }

  .tutorial-actions .primary-button,
  .tutorial-actions .secondary-button {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.92rem;
  }

  .tutorial-board-grid {
    grid-template-columns: repeat(3, 42px);
    gap: 6px;
  }

  .tutorial-demo-cell {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    font-size: 1.12rem;
  }

  .tutorial-stage-note {
    font-size: 0.74rem;
  }
}
