*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Comic Neue", "Nunito", "Segoe UI", Roboto, sans-serif;
  --bg-menu: #009eb8;
  --bg-turn-6: #f29679;
  --bg-turn-7: #5c9cb8;
  --bg-draw: #7c8a99;
  
  --c-red: #ef4e45;
  --c-red-dark: #c9362e;
  --c-blue: #1da6ea;
  --c-blue-dark: #0d7ab1;
  --c-dark: #2d2833;
  --c-grid: #181619;
  --c-white: #ffffff;
  
  --c-easy: #2ec958;
  --c-med: #ff9800;
  --c-hard: #e91e63;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: #0096c7;
  color: var(--c-white);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.5s ease;
}

/* Dynamic background based on active screen and turn */
#app[data-screen="menu"] {
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.25) 0%, transparent 55%),
              linear-gradient(180deg, #00b4d8 0%, #0096c7 45%, #0077b6 100%);
}

#app[data-screen="game"][data-turn="6"] {
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
              linear-gradient(180deg, #ff7a63 0%, #f26a52 60%, #e0533c 100%);
}

#app[data-screen="game"][data-turn="7"] {
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
              linear-gradient(180deg, #4ea8de 0%, #3083dc 60%, #1e6091 100%);
}

#app[data-screen="game"][data-turn="draw"] {
  background: linear-gradient(180deg, #636e72 0%, #2d3436 100%);
}

/* Background Watermark Motifs (Clean, crisp, studio-grade) */
.menu-pattern-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.watermark-item {
  position: absolute;
  font-size: 88px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.085);
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  padding: calc(var(--sat, 0px) + 12px) 20px calc(var(--sab, 0px) + 16px);
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* ===================================================
   MENU SCREEN
   ================================================== */
#screen-menu {
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.menu-top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  position: relative;
  z-index: 2;
}

.icon-btn-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  color: #555;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.icon-btn-circle:active {
  transform: scale(0.92);
}

.menu-header {
  margin-top: 12px;
  position: relative;
  z-index: 2;
}

.game-title {
  font-size: clamp(40px, 11vw, 50px);
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 4px 0 rgba(0, 75, 110, 0.5), 0 10px 24px rgba(0, 0, 0, 0.18);
  margin-bottom: 8px;
}

.game-subtitle {
  font-size: clamp(14px, 3.8vw, 16px);
  font-weight: 800;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  max-width: 320px;
  margin: 0 auto;
}

/* Meme Hands Stage (The iconic 6-7 hand balance / pump gesture) */
.meme-hands-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 6px auto 2px;
  position: relative;
  z-index: 2;
  height: 128px;
}

.meme-hand-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.hand-img {
  width: 104px;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
  transition: transform 0.15s ease, filter 0.15s ease;
  pointer-events: none;
}

.hand-left {
  animation: memeHandsPumpLeft 0.55s cubic-bezier(0.25, 1, 0.5, 1) infinite alternate;
}

.hand-right {
  animation: memeHandsPumpRight 0.55s cubic-bezier(0.25, 1, 0.5, 1) infinite alternate;
}

@keyframes memeHandsPumpLeft {
  0% {
    transform: translateY(28px) scale(0.92);
  }
  15% {
    transform: translateY(26px) scale(0.94);
  }
  85% {
    transform: translateY(-28px) scale(1.08);
  }
  100% {
    transform: translateY(-30px) scale(1.1);
  }
}

@keyframes memeHandsPumpRight {
  0% {
    transform: translateY(-30px) scale(1.1);
  }
  15% {
    transform: translateY(-28px) scale(1.08);
  }
  85% {
    transform: translateY(26px) scale(0.94);
  }
  100% {
    transform: translateY(28px) scale(0.92);
  }
}

.meme-hands-divider {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 40, 60, 0.3);
  padding: 5px 12px;
  border-radius: 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  animation: vsPulse 0.55s cubic-bezier(0.25, 1, 0.5, 1) infinite alternate;
}

