/* ==========================================================================
   RINGLOO - CASUAL ARCADE RING MATCH GAME
   Modern high-fidelity casual mobile game styling & animations
   ========================================================================== */

:root {
  --bg-gradient: linear-gradient(180deg, #7ee2ff 0%, #4fc8f7 100%);
  --wood-surface: #fbe5bf;
  --wood-edge: #7a4623;
  --wood-bevel: #5c3114;
  --grid-line-color: #4a220a;
  --pedestal-color: #ffa170;
  --pedestal-shadow: #d85c1e;
  --pedestal-rim: rgba(255, 255, 255, 0.85);
  --btn-orange: #ff9326;
  --btn-orange-shadow: #c85700;
  --font-display: 'Fredoka', 'Nunito', -apple-system, sans-serif;
  --font-body: 'Nunito', 'Fredoka', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-gradient);
  background-color: #7ee2ff;
  font-family: var(--font-body);
}

/* Fullscreen API Backdrop Override: Prevents black letterbox backdrop on mobile Fullscreen API */
::backdrop,
:fullscreen::backdrop,
:-webkit-full-screen::backdrop {
  background: var(--bg-gradient) !important;
  background-color: #7ee2ff !important;
}

:fullscreen,
:root:fullscreen,
body:fullscreen,
html:fullscreen,
:-webkit-full-screen,
:root:-webkit-full-screen,
body:-webkit-full-screen,
html:-webkit-full-screen {
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: var(--bg-gradient) !important;
}

/* Outer Desktop Frame / Centered Mobile Viewport */
.game-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: var(--bg-gradient);
  background-color: #7ee2ff;
  overflow: hidden;
}

/* BY DEFAULT (Mobile phones, Tablets, iPads in Portrait):
   Fills the ENTIRE screen 100% width and 100% height with centered max-width on large tablets */
.game-container {
  position: relative;
  width: 100%;
  max-width: min(100%, 720px);
  height: 100%;
  min-height: 100%;
  background: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  border-radius: 0;
  border: none;
  box-shadow: none;
  padding-top: max(8px, env(safe-area-inset-top, 8px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

/* ONLY ON PC / LAPTOP WEB (Landscape & Wide Desktop Screens):
   Centered portrait game canvas fixed in the center with sharp borderless edges */
@media (min-width: 900px) and (orientation: landscape), (min-aspect-ratio: 1/1) and (min-width: 800px) {
  .game-wrapper {
    background: #000000;
    align-items: center;
  }
  .game-container {
    width: 100%;
    max-width: min(540px, calc(100vh * 0.65));
    height: 100%;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
  }
}

/* ==========================================================================
   TOP HUD HEADER
   ========================================================================== */
.hud-header {
  width: 100%;
  padding: clamp(6px, 1vh, 12px) clamp(14px, 3vw, 28px) clamp(4px, 1vh, 10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  position: relative;
  max-width: min(94vw, 700px);
}

/* Coin Pill Capsule (Liquid Glass Style with Overlapping Bigger Coin) */
.coin-pill {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(15, 35, 55, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 2px clamp(12px, 2vw, 20px) 2px 6px;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.55),
    inset 0 -1px 2px rgba(0, 0, 0, 0.15);
  gap: clamp(6px, 1vw, 10px);
  height: clamp(32px, 4.2vh, 46px);
  cursor: pointer;
  overflow: visible;
  transition: transform 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.12s;
}

.coin-pill:hover {
  transform: scale(1.05);
  background: rgba(15, 35, 55, 0.35);
  border-color: rgba(255, 255, 255, 0.65);
}

.coin-pill:active {
  transform: scale(0.96);
}

.coin-icon {
  position: relative;
  width: clamp(42px, 5.5vh, 58px);
  height: clamp(42px, 5.5vh, 58px);
  margin-left: clamp(-16px, -2vw, -20px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.img-gold-coin,
.svg-coin {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.38));
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.coin-pill:hover .img-gold-coin {
  transform: rotate(-6deg) scale(1.1);
}

.coin-text {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(16px, min(3.5vw, 2.3vh), 22px);
  font-weight: 800;
  color: #ffffff;
  -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.2);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
  letter-spacing: 0.5px;
  line-height: 1;
}

/* Score Section (Top Center) */
.score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: clamp(6px, 1vh, 12px);
}

.main-score {
  font-family: var(--font-display);
  font-size: clamp(38px, min(8vw, 6.8vh), 64px);
  font-weight: 800;
  color: #ff2e78;
  -webkit-text-stroke: clamp(2.5px, 0.4vh, 4px) #ffffff;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  line-height: 1;
  letter-spacing: 0.5px;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.score-bump {
  animation: scoreBounce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scoreBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.3) rotate(-3deg); color: #ff0055; }
  100% { transform: scale(1); }
}

.high-score-wrap {
  display: flex;
  align-items: center;
  gap: clamp(3px, 0.5vw, 6px);
  margin-top: 1px;
}

.crown-icon {
  width: clamp(16px, 2.2vh, 22px);
  height: clamp(16px, 2.2vh, 22px);
}

.high-score-text {
  font-family: var(--font-display);
  font-size: clamp(14px, 2vh, 20px);
  font-weight: 800;
  color: #000000;
}

/* Actions Group (Top Right) */
.hud-actions {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 12px);
}

.quest-btn {
  position: relative;
  background: #ffffff;
  border: 2px solid #263238;
  border-radius: 50%;
  width: clamp(36px, 5vh, 50px);
  height: clamp(36px, 5vh, 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 0 #1e293b, 0 4px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

.quest-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1e293b;
}

.svg-quest {
  width: clamp(22px, 3vh, 30px);
  height: clamp(22px, 3vh, 30px);
}

.quest-badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 11px;
  height: 11px;
  background: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: none;
}

.quest-badge-dot.active {
  display: block;
  animation: badgePulse 1.2s infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* Settings Button (Top Right) */
.settings-btn {
  background: #ffffff;
  border: 2px solid #263238;
  border-radius: 50%;
  width: clamp(36px, 5vh, 50px);
  height: clamp(36px, 5vh, 50px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 0 #1e293b, 0 4px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

.settings-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #1e293b;
}

.svg-gear {
  width: clamp(22px, 3vh, 30px);
  height: clamp(22px, 3vh, 30px);
}

/* ==========================================================================
   HAMMER POWER-UP BANNER
   ========================================================================== */
.hammer-banner {
  position: absolute;
  top: clamp(90px, 12vh, 126px);
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  z-index: 30;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s;
  opacity: 0;
  pointer-events: none;
}

.hammer-banner.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.hammer-banner-pill {
  position: relative;
  background: #ffffff;
  border: 3px solid #2d3748;
  border-radius: 20px;
  padding: 6px 18px 6px 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25), 0 3px 0 #1a202c;
  display: flex;
  align-items: center;
  min-width: 210px;
  max-width: min(88vw, 290px);
}

.hammer-badge-tag {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: #ff9800;
  border: 2px solid #2d3748;
  border-radius: 10px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  padding: 1px 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 0 #c77700;
}

.hammer-close-btn {
  position: absolute;
  top: -8px;
  right: -6px;
  background: #ef4444;
  border: 2px solid #b91c1c;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4), 0 2px 0 #991b1b;
  transition: transform 0.1s, background-color 0.15s;
}

.hammer-close-btn:hover {
  background: #dc2626;
  border-color: #991b1b;
}

.hammer-close-btn:active {
  transform: translateY(1px) scale(0.92);
  box-shadow: 0 0 0 #991b1b;
}

.hammer-banner-body {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.banner-hammer-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hammerWiggle 1.2s infinite ease-in-out;
}

@keyframes hammerWiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(12deg) scale(1.1); }
}

.img-hammer-banner,
.svg-hammer-banner {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.2));
}

