/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.logo {
  font-family: 'Brandon Grotesque', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 8vw, 2.8rem);
  color: #F0544F;
  letter-spacing: -0.5px;
  line-height: 1;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.label {
  font-size: 0.65rem;
  font-family: 'Brandon Grotesque', system-ui, sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a09590;
  display: block;
}

small {
  font-size: 0.7rem;
  opacity: 0.6;
  display: block;
  margin-top: 0.2rem;
}

/* ============================================================
   COLOUR THEMES — applied randomly via JS on load
   ============================================================ */

/* Coral theme */
.theme-coral .screen {
  background:
    linear-gradient(160deg, #F0544F 0%, #ff7a77 18%, rgba(252,249,248,0) 55%),
    #fcf9f8;
}
.theme-coral .logo { color: #fff; }
.theme-coral .app-header { border-bottom-color: rgba(255,255,255,0.2); }
.theme-coral .header-score .mono { color: #fff; }
.theme-coral .header-score .label { color: rgba(255,255,255,0.7); }

/* Teal theme */
.theme-teal .screen {
  background:
    linear-gradient(160deg, #1CA694 0%, #22c4af 18%, rgba(252,249,248,0) 55%),
    #fcf9f8;
}
.theme-teal .logo { color: #fff; }
.theme-teal .app-header { border-bottom-color: rgba(255,255,255,0.2); }
.theme-teal .header-score .mono { color: #fff; }
.theme-teal .header-score .label { color: rgba(255,255,255,0.7); }

/* Amber theme */
.theme-amber .screen {
  background:
    linear-gradient(160deg, #F7A43B 0%, #f8bc5e 18%, rgba(252,249,248,0) 55%),
    #fcf9f8;
}
.theme-amber .logo { color: #fff; }
.theme-amber .app-header { border-bottom-color: rgba(255,255,255,0.2); }
.theme-amber .header-score .mono { color: #fff; }
.theme-amber .header-score .label { color: rgba(255,255,255,0.7); }

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100vh;
  padding: 1.1rem 1rem;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(240,84,79,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(28,166,148,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(247,164,59,0.04) 0%, transparent 70%),
    #fcf9f8;
}

.screen.active {
  display: flex;
}

/* ============================================================
   LEVEL SELECT SCREEN
   ============================================================ */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.header-score {
  text-align: right;
}

.header-score .mono {
  font-size: 1.5rem;
  color: #1CA694;
}

/* Level indicator in game header */
.game-level-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.8rem;
}

.game-level-info .mono {
  font-size: 1.05rem;
  color: #1a1a1a;
  line-height: 1.1;
}

/* Level grid */
.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.level-card {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 18px;
  padding: 1rem 0.5rem;
  text-align: center;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.07),
    0 0 0 1px rgba(0,0,0,0.04);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.level-card:active {
  transform: scale(0.95);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.level-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(240,236,233,0.7);
}

.level-card.completed {
  background: linear-gradient(145deg, rgba(28,166,148,0.08), rgba(255,255,255,0.9));
  box-shadow:
    0 2px 12px rgba(28,166,148,0.15),
    0 0 0 1.5px rgba(28,166,148,0.3);
}

.level-card.perfect {
  background: linear-gradient(145deg, rgba(247,164,59,0.1), rgba(255,255,255,0.9));
  box-shadow:
    0 2px 12px rgba(247,164,59,0.2),
    0 0 0 1.5px rgba(247,164,59,0.35);
}

.level-card .level-num {
  font-family: 'Brandon Grotesque', system-ui, sans-serif;
  font-size: 1.7rem;
  color: #F0544F;
  line-height: 1;
}

.level-card .level-name {
  font-size: 0.65rem;
  color: #888;
  margin-top: 0.2rem;
  font-weight: 600;
}

.level-card .level-status {
  font-size: 0.95rem;
  margin-top: 0.25rem;
  min-height: 1.2rem;
}

/* Infinite mode button */
.infinite-section {
  text-align: center;
  margin-top: 1.2rem;
  width: 100%;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.btn-infinite {
  font-family: 'Brandon Grotesque', system-ui, sans-serif;
  font-size: 1.05rem;
  padding: 0.85rem 2rem;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #fcf9f8;
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 0 0 1px rgba(240,84,79,0.25);
  width: 100%;
  line-height: 1.3;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-infinite:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-infinite:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Sound toggle */
.sound-toggle-row {
  text-align: center;
  margin-top: 0.9rem;
  width: 100%;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.btn-sound {
  font-size: 0.78rem;
  color: #aaa;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ============================================================
   GAME SCREEN
   ============================================================ */
.game-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

.btn-icon {
  font-size: 1.2rem;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05);
  transition: transform 0.12s ease;
}

.btn-icon:active {
  transform: scale(0.92);
}

.score-group {
  display: flex;
  gap: 0.85rem;
  flex: 1;
  justify-content: flex-end;
}

.score-item {
  text-align: right;
}

.score-item.accent .mono {
  color: #F0544F;
}

.score-item .mono {
  font-size: 1.05rem;
  display: block;
  line-height: 1.1;
}

/* ============================================================
   BOARD
   ============================================================ */
.board {
  display: grid;
  gap: 7px;
  flex: 1;
  align-content: center;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.tile {
  aspect-ratio: 1;
  border-radius: 14px;
  background: rgba(255,255,255,0.85);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: clamp(0.8rem, 3.5vw, 1.25rem);
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
}

.tile:active {
  transform: scale(0.92);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tile.revealed {
  cursor: default;
}

.tile.revealed:active {
  transform: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07), inset 0 1px 0 rgba(255,255,255,0.5);
}

/* Hidden tile texture */
.tile.hidden {
  background: linear-gradient(145deg, rgba(255,255,255,0.95) 0%, rgba(242,238,235,0.9) 100%);
}

/* Score 0 — neutral grey */
.tile.score-0 {
  background: linear-gradient(145deg, #e8e4e1 0%, #dedad7 100%);
  color: #b0aba7;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* Score low — mustard/amber */
.tile.score-low {
  background: linear-gradient(145deg, #F7A43B 0%, #f8bc5e 100%);
  color: #fff;
  box-shadow:
    0 3px 10px rgba(247,164,59,0.35),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

/* Score high — turquoise */
.tile.score-high {
  background: linear-gradient(145deg, #1CA694 0%, #22c4af 100%);
  color: #fff;
  box-shadow:
    0 3px 10px rgba(28,166,148,0.35),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

/* Bomb — coral */
.tile.bomb {
  background: linear-gradient(145deg, #F0544F 0%, #ff7a77 100%);
  color: #fff;
  box-shadow:
    0 4px 16px rgba(240,84,79,0.45),
    inset 0 1px 0 rgba(255,255,255,0.2);
  font-size: 1.3rem;
}

/* Bomb revealed after defeat (other bombs, not clicked) */
.tile.bomb-late {
  background: linear-gradient(145deg, #c73b37 0%, #e05550 100%);
  color: rgba(255,255,255,0.85);
  box-shadow:
    0 2px 8px rgba(199,59,55,0.3),
    inset 0 1px 0 rgba(255,255,255,0.1);
  font-size: 1.1rem;
  opacity: 0.75;
}

/* Mystery tile */
.tile.mystery.hidden {
  background: linear-gradient(145deg, rgba(247,164,59,0.08) 0%, rgba(242,238,235,0.9) 100%);
}

/* Multiplier indicator badge */
.tile.is-multiplier::after {
  content: '×2';
  position: absolute;
  top: 3px;
  right: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.48rem;
  font-weight: 700;
  color: #F7A43B;
  background: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 1px 3px;
  line-height: 1.4;
}

/* ============================================================
   POWER-UP BAR
   ============================================================ */
.powerup-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.5rem 0;
  flex-shrink: 0;
}

.powerup-bar.hidden {
  display: none;
}

.btn-powerup {
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  font-weight: 700;
  transition: transform 0.12s ease;
}

.btn-powerup:not(:disabled):active {
  transform: scale(0.93);
}

.btn-powerup:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ============================================================
   GUARANTEE BUTTON
   ============================================================ */
.game-footer {
  padding-top: 0.75rem;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.btn-guarantee {
  font-family: 'Brandon Grotesque', system-ui, sans-serif;
  font-size: 1.35rem;
  padding: 0.9rem 2.5rem;
  background: linear-gradient(135deg, #1CA694 0%, #22c4af 100%);
  color: #fff;
  border: none;
  border-radius: 20px;
  box-shadow:
    0 6px 20px rgba(28,166,148,0.35),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  width: 100%;
  max-width: 360px;
}

.btn-guarantee:not(:disabled):active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(28,166,148,0.3);
}

.btn-guarantee:disabled {
  background: linear-gradient(135deg, #c8c4c1 0%, #d4d0cd 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: not-allowed;
  color: rgba(255,255,255,0.6);
}

.btn-guarantee.ready {
  animation: pulse-green 1.8s ease-in-out infinite;
}

/* ============================================================
   FLOATING POINTS
   ============================================================ */
.float-point {
  position: fixed;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1CA694;
  pointer-events: none;
  z-index: 100;
  text-shadow: 0 1px 6px rgba(0,0,0,0.12);
}

.float-point.multiplied {
  color: #F7A43B;
  font-size: 1.3rem;
}