@keyframes vsPulse {
  0% { transform: scale(0.88); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

.meme-hand-wrapper:active {
  transform: scale(1.22) !important;
  filter: brightness(1.15);
}

/* Difficulty Card */
.difficulty-card-container {
  width: 100%;
  max-width: 340px;
  position: relative;
  margin: 12px auto;
}

.difficulty-card {
  background: #ffffff;
  border-radius: 30px;
  padding: 32px 20px 22px;
  box-shadow: 0 16px 40px rgba(0, 45, 75, 0.22), 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.difficulty-avatar {
  position: absolute;
  top: -36px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #111;
  border: 4.5px solid var(--c-white);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.difficulty-avatar svg {
  width: 52px;
  height: 52px;
}

.difficulty-label {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 1.2px;
  margin-top: 10px;
  margin-bottom: 16px;
  transition: color 0.3s ease;
}

.difficulty-label[data-diff="easy"] { color: var(--c-easy); }
.difficulty-label[data-diff="medium"] { color: var(--c-med); }
.difficulty-label[data-diff="hard"] { color: var(--c-hard); }

/* Difficulty Slider Pill */
.diff-slider-wrap {
  width: 100%;
  max-width: 250px;
  height: 46px;
  background: #475266;
  border-radius: 23px;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  padding: 4px;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.diff-slider-wrap.is-dragging {
  cursor: grabbing;
}

.diff-slider-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--c-easy);
  border: 3.5px solid var(--c-white);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.25s ease;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}

.diff-slider-wrap.is-dragging .diff-slider-thumb {
  transition: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45), 0 0 14px rgba(255, 255, 255, 0.5);
}

.diff-slider-wrap[data-pos="0"] .diff-slider-thumb {
  background: var(--c-easy);
}

.diff-slider-wrap[data-pos="1"] .diff-slider-thumb {
  background: var(--c-med);
}

.diff-slider-wrap[data-pos="2"] .diff-slider-thumb {
  background: var(--c-hard);
}

.difficulty-avatar.avatar-pop {
  animation: avatarPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes avatarPop {
  0% { transform: scale(0.8) rotate(-10deg); }
  60% { transform: scale(1.18) rotate(4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.diff-step-labels {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
  font-size: 11px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
}

.btn-help-rules {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #9b51e0;
  border: none;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(155, 81, 224, 0.4);
  transition: transform 0.15s ease;
}

.btn-help-rules:active {
  transform: scale(0.9);
}

/* Menu Action Buttons */
.menu-buttons {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 8px;
  position: relative;
  z-index: 2;
}

.btn-cta {
  width: 100%;
  height: 64px;
  border-radius: 22px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--c-white);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  position: relative;
  overflow: hidden;
}

.btn-cta::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 22px 22px 0 0;
  pointer-events: none;
}

.btn-cta-bot {
  background: #2ecc71;
  box-shadow: 0 6px 0 #219653, 0 14px 28px rgba(46, 204, 113, 0.35);
}

.btn-cta-bot:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #219653, 0 6px 14px rgba(46, 204, 113, 0.3);
}

.btn-cta-friend {
  background: #0984e3;
  box-shadow: 0 6px 0 #0767b0, 0 14px 28px rgba(9, 132, 227, 0.35);
}

.btn-cta-friend:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #0767b0, 0 6px 14px rgba(9, 132, 227, 0.3);
}

.btn-cta svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* ===================================================
   GAME SCREEN
   =================================================== */
#screen-game {
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0;
}

.game-top-bar {
  width: 100%;
  max-width: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 4px;
}

/* Scoreboard Pill */
.scoreboard-pill {
  flex: 1;
  max-width: 250px;
  margin: 0 auto;
  height: 48px;
  background: rgba(45, 40, 50, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

.score-player {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-player-name {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.score-player-num {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.score-player-6 {
  color: #ff6b6b;
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.4);
}

.score-player-7 {
  color: #48dbfb;
  text-shadow: 0 0 10px rgba(72, 219, 251, 0.4);
}

.score-vs-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--c-white);
}

.score-diff-tag {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.score-vs-text {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

/* Bot Thinking Banner */
.bot-thinking-banner {
  margin-top: 10px;
  background: rgba(35, 60, 75, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--c-white);
  padding: 8px 24px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bot-thinking-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.thinking-dots::after {
  content: '...';
  display: inline-block;
  animation: dotsPulse 1.2s infinite steps(4, start);
  width: 18px;
  text-align: left;
}

@keyframes dotsPulse {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Board Container */
.board-wrapper {
  position: relative;
  width: min(84vw, 360px);
  height: min(84vw, 360px);
  margin: auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 34px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25), inset 0 2px 6px rgba(255, 255, 255, 0.5);
  padding: 12px;
}

/* Tic Tac Toe Grid Lines */
.grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.grid-line {
  position: absolute;
  background: var(--c-grid);
  border-radius: 6px;
}

.grid-line.vertical {
  width: 9px;
  top: -4px;
  bottom: -4px;
}

.grid-line.vertical.v1 { left: calc(33.333% - 4.5px); }
.grid-line.vertical.v2 { left: calc(66.666% - 4.5px); }

.grid-line.horizontal {
  height: 9px;
  left: -4px;
  right: -4px;
}

.grid-line.horizontal.h1 { top: calc(33.333% - 4.5px); }
.grid-line.horizontal.h2 { top: calc(66.666% - 4.5px); }

/* Board Cells */
.board-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  z-index: 2;
}

.cell {
  position: relative;
  background: transparent;
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.cell:focus, .cell:focus-visible, .cell:active {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

/* Tokens 6 and 7 */
.token {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tokenPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.token svg {
  width: 82%;
  height: 82%;
  overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

@keyframes tokenPop {
  0% {
    transform: scale(0.2) rotate(-15deg);
    opacity: 0;
  }
  70% {
    transform: scale(1.18) rotate(4deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Winning Strike Line SVG Overlay */
.win-line-overlay {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  pointer-events: none;
  z-index: 5;
}

.win-strike {
  stroke: var(--c-white);
  stroke-width: 10px;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: drawStrike 0.38s ease forwards;
}

@keyframes drawStrike {
  to {
    stroke-dashoffset: 0;
  }
}

/* Meme Win Zoom Banner */
.meme-win-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.meme-win-banner.is-active {
  transform: translate(-50%, -50%) scale(1.15);
  opacity: 1;
}

.meme-six {
  font-size: 54px;
  font-weight: 900;
  color: #ff4757;
  text-shadow: 0 4px 0 #1e1e24, 0 0 25px rgba(255, 71, 87, 0.8);
  line-height: 0.95;
  letter-spacing: 3px;
  animation: memePulse1 0.45s infinite alternate ease-in-out;
}

.meme-seven {
  font-size: 68px;
  font-weight: 900;
  color: #2ed573;
  text-shadow: 0 4px 0 #1e1e24, 0 0 30px rgba(46, 213, 115, 0.85);
  line-height: 0.95;
  letter-spacing: 4px;
  animation: memePulse2 0.45s infinite alternate ease-in-out 0.15s;
}

@keyframes memePulse1 {
  0% { transform: scale(1) rotate(-4deg); }
  100% { transform: scale(1.12) rotate(3deg); }
}

@keyframes memePulse2 {
  0% { transform: scale(1) rotate(3deg); }
  100% { transform: scale(1.15) rotate(-4deg); }
}

/* Bottom "Your Turn" Semicircle Prompt */
.your-turn-arch {
  width: 100%;
  max-width: 420px;
  height: 70px;
  background: transparent;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(var(--sab, 0px) + 8px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.25, 0.64, 1);
  pointer-events: none;
}

.your-turn-arch.is-visible {
  transform: translateY(0);
}

.arch-shape {
  position: absolute;
  bottom: -40px;
  width: 260px;
  height: 120px;
  border-radius: 130px 130px 0 0;
  border: 4px solid rgba(255, 255, 255, 0.95);
  border-bottom: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.your-turn-text {
  position: relative;
  z-index: 1;
  font-size: clamp(22px, 5.5vw, 26px);
  font-weight: 900;
  color: var(--c-white);
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  margin-bottom: 6px;
}

/* ===================================================
   RESULT / VICTORY OVERLAY
   =================================================== */
.result-overlay {
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 22, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--sat, 0px) + 16px) 24px calc(var(--sab, 0px) + 24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.result-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.result-top-stars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 180px;
  pointer-events: none;
  overflow: hidden;
}

.star-particle {
  position: absolute;
  color: #ffd154;
  font-size: 24px;
  animation: starFloat 2s ease-in-out infinite alternate;
}

@keyframes starFloat {
  0% { transform: translateY(0) rotate(0deg) scale(0.9); }
  100% { transform: translateY(-12px) rotate(20deg) scale(1.15); }
}

.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 50px;
}

/* Medal Graphic */
.medal-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 20px;
  animation: medalBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes medalBounce {
  0% { transform: scale(0.3) rotate(-20deg); opacity: 0; }
  70% { transform: scale(1.15) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.medal-ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 68px;
  height: 48px;
}

.medal-circle {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd700 0%, #ffae00 100%);
  border: 5px solid #fff;
  box-shadow: 0 8px 20px rgba(255, 174, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.medal-score {
  font-size: 40px;
  font-weight: 900;
  color: #8b4500;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.result-title {
  font-size: clamp(32px, 8vw, 42px);
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--c-white);
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  margin-bottom: 6px;
}

.result-subtitle {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

/* Result Buttons */
.result-actions {
  width: 100%;
  max-width: 340px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.btn-home {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--c-red);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(239, 78, 69, 0.4);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.btn-home:active {
  transform: scale(0.92);
}

.btn-home svg {
  width: 28px;
  height: 28px;
}

.btn-play-again {
  flex: 1;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(180deg, #32d74b 0%, #24a138 100%);
  border: none;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--c-white);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(36, 161, 56, 0.4);
  transition: transform 0.15s ease;
}

.btn-play-again:active {
  transform: scale(0.96);
}

/* ===================================================
   RULES MODAL
   =================================================== */
.rules-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.rules-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.rules-card {
  width: 100%;
  max-width: 330px;
  background: #ffffff;
  border-radius: 24px;
  padding: 24px 20px;
  color: var(--c-dark);
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  transform: scale(0.9);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rules-modal.is-open .rules-card {
  transform: scale(1);
}

.rules-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
  color: #1a1a1d;
}

.rules-body {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: #4a4550;
  margin-bottom: 20px;
}

.rules-token-preview {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 16px 0;
}

.preview-token {
  width: 52px;
  height: 52px;
}

.btn-close-rules {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  background: #9b51e0;
  border: none;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
}

/* Tablet adjustments */
@media (min-width: 600px) {
  #app {
    max-width: 460px;
    border-radius: 36px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    margin: auto;
    height: 94vh;
  }
}