.hammer-banner-text {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  color: #ff3333;
  line-height: 1.15;
  text-align: left;
}

/* ==========================================================================
   MAIN 3X3 GAME BOARD AREA
   ========================================================================== */
.board-area {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 0 clamp(10px, 2.5vw, 24px);
  margin: auto 0;
}

.board-frame {
  position: relative;
  width: min(86vw, min(48vh, 460px));
  height: min(86vw, min(48vh, 460px));
  background: #6e3d1b;
  border-radius: clamp(22px, 3.5vw, 36px);
  padding-bottom: clamp(8px, 1.2vh, 14px);
  box-shadow: 
    0 16px 28px rgba(0, 50, 100, 0.28),
    0 clamp(6px, 1vh, 10px) 0 #43220c;
  border: none;
  box-sizing: border-box;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.board-bevel {
  width: 100%;
  height: 100%;
  background: #fce7c8;
  border-radius: clamp(20px, 3.2vw, 34px);
  overflow: hidden;
  border: clamp(2.5px, 0.4vh, 4px) solid #5a2e12;
  box-shadow: 
    inset 0 2px 4px rgba(255, 255, 255, 0.8),
    inset 0 -2px 4px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.board-surface {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  background-color: var(--wood-surface);
  gap: 0;
  padding: 0;
}

/* 4 Carved Tic-Tac-Toe # Grid Lines with Rounded Caps Inset from Outer Border */
.grid-line {
  position: absolute;
  background-color: #5a2e12;
  border-radius: 3px;
  pointer-events: none;
  z-index: 1;
}

/* 2 Vertical Lines (Inset from Top & Bottom) */
.grid-line-v1 {
  width: clamp(2.5px, 0.4vh, 4.5px);
  top: 10px;
  bottom: 10px;
  left: calc(33.333% - 1.75px);
}

.grid-line-v2 {
  width: clamp(2.5px, 0.4vh, 4.5px);
  top: 10px;
  bottom: 10px;
  left: calc(66.666% - 1.75px);
}

/* 2 Horizontal Lines (Inset from Left & Right) */
.grid-line-h1 {
  height: clamp(2.5px, 0.4vh, 4.5px);
  left: 10px;
  right: 10px;
  top: calc(33.333% - 1.75px);
}

.grid-line-h2 {
  height: clamp(2.5px, 0.4vh, 4.5px);
  left: 10px;
  right: 10px;
  top: calc(66.666% - 1.75px);
}

.grid-cell {
  position: relative;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background-color 0.15s, box-shadow 0.15s;
}

/* Subtle wooden radial gradient */
.grid-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 45% 45%, rgba(255, 255, 255, 0.4) 0%, rgba(0, 0, 0, 0.03) 100%);
  pointer-events: none;
}

/* Faint white default socket placeholder */
.cell-socket-placeholder {
  position: absolute;
  width: 52%;
  height: 52%;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Placement White Ring Guide Line (Images 2, 3, 4) */
.placement-guide-ring {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Placement highlight hover */
.grid-cell.highlight-valid {
  background: #bbf7d0;
  box-shadow: inset 0 0 14px rgba(34, 197, 94, 0.6);
}

.grid-cell.highlight-invalid {
  background: #fecaca;
  box-shadow: inset 0 0 14px rgba(239, 68, 68, 0.6);
}

/* Hammer Target Highlight Mode (Only highlights cells containing rings) */
.hammer-mode .grid-cell {
  cursor: default;
}

.hammer-mode .grid-cell.has-rings {
  cursor: pointer;
}

.hammer-mode .grid-cell.has-rings:hover,
.hammer-mode .grid-cell.has-rings.hammer-targeted {
  background: #fed7aa;
  box-shadow: inset 0 0 20px rgba(249, 115, 22, 0.9);
  animation: hammerTargetPulse 0.6s infinite alternate;
}

@keyframes hammerTargetPulse {
  0% { transform: scale(0.98); }
  100% { transform: scale(1.02); }
}

/* Particles Canvas */
.fx-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 150;
}

/* ==========================================================================
   CONCENTRIC RING SVG STYLES & GLOSS
   ========================================================================== */
.ring-container {
  position: absolute;
  width: 88%;
  height: 88%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.svg-ring-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Specular White Gloss Reflection Arc */
.ring-shine {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-linecap: round;
}

/* Drop snap bounce animation */
.ring-placed-anim {
  animation: ringPopIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes ringPopIn {
  0% { transform: scale(1.25); opacity: 0.8; }
  50% { transform: scale(0.92); }
  100% { transform: scale(1); opacity: 1; }
}

/* Matched ring dissolving animation */
.ring-match-clearing {
  animation: ringClearVanish 0.35s ease-out forwards;
}

@keyframes ringClearVanish {
  0% { transform: scale(1); filter: brightness(1.8); }
  50% { transform: scale(1.3) rotate(15deg); filter: brightness(2.5); opacity: 0.8; }
  100% { transform: scale(0); opacity: 0; }
}

/* ==========================================================================
   BOTTOM CONTROLS: SPAWNER PEDESTAL & POWER-UP BUTTONS
   ========================================================================== */
.bottom-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 clamp(14px, 3vw, 28px) max(clamp(14px, 3.2vh, 36px), env(safe-area-inset-bottom, 14px));
  gap: clamp(10px, 2vh, 24px);
  z-index: 10;
  max-width: min(94vw, 700px);
  margin-top: auto;
}

/* Spawner Pedestal Plate (Coral Orange Circle with White Inner Rim) */
.spawner-station {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.spawner-pedestal {
  position: relative;
  width: clamp(82px, min(14vw, 12.5vh), 126px);
  height: clamp(82px, min(14vw, 12.5vh), 126px);
  background: var(--pedestal-color);
  border-radius: 50%;
  border: clamp(2.5px, 0.4vh, 4.5px) solid #d45920;
  box-shadow: 
    0 8px 16px rgba(0, 0, 0, 0.22),
    0 clamp(4px, 0.6vh, 7px) 0 var(--pedestal-shadow),
    inset 0 3px 6px rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.spawner-pedestal:active {
  cursor: grabbing;
}

.pedestal-rim {
  width: 82%;
  height: 82%;
  border-radius: 50%;
  border: clamp(2px, 0.3vh, 3.5px) solid var(--pedestal-rim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pedestal-center {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pedestal-center:hover {
  transform: scale(1.06);
}

.pedestal-center.spin-reroll {
  animation: pieceReroll 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pieceReroll {
  0% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(0.2) rotate(180deg); opacity: 0; }
  100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

/* Power-Ups Bar (Hammer and Refresh placed neatly below Spawner) */
.powerups-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(36px, min(10vw, 8vh), 76px);
}

.powerup-item {
  position: relative;
}

.powerup-btn {
  position: relative;
  width: clamp(48px, min(8.5vw, 7vh), 68px);
  height: clamp(48px, min(8.5vw, 7vh), 68px);
  background: var(--btn-orange);
  border: clamp(2px, 0.3vh, 3.5px) solid #2d3748;
  border-radius: clamp(14px, 2vh, 20px);
  box-shadow: 
    0 clamp(3.5px, 0.5vh, 6px) 0 var(--btn-orange-shadow),
    0 6px 12px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s, background-color 0.2s, border-color 0.2s, filter 0.2s;
}

.powerup-btn:active {
  transform: translateY(3.5px);
  box-shadow: 0 1px 0 var(--btn-orange-shadow);
}

/* Soft opacity reduction when count is 0 (keeps original orange colors) */
.powerup-btn.btn-empty {
  opacity: 0.75;
}

.powerup-btn.btn-empty:hover {
  opacity: 0.88;
}

.powerup-btn.btn-empty .powerup-icon {
  opacity: 0.8;
}

.powerup-btn.btn-disabled {
  filter: grayscale(0.85);
  opacity: 0.6;
  cursor: not-allowed;
}

.powerup-icon {
  width: clamp(28px, 4.2vh, 42px);
  height: clamp(28px, 4.2vh, 42px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-powerup-hammer,
.svg-powerup-hammer,
.svg-powerup-refresh {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.powerup-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e53935;
  border: 2px solid #ffffff;
  border-radius: 50%;
  width: clamp(20px, 2.8vh, 26px);
  height: clamp(20px, 2.8vh, 26px);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(11px, 1.6vh, 15px);
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  padding: 0;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}

.powerup-badge.badge-plus {
  background: #e53935;
  padding: 0;
}

.powerup-badge.badge-ad {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  padding: 0;
  top: -8px;
  right: -8px;
  width: clamp(24px, 3.4vh, 32px);
  height: clamp(24px, 3.4vh, 32px);
}

.img-badge-ad {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.svg-badge-plus {
  width: clamp(11.5px, 1.6vh, 15px);
  height: clamp(11.5px, 1.6vh, 15px);
  display: block;
  flex-shrink: 0;
  pointer-events: none;
  margin: auto;
}

/* ==========================================================================
   DRAGGING PROXY
   ========================================================================== */
.drag-proxy {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(82px, min(14vw, 12.5vh), 126px);
  height: clamp(82px, min(14vw, 12.5vh), 126px);
  pointer-events: none;
  z-index: 100;
  display: none;
  transform: translate(-50%, -50%) scale(1.15);
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.35));
  transition: transform 0.05s linear;
}

.drag-proxy.dragging {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   INTERACTIVE TUTORIAL GLOVE HAND & TOOLTIP
   ========================================================================== */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  display: none;
}

.tutorial-overlay.active {
  display: block;
}

.tutorial-hand {
  position: absolute;
  width: 72px;
  height: 72px;
  pointer-events: none;
  transform-origin: 22% 16%;
  transition: transform 0.4s ease-out, top 0.4s cubic-bezier(0.25, 1, 0.5, 1), left 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.38));
}

.img-finger-up,
.img-finger-down {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.img-finger-down {
  display: none;
}

.tutorial-hand.anim-drag .img-finger-up {
  animation: fingerDragUpSwitch 2.2s infinite;
}

.tutorial-hand.anim-drag .img-finger-down {
  display: block;
  animation: fingerDragDownSwitch 2.2s infinite;
}

@keyframes fingerDragUpSwitch {
  0%, 15% { opacity: 1; }
  16%, 80% { opacity: 0; }
  81%, 100% { opacity: 1; }
}

@keyframes fingerDragDownSwitch {
  0%, 15% { opacity: 0; }
  16%, 80% { opacity: 1; }
  81%, 100% { opacity: 0; }
}

.tutorial-hand.anim-tap .img-finger-up {
  display: none;
}

.tutorial-hand.anim-tap .img-finger-down {
  display: block;
}

.tutorial-hand.anim-drag {
  animation: handDragMove 2.2s infinite ease-in-out;
}

@keyframes handDragMove {
  0% {
    transform: translate(0, 0) scale(1);
  }
  15% {
    transform: translate(0, 0) scale(0.92) rotate(-6deg);
  }
  60% {
    transform: translate(var(--drag-dx, 0px), var(--drag-dy, -160px)) scale(1.04) rotate(4deg);
  }
  80% {
    transform: translate(var(--drag-dx, 0px), var(--drag-dy, -160px)) scale(0.96);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

.tutorial-hand.anim-tap {
  animation: handTapBounce 1.2s infinite ease-in-out;
}

@keyframes handTapBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(12px) scale(0.92) rotate(-8deg); }
}

.tutorial-tooltip {
  position: absolute;
  top: clamp(102px, 14vh, 126px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 7px 18px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-width: min(88vw, 320px);
  pointer-events: none;
  z-index: 45;
  animation: tooltipFloat 2s infinite ease-in-out;
}

@keyframes tooltipFloat {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

/* ==========================================================================
   MODALS: SETTINGS, SHOP, GAME OVER
   ========================================================================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: min(92vw, 440px);
  max-height: min(90vh, 90dvh, 760px);
  background: #ffffff;
  border: 4px solid #ffffff;
  border-radius: clamp(22px, 3vh, 32px);
  padding: clamp(16px, 2.5vh, 24px) clamp(14px, 2.5vw, 22px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.38), 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(0.85);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-sizing: border-box;
}

.modal-backdrop.active .modal-card {
  transform: scale(1);
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.5px;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: #ef4444;
  border: 2px solid #b91c1c;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35), 0 2px 0 #991b1b;
  transition: transform 0.1s, background-color 0.15s, box-shadow 0.15s;
}

.modal-close-btn:hover {
  background: #dc2626;
  border-color: #991b1b;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.45), 0 2px 0 #7f1d1d;
}

.modal-close-btn:active {
  transform: translateY(2px) scale(0.94);
  box-shadow: 0 0 0 #991b1b;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1.5px solid #e2e8f0;
}

.setting-label {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #334155;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  border: 2px solid #475569;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #ffffff;
  border: 1.5px solid #475569;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

input:checked + .slider {
  background-color: #22c55e;
  border-color: #15803d;
}

input:checked + .slider:before {
  transform: translateY(-50%) translateX(22px);
  border-color: #15803d;
}

.settings-card {
  max-height: min(90vh, 90dvh, 760px);
  padding: clamp(16px, 2.2vh, 22px) clamp(14px, 2.5vw, 20px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.settings-card::-webkit-scrollbar {
  width: 5px;
}

.settings-card::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1.5px solid #e2e8f0;
}

.setting-label-group {
  display: flex;
  flex-direction: column;
}

.setting-subtext {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  margin-top: 1px;
}

.setting-block {
  padding: 9px 0;
  border-bottom: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.setting-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-badge {
  background: #0284c7;
  color: white;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
}

.theme-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}

.theme-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 6px;
  background: linear-gradient(to right, #7ee2ff, #ff7e5f, #84fab0, #a18cd1, #1e3c72, #ffecd2);
  outline: none;
  border: 1.5px solid #475569;
  cursor: pointer;
}

.theme-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid #1e293b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  cursor: grab;
  transition: transform 0.1s;
}

.theme-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.theme-dots {
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: 4px;
  margin-bottom: 2px;
}

.theme-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #64748b;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s, border-color 0.15s;
}

.theme-dot.active {
  border: 2.5px solid #0f172a;
  transform: scale(1.22);
  box-shadow: 0 0 0 2px #38bdf8, 0 3px 6px rgba(0, 0, 0, 0.25);
}

.theme-dot:hover {
  transform: scale(1.12);
}

.segmented-control {
  display: flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 13px;
  border: 2px solid #cbd5e1;
  gap: 3px;
}

.seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: #475569;
  padding: 6px 2px;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.seg-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 1px 0 #cbd5e1;
  transform: scale(1.02);
}

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

.setting-hint {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  line-height: 1.25;
}

.modal-action-btn {
  width: 100%;
  padding: clamp(10px, 1.8vh, 14px);
  margin-top: 10px;
  border-radius: 16px;
  border: 3px solid #1e293b;
  font-family: var(--font-display);
  font-size: clamp(14px, 2vh, 18px);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
}

.primary-btn {
  background: #22c55e;
  color: white;
  box-shadow: 0 5px 0 #15803d;
}

.secondary-btn {
  background: #38bdf8;
  color: white;
  box-shadow: 0 5px 0 #0284c7;
}

.danger-btn {
  background: #ef4444;
  color: white;
  box-shadow: 0 5px 0 #b91c1c;
}

.rescue-btn {
  background: #f59e0b;
  color: white;
  box-shadow: 0 5px 0 #b45309;
}

.modal-action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0;
}

.modal-action-btn:disabled,
.modal-action-btn.btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15) !important;
  pointer-events: none;
}

/* Shop Modal */
.shop-list {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 14px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 4px clamp(12px, 2vh, 20px);
  flex: 1;
  min-height: 0;
  max-height: none;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 18px;
  padding: 10px 14px;
}

.shop-item-icon {
  width: 42px;
  height: 42px;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.img-shop-hammer,
.svg-shop-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

.shop-item-info {
  flex: 1;
  margin-left: 12px;
}

.shop-item-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #1e293b;
}

.shop-item-desc {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}

.buy-btn {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  border: 2px solid #ffffff;
  border-radius: 14px;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 #15803d, 0 3px 8px rgba(22, 163, 74, 0.25);
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}

.buy-btn:hover {
  filter: brightness(1.05);
}

.buy-coin-svg-wrap {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-gold-coin-small,
.svg-coin-small {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.buy-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #15803d;
}

.buy-btn.btn-watch-ad {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border: 2px solid #ffffff;
  color: #ffffff;
  box-shadow: 0 3px 0 #0369a1, 0 3px 8px rgba(2, 132, 199, 0.28);
  gap: 6px;
  min-width: 116px;
  padding: 6px 14px;
}

.buy-btn.btn-watch-ad:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0369a1;
}

.buy-ad-icon-wrap {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.img-shop-ad-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Shop Modal Toast Notification */
.shop-toast {
  margin-top: 14px;
  background: #fee2e2;
  border: 2px solid #ef4444;
  color: #dc2626;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  overflow: hidden;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shop-toast.active {
  opacity: 1;
  max-height: 50px;
  padding: 8px 16px;
  margin-top: 14px;
  transform: translateY(0) scale(1);
  animation: toastWiggle 0.35s ease-in-out;
}

@keyframes toastWiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.rescue-btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.img-rescue-hammer,
.svg-rescue-hammer {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Game Over Card */
.gameover-card {
  text-align: center;
}

.gameover-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: #ef4444;
  margin-bottom: 16px;
}

.gameover-score-box {
  background: #f1f5f9;
  border: 3px solid #cbd5e1;
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 20px;
}

.go-label {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: #64748b;
}

.go-score {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 800;
  color: #ff3377;
  -webkit-text-stroke: 3px #ffffff;
  text-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.go-best-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: #334155;
  margin-top: 4px;
}

.crown-icon-endscreen {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Screen Shake Effect */
.shake-screen {
  animation: screenShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes screenShake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ==========================================================================
   HAMMER SMASH HIT ANIMATION
   ========================================================================== */
.hammer-smash-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 45;
}

.hammer-hit-proxy {
  position: absolute;
  width: 100px;
  height: 100px;
  pointer-events: none;
  transform-origin: 22% 82%;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45));
  animation: hammerSmashStrike 0.52s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.img-hammer-hit,
.svg-hammer-hit {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes hammerSmashStrike {
  0% {
    transform: translate(-60%, -35%) translate(-15px, -30px) rotate(-35deg) scale(0.7);
    opacity: 0;
  }
  20% {
    transform: translate(-60%, -35%) translate(-25px, -45px) rotate(-65deg) scale(1.15);
    opacity: 1;
  }
  50% {
    transform: translate(-60%, -35%) translate(0px, 0px) rotate(0deg) scale(1.25, 0.82);
    opacity: 1;
  }
  65% {
    transform: translate(-60%, -35%) translate(-6px, -12px) rotate(-12deg) scale(1.04);
    opacity: 1;
  }
  85% {
    transform: translate(-60%, -35%) translate(-12px, -20px) rotate(-20deg) scale(0.9);
    opacity: 0.85;
  }
  100% {
    transform: translate(-60%, -35%) translate(-15px, -26px) rotate(-24deg) scale(0.6);
    opacity: 0;
  }
}

/* ==========================================================================
   WEEKLY QUEST MODAL (Clean UI matching game theme)
   ========================================================================== */
.quest-card {
  width: 90%;
  max-width: min(92vw, 440px);
  background: #ffffff;
  border: 4px solid #ffffff;
  border-radius: clamp(22px, 3vh, 32px);
  padding: clamp(14px, 2.2vh, 22px) clamp(12px, 2.5vw, 20px);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.38), 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 90dvh, 760px);
  overflow: hidden;
  box-sizing: border-box;
}

.quest-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(6px, 1.2vh, 12px);
}

.quest-header h2 {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vh, 26px);
  font-weight: 800;
  color: #1e293b;
  letter-spacing: 0.5px;
}

/* Subheader Timer Pill */
.quest-timer-pill {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: clamp(4px, 0.8vh, 8px) clamp(10px, 2vw, 16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(6px, 1.2vh, 12px);
  flex-shrink: 0;
}

.quest-timer-text {
  font-family: var(--font-display);
  font-size: clamp(11px, 1.4vh, 13px);
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.5px;
}

.quest-timer-badge {
  background: #e2e8f0;
  border-radius: 10px;
  padding: 3px 8px;
  font-family: var(--font-display);
  font-size: clamp(11px, 1.4vh, 13px);
  font-weight: 900;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 5px;
}

.svg-timer-clock {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: block;
}

/* Quest List */
.quest-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 12px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 4px clamp(12px, 2vh, 20px);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  flex: 1;
  min-height: 0;
  max-height: none;
}

.quest-list::-webkit-scrollbar {
  width: 4px;
}
.quest-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* Quest Row Card */
.quest-item {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: clamp(14px, 1.8vh, 18px);
  padding: clamp(8px, 1.2vh, 12px) clamp(10px, 1.5vw, 14px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 12px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.quest-item:hover {
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.quest-icon-wrap {
  width: clamp(38px, 4.8vh, 46px);
  height: clamp(38px, 4.8vh, 46px);
  border-radius: clamp(11px, 1.4vh, 14px);
  background: #ffffff;
  border: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quest-icon-wrap img,
.quest-icon-wrap svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.quest-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.quest-title {
  font-family: var(--font-display);
  font-size: clamp(12.5px, 1.6vh, 15px);
  font-weight: 800;
  color: #1e293b;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quest-desc {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.3vh, 12px);
  font-weight: 700;
  color: #64748b;
  line-height: 1.15;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quest-progress-bar-wrap {
  position: relative;
  width: 100%;
  height: clamp(10px, 1.3vh, 13px);
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: clamp(3px, 0.5vh, 6px);
}

.quest-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #4ade80 0%, #22c55e 100%);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.quest-progress-text {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(8.5px, 1.1vh, 10.5px);
  font-weight: 900;
  color: #334155;
  letter-spacing: 0.3px;
}

/* Quest Reward Capsule - 3-State Visual Flow (Unclaimed -> Can Claim -> Claimed) */
.quest-reward-pill {
  width: clamp(60px, 8vw, 74px);
  height: clamp(32px, 4vh, 38px);
  border-radius: clamp(10px, 1.4vh, 13px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 5px;
  flex-shrink: 0;
  box-sizing: border-box;
  font-family: var(--font-display);
}

/* State 1: Unclaimed (In Progress) */
.quest-reward-pill.unclaimed {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #1e293b;
  cursor: default;
  user-select: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.quest-reward-pill.unclaimed .quest-reward-amount {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.5vh, 14px);
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
  letter-spacing: 0.2px;
}

/* State 2: Can Claim (Green, Clickable, Animated Pulse) */
.quest-reward-pill.can-claim {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  border: 2px solid #ffffff;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 3px 0 #15803d, 0 3px 8px rgba(22, 163, 74, 0.25);
  animation: claimPulse 1.2s infinite ease-in-out;
  transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}

.quest-reward-pill.can-claim:hover {
  filter: brightness(1.05);
}

.quest-reward-pill.can-claim:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #15803d;
}

.quest-reward-pill.can-claim .quest-reward-amount {
  font-family: var(--font-display);
  font-size: clamp(12px, 1.5vh, 14px);
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* State 3: Claimed (Green with centered white tick) */
.quest-reward-pill.claimed {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  border: 2px solid #ffffff;
  color: #ffffff;
  cursor: default;
  user-select: none;
  box-shadow: 0 2px 0 #15803d;
}

.quest-coin-img {
  width: clamp(18px, 2.4vh, 22px);
  height: clamp(18px, 2.4vh, 22px);
  object-fit: contain;
  filter: drop-shadow(0 1.5px 2px rgba(0, 0, 0, 0.15));
}

.quest-tick-svg {
  width: clamp(18px, 2.4vh, 22px);
  height: clamp(18px, 2.4vh, 22px);
  stroke: #ffffff;
  stroke-width: 3.5;
  display: block;
}

@keyframes claimPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Modal Coin Pill (Live Coins in Header) */
.modal-coin-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f59e0b;
  border: 2px solid #b45309;
  border-radius: 16px;
  padding: 4px 10px 4px 6px;
  box-shadow: 0 2px 0 #b45309;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: clamp(13px, 1.6vh, 15px);
  font-weight: 900;
  line-height: 1;
}

.img-modal-coin {
  width: clamp(18px, 2.4vh, 22px);
  height: clamp(18px, 2.4vh, 22px);
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* 3-Section Segmented Tab Bar */
.quest-tabs-bar {
  display: flex;
  background: #e2e8f0;
  border-radius: 14px;
  padding: 3px;
  gap: 4px;
  margin-bottom: clamp(6px, 1.2vh, 12px);
  flex-shrink: 0;
}

.quest-tab-btn {
  position: relative;
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 11px;
  font-family: var(--font-display);
  font-size: clamp(12px, 1.5vh, 14px);
  font-weight: 900;
  color: #64748b;
  padding: clamp(6px, 1vh, 8px) 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quest-tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12), 0 1px 0 #cbd5e1;
  transform: scale(1.02);
}

.quest-tab-btn:active {
  transform: scale(0.96);
}

.tab-badge-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: none;
}

.tab-badge-dot.active {
  display: inline-block;
  animation: badgePulse 1.2s infinite;
}

.quest-tab-panel {
  display: none;
  width: 100%;
}

.quest-tab-panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Daily Gift Card */
.daily-gift-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2.5px solid #fbbf24;
  border-radius: clamp(14px, 2vh, 18px);
  padding: clamp(8px, 1.2vh, 12px) clamp(10px, 1.6vw, 14px);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 12px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.15);
  margin-bottom: clamp(6px, 1.2vh, 10px);
  flex-shrink: 0;
}

.daily-gift-icon-wrap {
  width: clamp(38px, 4.8vh, 46px);
  height: clamp(38px, 4.8vh, 46px);
  background: #ffffff;
  border: 2px solid #fde68a;
  border-radius: clamp(11px, 1.4vh, 14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.img-daily-gift-powerup,
.svg-daily-gift-refresh,
.svg-daily-gift {
  width: clamp(28px, 3.6vh, 36px);
  height: clamp(28px, 3.6vh, 36px);
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

.daily-gift-info {
  flex: 1;
  min-width: 0;
}

.daily-gift-title {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.2vh, 11.5px);
  font-weight: 800;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.85;
}

.daily-gift-desc {
  font-family: var(--font-display);
  font-size: clamp(11.5px, 1.4vh, 13px);
  font-weight: 900;
  color: #78350f;
  margin-top: 1px;
}

.gift-claim-btn {
  padding: clamp(7px, 1vh, 10px) clamp(12px, 1.8vw, 16px);
  font-size: clamp(12px, 1.5vh, 13.5px);
}

.daily-gift-claimed-pill {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.2vh, 11.5px);
  font-weight: 900;
  color: #065f46;
  background: #d1fae5;
  border: 1.5px solid #6ee7b7;
  border-radius: 12px;
  padding: clamp(4px, 0.8vh, 6px) clamp(8px, 1.2vw, 10px);
  text-align: center;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  letter-spacing: 0.3px;
}

/* Quest Section Header */
.quest-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(4px, 0.8vh, 8px);
  padding: 0 4px;
  flex-shrink: 0;
}

.quest-section-title {
  font-family: var(--font-display);
  font-size: clamp(11px, 1.3vh, 12px);
  font-weight: 900;
  color: #475569;
  letter-spacing: 0.5px;
}

.quest-section-timer {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.2vh, 11px);
  font-weight: 800;
  color: #64748b;
}


/* ==========================================================================
   PORTRAIT SPLASH LOADING SCREEN (Ringloo 3D Logo + Amber Progress Bar)
   ========================================================================== */
.splash-loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #6fd5fc 0%, #52bdef 100%);
  background-color: #56c5f7;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(40px, 10vh, 80px) 24px clamp(30px, 8vh, 60px);
  box-sizing: border-box;
  overflow: hidden;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s;
}

.splash-loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Center Branding Block */
.splash-center-block {
  margin-top: auto;
  margin-bottom: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  padding: 0 20px;
}

.splash-logo-wrap {
  width: min(340px, 86vw);
  max-width: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 10px 20px rgba(0, 75, 125, 0.20));
}

.img-splash-logo {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Bottom Progress Section */
.splash-bottom-wrap {
  width: 100%;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: auto;
  margin-bottom: max(36px, env(safe-area-inset-bottom, 36px));
  gap: 8px;
}

.splash-loading-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.splash-progress-track {
  position: relative;
  width: 100%;
  height: 18px;
  background: #6c2b0c;
  border: 3px solid #f6cf7d;
  border-radius: 999px;
  padding: 2px;
  box-shadow: 
    0 4px 10px rgba(0, 0, 0, 0.25),
    inset 0 2px 4px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.splash-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(180deg, #ffa338 0%, #ff7b00 50%, #e65100 100%);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(255, 123, 0, 0.8);
  transition: width 0.1s linear;
  position: relative;
}

.splash-progress-fill::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 4px;
  right: 4px;
  height: 3px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

/* ==========================================================================
   COMPACT VIEWPORTS & EMBEDDED IFRAMES (CrazyGames QA, Short Screens)
   ========================================================================== */
@media (max-height: 680px) {
  .game-container {
    padding-top: max(4px, env(safe-area-inset-top, 4px));
    padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
  }
  .hud-header {
    padding-top: 4px;
    padding-bottom: 2px;
  }
  .board-area {
    padding: 0 8px;
  }
  .bottom-section {
    gap: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
  }
  .powerups-bar {
    gap: 32px;
  }
  .quest-card {
    padding: 12px 14px 16px;
    border-radius: 20px;
  }
  .daily-gift-card {
    padding: 6px 10px;
    margin-bottom: 6px;
    gap: 8px;
  }
  .daily-gift-icon-wrap {
    width: 34px;
    height: 34px;
  }
  .img-daily-gift-powerup,
  .svg-daily-gift-refresh,
  .svg-daily-gift {
    width: 24px;
    height: 24px;
  }
  .quest-item {
    padding: 6px 10px;
    gap: 8px;
  }
  .quest-icon-wrap {
    width: 34px;
    height: 34px;
  }
}

@media (max-height: 560px) {
  .board-frame {
    width: min(84vw, min(42vh, 260px));
    height: min(84vw, min(42vh, 260px));
  }
  .spawner-pedestal {
    width: 72px;
    height: 72px;
  }
  .powerup-btn {
    width: 42px;
    height: 42px;
  }
  .main-score {
    font-size: 32px;
  }
}




