/* ==============================================================================
   NopsaPelit - Suomen Modernein Pelikeidas
   Theme: Cyber Arcade / Deep Obsidian & Neon Glow
   100% Responsive, Touch-Friendly, Zero Dependencies, Ultra-Fast
   ============================================================================== */

:root {
  --bg-deep: #060913;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-elevated: #0f172a;
  --bg-modal: rgba(7, 10, 20, 0.95);

  --border-subtle: rgba(124, 58, 237, 0.2);
  --border-glow: rgba(0, 240, 255, 0.4);

  --neon-cyan: #00f0ff;
  --neon-purple: #7c3aed;
  --neon-pink: #ec4899;
  --neon-green: #10b981;
  --neon-amber: #f59e0b;

  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 25px rgba(124, 58, 237, 0.3);
  --shadow-cyan: 0 0 20px rgba(0, 240, 255, 0.35);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-main);
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: #334155 #060913;
}

html:has(.game-modal.open) {
  overflow: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(124, 58, 237, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(0, 240, 255, 0.12) 0%, transparent 45%);
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==============================================================================
   1. HEADER & NAVIGATION
   ============================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  list-style: none;
}

.nav-btn {
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-btn:hover, .nav-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-badge:hover {
  border-color: var(--neon-cyan);
  background: rgba(124, 58, 237, 0.25);
}

.user-avatar {
  font-size: 1.15rem;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.user-level,
.lb-level-badge {
  font-size: 0.72rem;
  background: var(--neon-purple);
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* ==============================================================================
   2. HERO & VALUE PROPOSITION
   ============================================================================== */
.hero-section {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--neon-cyan);
  padding: 0.4rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-perks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.hero-perk {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-weight: 600;
}

.hero-perk span {
  color: var(--neon-green);
}

/* ==============================================================================
   3. CATEGORY FILTERS & SEARCH
   ============================================================================== */
.games-hub-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.hub-title-block {
  flex: 1;
  min-width: 260px;
}

.hub-main-title {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem 0;
  background: linear-gradient(135deg, #fff 40%, var(--neon-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.hub-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 380px;
}

.hub-search-icon {
  position: absolute;
  left: 1rem;
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.7;
}

.hub-search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  padding: 0.7rem 2.5rem 0.7rem 2.6rem;
  font-size: 0.92rem;
  color: #fff;
  outline: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.hub-search-input:focus {
  border-color: var(--neon-purple);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.35);
  background: rgba(26, 16, 60, 0.85);
}

.hub-search-input::placeholder {
  color: var(--text-dim);
}

.hub-search-clear {
  position: absolute;
  right: 0.85rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hub-search-clear:hover {
  background: rgba(244, 63, 94, 0.8);
  transform: scale(1.1);
}

.filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  padding-bottom: 0.25rem;
}

.cat-btn {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.cat-btn:hover {
  background: rgba(124, 58, 237, 0.2);
  color: #fff;
  border-color: var(--border-subtle);
}

.cat-btn.active {
  background: linear-gradient(135deg, var(--neon-purple), #4f46e5);
  color: #ffffff;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
}

/* ==============================================================================
   4. GAMES GRID & CARDS
   ============================================================================== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.75rem;
  margin-bottom: 4rem;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
  backdrop-filter: blur(12px);
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--neon-cyan);
  box-shadow: var(--shadow-cyan);
  background: var(--bg-card-hover);
}

.game-thumb {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: radial-gradient(circle at center, rgba(124, 58, 237, 0.3) 0%, rgba(15, 23, 42, 0.9) 100%);
  overflow: hidden;
}

.game-thumb-icon {
  font-size: 4rem;
  filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.5));
  transition: transform 0.3s ease;
}

.game-card:hover .game-thumb-icon {
  transform: scale(1.15) rotate(-4deg);
}

.game-badge-top {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(6, 9, 19, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--neon-cyan);
  letter-spacing: 0.05em;
}

.game-play-btn-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 19, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.game-card:hover .game-play-btn-overlay {
  opacity: 1;
}

.play-circle {
  width: 54px;
  height: 54px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
  font-size: 1.4rem;
  color: #fff;
}

.game-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.game-card-desc {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
}

.game-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.85rem;
}

.game-tag {
  color: var(--neon-green);
  font-weight: 700;
}

/* ==============================================================================
   5. GAME MODAL & THEATER VIEW
   ============================================================================== */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 7, 15, 0.92);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.game-modal-dialog {
  width: 100%;
  max-width: min(96vw, 960px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 50px rgba(0, 240, 255, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 96dvh;
  overflow: hidden;
}

.game-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-game-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-game-icon {
  font-size: 1.6rem;
}

.modal-game-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: var(--neon-pink);
  border-color: var(--neon-pink);
}

.game-stage-container {
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* ==============================================================================
   6. COMMON GAME UI WRAPPERS
   ============================================================================== */
.game-wrapper {
  width: 100%;
  max-width: 520px;
  margin: auto;
}

.game-wrapper.mahjong-canvas-game,
.game-wrapper.kytky-canvas-game,
.game-wrapper.pasianssi-canvas-game,
.game-wrapper.klondike-canvas-game {
  max-width: 800px;
}

.game-wrapper.spot-canvas-game {
  max-width: 1040px;
}

.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.game-stats-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
}

.game-badge {
  background: rgba(0, 240, 255, 0.15);
  color: var(--neon-cyan);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.btn-ghost-sm {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-sm:hover {
  border-color: var(--neon-cyan);
  color: #fff;
}

.btn-primary-glow {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: #ffffff;
  border: none;
  padding: 0.85rem 1.85rem;
  font-size: 1rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
  transition: all 0.2s ease;
}

.btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.7);
}

/* Wordle styles */
.wordle-board {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.wordle-row {
  display: flex;
  gap: 0.45rem;
}

.wordle-tile {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.6);
  user-select: none;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.wordle-tile.pop {
  transform: scale(1.08);
  border-color: var(--neon-cyan);
}

.wordle-tile.correct {
  background: #059669 !important;
  border-color: #10b981 !important;
}

.wordle-tile.present {
  background: #d97706 !important;
  border-color: #f59e0b !important;
}

.wordle-tile.absent {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #94a3b8 !important;
}

.virtual-keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}

.kbd-row {
  display: flex;
  gap: 0.35rem;
}

.kbd-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  height: 44px;
  min-width: 32px;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.kbd-btn:hover {
  background: #334155;
}

.kbd-wide {
  min-width: 56px;
  font-size: 0.8rem;
}

.kbd-btn.correct { background: #059669; }
.kbd-btn.present { background: #d97706; }
.kbd-btn.absent { background: #111827; color: #64748b; }

.game-feedback {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.game-feedback.show { opacity: 1; }
.game-feedback.success { color: var(--neon-green); background: rgba(16, 185, 129, 0.15); }
.game-feedback.warn { color: var(--neon-amber); background: rgba(245, 158, 11, 0.15); }

/* Trivia styles */
.trivia-timer-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.trivia-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  transition: width 0.05s linear;
}

.trivia-timer-bar.danger {
  background: var(--neon-pink);
}

.trivia-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.trivia-question {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  line-height: 1.4;
  color: #fff;
}

.trivia-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.trivia-opt-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  transition: all 0.2s ease;
}

.trivia-opt-btn:hover {
  background: #334155;
  border-color: var(--neon-cyan);
}

.trivia-opt-btn.correct {
  background: #065f46 !important;
  border-color: var(--neon-green) !important;
}

.trivia-opt-btn.wrong {
  background: #881337 !important;
  border-color: var(--neon-pink) !important;
}

.opt-letter {
  background: rgba(255, 255, 255, 0.1);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.finished-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.finish-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.finish-score-big {
  font-size: 3.8rem;
  font-weight: 900;
  color: var(--neon-cyan);
  margin: 0.5rem 0;
  text-shadow: 0 0 25px rgba(0, 240, 255, 0.4);
}

.finish-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.f-stat {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
}

.f-stat span { display: block; font-size: 0.75rem; color: var(--text-dim); }
.f-stat strong { font-size: 1.15rem; color: #fff; }

/* Memory Matrix styles */
.memory-grid-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.memory-grid {
  display: grid;
  gap: 0.6rem;
}

.grid-3 { grid-template-columns: repeat(3, 85px); }
.grid-4 { grid-template-columns: repeat(4, 65px); }
.grid-5 { grid-template-columns: repeat(5, 52px); }

.mem-tile {
  height: 85px;
  background: #1e293b;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.grid-4 .mem-tile { height: 65px; }
.grid-5 .mem-tile { height: 52px; }

.mem-tile.flash-active {
  background: var(--neon-cyan) !important;
  box-shadow: 0 0 20px var(--neon-cyan);
  border-color: #fff;
}

.mem-tile.tile-correct {
  background: var(--neon-green) !important;
  box-shadow: 0 0 15px var(--neon-green);
  border-color: #fff;
}

.mem-tile.tile-wrong {
  background: var(--neon-pink) !important;
  box-shadow: 0 0 15px var(--neon-pink);
  border-color: #fff;
}

.mem-tile.tile-missed {
  border-color: var(--neon-amber) !important;
  background: rgba(245, 158, 11, 0.3) !important;
}

.memory-status-text {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--neon-cyan);
  min-height: 24px;
}

/* 2048 styles */
.g2048-scores {
  display: flex;
  gap: 0.75rem;
}

.score-box {
  background: #1e293b;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.score-box span { display: block; font-size: 0.65rem; color: var(--text-dim); font-weight: 800; }
.score-box strong { font-size: 1.1rem; color: var(--neon-cyan); }

.g2048-board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  touch-action: none;
}

.g2048-board {
  display: grid;
  grid-template-columns: repeat(4, 72px);
  gap: 0.6rem;
  background: #0f172a;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.g2048-cell {
  height: 72px;
  background: #1e293b;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  user-select: none;
}

.g2048-cell.tile-2 { background: #334155; color: #f8fafc; }
.g2048-cell.tile-4 { background: #475569; color: #f8fafc; }
.g2048-cell.tile-8 { background: #f59e0b; color: #000; box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
.g2048-cell.tile-16 { background: #ea580c; color: #fff; }
.g2048-cell.tile-32 { background: #dc2626; color: #fff; }
.g2048-cell.tile-64 { background: #e11d48; color: #fff; }
.g2048-cell.tile-128 { background: var(--neon-purple); color: #fff; box-shadow: 0 0 15px var(--neon-purple); font-size: 1.3rem; }
.g2048-cell.tile-256 { background: #9333ea; color: #fff; font-size: 1.3rem; }
.g2048-cell.tile-512 { background: #06b6d4; color: #000; font-size: 1.3rem; }
.g2048-cell.tile-1024 { background: var(--neon-cyan); color: #000; box-shadow: 0 0 20px var(--neon-cyan); font-size: 1.1rem; }
.g2048-cell.tile-2048 { background: #10b981; color: #000; box-shadow: 0 0 25px #10b981; font-size: 1.1rem; }

.g2048-overlay, .cosmic-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 19, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  text-align: center;
}

.g2048-over-box { padding: 1.5rem; }
.g2048-over-box h3 { font-size: 1.5rem; margin-bottom: 0.5rem; color: #fff; }
.g2048-over-box p { color: var(--text-dim); margin-bottom: 1.25rem; }
.g2048-over-box span { color: var(--neon-cyan); font-weight: 800; }

.g2048-controls-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* Minesweeper styles */
.mines-mobile-toolbar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mines-tool-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.mines-tool-btn.active {
  background: var(--neon-cyan);
  color: #000;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

.game-wrapper.mines-game {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  transition: max-width 0.25s ease;
}

.game-wrapper.mines-game.mode-medium {
  max-width: 620px;
}

.game-wrapper.mines-game.mode-expert,
.game-wrapper.mines-game.mode-ultra {
  max-width: 860px;
}

.mines-diff-bar {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.mines-diff-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mines-diff-btn:hover {
  border-color: var(--neon-cyan);
  color: #fff;
}

.mines-diff-btn.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
}

.mines-board-wrap {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  padding: 0.5rem 0.25rem;
}

.mines-board {
  display: grid;
  gap: 4px;
  background: #0f172a;
  padding: 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin: 0 auto;
  user-select: none;
}

.mines-board.diff-easy {
  gap: 4px;
}
.mines-board.diff-easy .mine-cell {
  width: 38px;
  height: 38px;
  font-size: 1.15rem;
}

.mines-board.diff-medium {
  gap: 3px;
}
.mines-board.diff-medium .mine-cell {
  width: 29px;
  height: 29px;
  font-size: 0.95rem;
}

.mines-board.diff-expert,
.mines-board.diff-ultra {
  gap: 2px;
}
.mines-board.diff-expert .mine-cell,
.mines-board.diff-ultra .mine-cell {
  width: 24px;
  height: 24px;
  font-size: 0.85rem;
}

.mine-cell {
  width: 36px;
  height: 36px;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  padding: 0;
  transition: background 0.1s ease;
}

.mine-cell:hover:not(.revealed) { background: #475569; }
.mine-cell.revealed { background: #0b1324; border-color: rgba(255, 255, 255, 0.05); cursor: default; }
.mine-cell.exploded { background: #dc2626 !important; }
.mine-cell.mine { background: #7f1d1d; }

.mine-cell.num-1 { color: #38bdf8; }
.mine-cell.num-2 { color: #4ade80; }
.mine-cell.num-3 { color: #f87171; }
.mine-cell.num-4 { color: #c084fc; }
.mine-cell.num-5 { color: #fbbf24; }
.mine-cell.num-6 { color: #2dd4bf; }
.mine-cell.num-7 { color: #f43f5e; }
.mine-cell.num-8 { color: #94a3b8; }

.mines-face-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.15s ease;
}

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

.mines-sound-btn {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mines-sound-btn:hover {
  border-color: var(--neon-cyan);
}

.mine-cell.flagged {
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.4));
}

.mine-cell.wrong-flag {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #ef4444;
  font-weight: 900;
}

.mine-cell.chord-highlight {
  background: #64748b !important;
  transform: scale(0.92);
  transition: transform 0.1s ease;
}

@keyframes boardShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.mines-board.shake {
  animation: boardShake 0.4s ease-in-out;
}

.mines-tip {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}

.mines-win-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 15, 28, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  animation: fadeIn 0.3s ease;
  padding: 1rem;
  border-radius: var(--radius-lg);
}

.mines-win-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.25), 0 20px 40px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.mines-win-card.loss-card {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 35px rgba(239, 68, 68, 0.25), 0 20px 40px rgba(0, 0, 0, 0.6);
}

/* Reaction Lab styles */
.reaction-pad {
  min-height: 280px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.reaction-pad.state-idle { background: #0f172a; border: 2px dashed var(--border-glow); }
.reaction-pad.state-waiting { background: #881337; border: 2px solid var(--neon-pink); }
.reaction-pad.state-green { background: #047857; border: 2px solid #10b981; box-shadow: 0 0 40px #10b981; }
.reaction-pad.state-result { background: #1e1b4b; border: 2px solid var(--neon-purple); }
.reaction-pad.state-false { background: #7f1d1d; border: 2px solid #ef4444; }

.reak-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }
.reak-title { font-size: 1.6rem; font-weight: 800; color: #fff; margin-bottom: 0.5rem; }
.reak-desc { font-size: 0.95rem; color: var(--text-muted); max-width: 360px; }

.reaction-history {
  display: flex;
  gap: 0.4rem;
}

.reak-dot {
  background: #1e293b;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

/* Cosmic Dodger canvas */
.canvas-wrap {
  position: relative;
  display: flex;
  justify-content: center;
}

#cosmicCanvas {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glow);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.2);
  touch-action: none;
  max-width: 100%;
  height: auto;
}

/* ==============================================================================
   7. LEADERBOARD & USER ACCOUNT MODAL
   ============================================================================== */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(4, 7, 15, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.3);
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-tab-btn {
  flex: 1;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
}

.auth-tab-btn.active {
  background: var(--neon-purple);
  color: #fff;
  border-color: var(--neon-purple);
}

.auth-field {
  margin-bottom: 1.25rem;
}

.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.auth-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.auth-input:focus {
  border-color: var(--neon-cyan);
  outline: none;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.avatar-selector {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.avatar-opt {
  width: 42px;
  height: 42px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.avatar-opt.active {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan);
}

/* Leaderboards section */
.leaderboard-section {
  padding: 3rem 0;
  background: rgba(15, 23, 42, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-head {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: #fff;
}

.leaderboard-table-wrap {
  max-width: 940px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lb-period-btn, .lb-userlimit-btn {
  padding: 0.42rem 0.82rem;
  font-size: 0.82rem;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.lb-table th {
  background: rgba(15, 23, 42, 0.9);
  padding: 0.9rem 1rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lb-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  vertical-align: middle;
}

.lb-rank {
  white-space: nowrap !important;
  width: 1%;
  font-weight: 900;
  color: var(--neon-cyan);
}
.lb-rank.gold { color: #f59e0b; }
.lb-rank.silver { color: #cbd5e1; }
.lb-rank.bronze { color: #d97706; }

.lb-player-cell {
  min-width: 0;
}

.lb-player {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.lb-avatar {
  flex-shrink: 0;
}

.lb-player-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.lb-player-name {
  font-weight: 700;
  color: #fff;
  word-break: break-word;
}

.lb-game-cell {
  min-width: 0;
}

.lb-game-title {
  font-weight: 700;
  color: #fff;
}

.lb-score {
  white-space: nowrap;
  width: 1%;
  font-weight: 800;
  color: var(--neon-green);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 1.02rem;
}

/* ==============================================================================
   8. FOOTER
   ============================================================================== */
.site-footer {
  margin-top: auto;
  padding: 3rem 0 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #050811;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-copy { max-width: 500px; line-height: 1.6; }

/* Sudoku Mestari styles */
.sudoku-diff-selector {
  display: flex;
  gap: 0.35rem;
}

.btn-diff {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-diff.active {
  background: var(--neon-purple);
  color: #fff;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}

.sudoku-board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 1rem 0 1.25rem;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 42px);
  gap: 1px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid var(--neon-cyan);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.15);
}

.sudoku-cell {
  width: 42px;
  height: 42px;
  background: #0f172a;
  color: var(--neon-cyan);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.sudoku-cell.clue {
  background: #1e293b;
  color: #ffffff;
  font-weight: 900;
}

.sudoku-cell.selected {
  background: rgba(0, 240, 255, 0.35) !important;
  color: #ffffff !important;
}

.sudoku-cell.highlighted {
  background: rgba(124, 58, 237, 0.3);
}

.sudoku-cell.conflict {
  background: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
}

.sudoku-cell.border-bottom-thick {
  border-bottom: 2px solid var(--neon-cyan) !important;
}

.sudoku-cell.border-right-thick {
  border-right: 2px solid var(--neon-cyan) !important;
}

.sudoku-numpad {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.num-btn {
  width: 42px;
  height: 46px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.num-btn:hover {
  background: #334155;
  border-color: var(--neon-cyan);
}

.num-erase {
  background: #334155;
  color: var(--neon-pink);
  font-size: 1rem;
}

.sudoku-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 19, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  z-index: 10;
}

/* ==============================================================================
   HTML5 CANVAS: MAHJONG KLASSIKKO & KYTKYMAHJONG
   ============================================================================== */
.mahjong-canvas-viewport, .kytky-canvas-viewport, .pasianssi-canvas-viewport, .klondike-canvas-viewport {
  position: relative;
  width: 100%;
  max-width: 780px;
  margin: 1rem auto;
  background: #070f1c;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.pasianssi-canvas-viewport, .klondike-canvas-viewport {
  max-width: 800px;
  background: radial-gradient(circle at 50% 25%, #0d5c36 0%, #06341d 75%, #042113 100%);
  border: 2px solid #15803d;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.75), 0 10px 30px rgba(0, 0, 0, 0.6);
}

.klondike-canvas-viewport {
  background: radial-gradient(circle at 50% 25%, #143e2d 0%, #0a271c 75%, #03150e 100%);
  border: 2px solid #0f766e;
}

.mahjong-canvas, .kytky-canvas, .pasianssi-canvas, .klondike-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.pasianssi-canvas, .klondike-canvas {
  cursor: grab;
}

.pasianssi-canvas:active, .klondike-canvas:active {
  cursor: grabbing;
}

.mahjong-toast, .kytky-toast, .spot-toast {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  border: 1px solid var(--neon-cyan);
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mahjong-toast.show, .kytky-toast.show, .spot-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.combo-pill {
  border-color: var(--neon-pink) !important;
  color: var(--neon-pink) !important;
}

.mahjong-win-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  animation: fadeIn 0.3s ease;
  padding: 1rem;
}

.mahjong-win-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 0 35px rgba(245, 158, 11, 0.25), 0 20px 40px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.win-trophy {
  font-size: 3.2rem;
  line-height: 1;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.6));
}

.win-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.35rem 0;
  letter-spacing: -0.02em;
}

.win-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 1.25rem 0;
}

.win-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.35rem;
  text-align: left;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.win-stats-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.win-stats-grid span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.win-stats-grid strong {
  font-size: 1.15rem;
  color: var(--neon-cyan);
  font-weight: 700;
}

.mahjong-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1.25rem;
  width: 100%;
}

@media (min-width: 440px) {
  .mahjong-prompt-actions {
    flex-direction: row;
    justify-content: center;
  }
  .mahjong-prompt-actions .btn,
  .mahjong-prompt-actions .btn-primary-glow {
    flex: 1;
  }
}

.game-controls-bar .btn:disabled,
.game-controls-bar .btn.disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(0.5);
}

/* ==============================================================================
   HTML5 CANVAS: ETSI EROAVAISUUDET (Spot the Differences)
   ============================================================================== */
.spot-title-badge {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: rgba(124, 58, 237, 0.35);
  border: 1px solid rgba(167, 139, 250, 0.4);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
}

.spot-random-badge {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--neon-amber);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.spot-scene-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.spot-desc-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.spot-actions-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.spot-stars-row {
  display: flex;
  gap: 0.2rem;
  align-items: center;
}

.spot-diff-star {
  font-size: 0.95rem;
  filter: grayscale(1);
  opacity: 0.25;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-block;
}

.spot-diff-star.found {
  filter: grayscale(0) drop-shadow(0 0 8px rgba(250, 204, 21, 0.8));
  opacity: 1;
  transform: scale(1.2);
  animation: starPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes starPop {
  0% { transform: scale(0.5); opacity: 0.3; }
  60% { transform: scale(1.35); }
  100% { transform: scale(1.2); opacity: 1; }
}

.spot-canvas-viewport {
  display: flex;
  gap: 1.25rem;
  width: 100%;
  max-width: 1040px;
  margin: 1rem auto;
  align-items: stretch;
}

.spot-canvas-box {
  flex: 1;
  background: #090e1a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.spot-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.spot-box-badge {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--neon-cyan);
  letter-spacing: 0.5px;
}

.spot-box-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.spot-canvas-container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.spot-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  cursor: crosshair;
  user-select: none;
  touch-action: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  background: #050811;
}

.spot-loader-spinner {
  position: absolute;
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spotSpin 0.8s linear infinite;
}

@keyframes spotSpin {
  to { transform: rotate(360deg); }
}

/* Modals & Dialogs */
.spot-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.spot-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.spot-clear-card {
  position: relative;
  background: linear-gradient(135deg, #111827 0%, #0d121f 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  padding: 2.25rem 1.75rem 1.75rem;
  max-width: 520px;
  width: 100%;
  text-align: center;
  animation: cardPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

.card-close-btn,
.spot-card-close-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-muted);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  z-index: 20;
}

.card-close-btn:hover,
.spot-card-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ff6b6b;
  transform: rotate(90deg);
}

.spot-selector-card {
  position: relative;
  background: linear-gradient(135deg, #111827 0%, #0d121f 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
  padding: 1.75rem;
  max-width: 820px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  text-align: left;
  animation: cardPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
}

@keyframes cardPop {
  0% { transform: scale(0.9) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

.spot-clear-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.spot-clear-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.25rem;
}

.spot-clear-subtitle {
  font-size: 0.9rem;
  color: var(--neon-cyan);
  margin-bottom: 1.25rem;
}

.spot-clear-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.spot-clear-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.spot-clear-stat .sc-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.spot-clear-stat .sc-val {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.spot-clear-stat .sc-val.highlight {
  color: var(--neon-amber);
}

.spot-clear-actions,
.card-actions-row {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), #0284c7);
  color: #04070f;
  font-weight: 800;
  border: none;
  padding: 0.75rem 1.35rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.35);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.6);
  color: #000;
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  font-weight: 600;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
  transform: translateY(-2px);
}

.btn-danger-subtle {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-weight: 600;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.92rem;
}

.btn-danger-subtle:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
  transform: translateY(-2px);
}

/* Level Selector Grid */
.spot-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.spot-selector-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.spot-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.spot-close-btn:hover {
  color: #fff;
}

.spot-selector-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.spot-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.85rem;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.spot-lvl-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.spot-lvl-card:hover {
  transform: translateY(-3px);
  border-color: var(--neon-cyan);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.spot-lvl-card.active {
  border-color: var(--neon-purple);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.4);
}

.spot-lvl-card.done {
  border-color: rgba(34, 197, 94, 0.5);
}

.spot-lvl-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #020617;
}

.spot-lvl-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.spot-lvl-card:hover .spot-lvl-thumb {
  transform: scale(1.06);
}

.spot-lvl-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.spot-lvl-done-icon {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: #10b981;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.spot-lvl-info {
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.spot-lvl-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-lvl-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.spot-lvl-card.done .spot-lvl-status {
  color: #34d399;
}

/* ==============================================================================
   SANAHAKU (Finnish Word Search)
   ============================================================================== */
.sanahaku-main-layout {
  display: flex;
  gap: 1.5rem;
  max-width: 820px;
  margin: 1.25rem auto;
  align-items: flex-start;
}

.sh-cat-selector {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sh-cat-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.sh-select {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
}

.sh-select:focus {
  border-color: var(--neon-cyan);
}

.sh-grid-viewport {
  flex: 1;
  background: #090e1a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  user-select: none;
  touch-action: none;
}

.sh-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-size, 10), 1fr);
  gap: 3px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.sh-cell {
  aspect-ratio: 1 / 1;
  background: #131c31;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #f1f5f9;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.sh-cell:hover {
  background: #1e2d4d;
}

.sh-cell.temp-selected {
  background: var(--neon-cyan) !important;
  color: #060913 !important;
  box-shadow: 0 0 10px var(--neon-cyan);
  transform: scale(1.08);
  font-weight: 900;
}

.sh-cell.locked-found {
  color: #ffffff !important;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.sh-cell.hint-pulse {
  animation: tileHintGlow 0.8s infinite alternate ease-in-out;
  outline: 2px solid #facc15;
}

.sh-words-panel {
  width: 220px;
  background: #090e1a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.sh-words-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--neon-cyan);
  margin-bottom: 0.75rem;
}

.sh-word-tags {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.sh-word-tag {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.sh-word-tag.found {
  background: rgba(34, 197, 94, 0.15);
  border-color: #22c55e;
  color: #86efac;
  text-decoration: line-through;
  opacity: 0.75;
}

.sh-tag-icon {
  font-weight: 900;
  color: var(--neon-cyan);
}

.sh-word-tag.found .sh-tag-icon {
  color: #22c55e;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner { height: 64px; }
  .nav-links { display: none; }
  .wordle-tile { width: 44px; height: 44px; font-size: 1.5rem; }
  .kbd-btn { height: 40px; min-width: 27px; font-size: 0.85rem; padding: 0 0.25rem; }
  .kbd-wide { min-width: 44px; font-size: 0.72rem; }
  .g2048-board { grid-template-columns: repeat(4, 60px); }
  .g2048-cell { height: 60px; font-size: 1.2rem; }
  .grid-3 { grid-template-columns: repeat(3, 72px); }
  .mem-tile { height: 72px; }
  .sudoku-board { grid-template-columns: repeat(9, 36px); }
  .sudoku-cell { width: 36px; height: 36px; font-size: 1.05rem; }
  .num-btn { width: 32px; height: 40px; font-size: 1.1rem; }

  /* Spot canvas mobile */
  .spot-canvas-viewport { flex-direction: column; gap: 0.75rem; }

  /* Sanahaku mobile */
  .sanahaku-main-layout { flex-direction: column; }
  .sh-words-panel { width: 100%; box-sizing: border-box; }
  .sh-word-tags { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.35rem; }
  .sh-cell { font-size: 1.05rem; }
}

/* ==========================================================================
   Favorites & Card Enhancements
   ========================================================================== */
.game-card {
  position: relative;
}

.game-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0;
  line-height: 1;
}

.game-fav-btn:hover {
  transform: scale(1.15);
  border-color: #facc15;
  color: #facc15;
  background: rgba(15, 23, 42, 0.95);
}

.game-fav-btn.active {
  background: rgba(250, 204, 21, 0.2);
  border-color: #facc15;
  color: #facc15;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.45);
  transform: scale(1.08);
}

.game-card.is-favorite {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 4px 22px rgba(250, 204, 21, 0.14);
}

.empty-fav-state {
  grid-column: 1 / -1;
  text-align: center;
  background: #0f172a;
  border: 1px dashed rgba(250, 204, 21, 0.4);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  max-width: 540px;
  margin: 1.5rem auto;
}

.empty-fav-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.5));
}

.empty-fav-state h3 {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
}

.empty-fav-state p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
}

/* ==========================================================================
   Spotlight / Uutuusesittely Showcase
   ========================================================================== */
.spotlight-showcase {
  margin-bottom: 2rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(10, 15, 28, 0.98));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.spotlight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.spotlight-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.spotlight-fire {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
}

.spotlight-heading {
  font-size: 1.18rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  letter-spacing: -0.01em;
}

.spotlight-badge {
  background: rgba(236, 72, 153, 0.18);
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.spotlight-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.spotlight-card:hover {
  transform: translateY(-3px);
  background: rgba(30, 41, 59, 0.85);
}

.spotlight-card.featured-glow-gold:hover {
  border-color: #facc15;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.25);
}

.spotlight-card.featured-glow-cyan:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
}

.spotlight-card.featured-glow-purple:hover {
  border-color: var(--neon-purple);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
}

.spotlight-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 0.02em;
}

.spotlight-card-icon {
  font-size: 2.3rem;
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.spotlight-card-content {
  flex: 1;
  min-width: 0;
}

.spotlight-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.3rem 0;
}

.spotlight-card-desc {
  font-size: 0.79rem;
  color: var(--text-dim);
  margin: 0 0 0.65rem 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.spotlight-play-btn {
  background: var(--neon-cyan);
  color: #000;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.spotlight-play-btn:hover {
  transform: scale(1.05);
  background: #38bdf8;
}

/* ==========================================================================
   Pre-roll Ad / Sponsor Showcase
   ========================================================================== */
.preroll-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.25rem 1.75rem;
  text-align: center;
  animation: fadeIn 0.3s ease;
  max-width: 480px;
  margin: 2rem auto;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.2);
}

.preroll-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--neon-cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 240, 255, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 1rem;
}

.preroll-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.4));
}

.preroll-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 0.5rem 0;
}

.preroll-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem 0;
  line-height: 1.55;
}

.preroll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.preroll-timer {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.preroll-timer strong {
  color: var(--neon-cyan);
}

.preroll-skip-btn {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

/* ==========================================================================
   Leaderboard Metadata & Difficulty Badges
   ========================================================================== */
.lb-meta-tag {
  display: inline-block;
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.lb-meta-tag.diff-badge-expert {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.lb-meta-tag.diff-badge-ultra {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.45);
  color: #d8b4fe;
}

.lb-meta-tag.diff-badge-medium {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.lb-meta-tag.diff-badge-easy {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

/* ==========================================================================
   Kulta-Pajatso Styles
   ========================================================================== */
.pajatso-game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
  user-select: none;
}

.pajatso-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: rgba(15, 23, 42, 0.75);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
  box-sizing: border-box;
}

.pajatso-stats-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pajatso-bank-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #fef08a;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
}

.pajatso-bank-pill strong {
  font-size: 1.05rem;
  color: #fbbf24;
}

.pajatso-streak-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

.pajatso-streak-pill.streak-hot {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.3), rgba(245, 158, 11, 0.3));
  border-color: #f59e0b;
  color: #fef08a;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
  animation: pulse-hot 1s infinite alternate;
}

@keyframes pulse-hot {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.pajatso-score-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.pj-score-title {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

.pajatso-score-box strong {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.pajatso-btn-mute {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.pajatso-btn-mute:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* 7 Gates Checklist Indicators */
.pajatso-gates-tracker {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
}

.pj-gate-badge {
  flex: 1;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.1rem;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #64748b;
  transition: all 0.25s ease;
}

.pj-gate-badge.pj-gate-jackpot {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.3);
}

.pj-gate-badge.gate-cleared {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #34d399;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.pj-gate-badge.pj-gate-jackpot.gate-cleared {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
  color: #fde047;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.pj-gate-badge.pj-gate-ressu {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 800;
}

.pj-gate-badge.pj-gate-ressu.ressu-full {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #fef08a;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.8), 0 0 6px #facc15;
  animation: ressuPulse 1s ease-in-out infinite alternate;
}

@keyframes ressuPulse {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.06); filter: brightness(1.25); box-shadow: 0 0 18px rgba(245, 158, 11, 0.9); }
}

/* Canvas & Container */
.pajatso-canvas-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(234, 179, 8, 0.15);
  border: 2px solid rgba(202, 138, 4, 0.35);
  background: #000;
}

#pjCanvas {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  aspect-ratio: 480 / 640;
  touch-action: none;
}

/* Game Over Overlay */
.pajatso-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 1.25rem;
  box-sizing: border-box;
}

.pajatso-over-card {
  position: relative;
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.25);
  animation: over-fade-in 0.35s ease;
}

@keyframes over-fade-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.pj-over-icon {
  font-size: 3.2rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.5));
}

.pajatso-over-card h3 {
  font-size: 1.5rem;
  color: #fff;
  margin: 0 0 0.4rem 0;
  font-weight: 800;
}

.pj-rank-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.8rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fde047;
  margin-bottom: 1rem;
}

.pj-final-score-block {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.pj-final-score-block span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.pj-final-score-block strong {
  font-size: 2rem;
  color: #38bdf8;
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
  font-weight: 900;
}

.pj-over-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pj-over-stat {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pj-over-stat span {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.pj-over-stat strong {
  font-size: 0.95rem;
  color: #fff;
}

/* Controls Bar */
.pajatso-controls-bar {
  width: 100%;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pj-charge-meter-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.7);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pj-meter-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.pj-meter-track {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.pj-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 60%, #ef4444 100%);
  border-radius: var(--radius-full);
  transition: width 0.04s linear;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.pj-action-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-pajatso-strike {
  flex: 1;
  background: linear-gradient(135deg, #eab308, #ca8a04);
  color: #000;
  border: none;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 6px 18px rgba(234, 179, 8, 0.35);
  transition: all 0.15s ease;
  user-select: none;
}

.btn-pajatso-strike:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(234, 179, 8, 0.5);
  filter: brightness(1.1);
}

.btn-pajatso-strike:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.4);
}

.pj-hint-row {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ==========================================================================
   MOBILE PORTRAIT & SMALL SCREENS (Zero Horizontal Overflow & Fullscreen Modal)
   ========================================================================== */
@media (max-width: 768px) {
  .game-modal {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #04070f;
  }

  .container {
    padding: 0 0.85rem;
  }

  .category-tabs {
    gap: 0.4rem;
  }

  .cat-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .header-inner {
    height: 58px;
    gap: 0.5rem;
  }

  .brand-link {
    min-width: 0;
    flex-shrink: 1;
  }

  .brand-logo-img {
    height: 36px;
    max-width: 50vw;
  }

  .header-right {
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .user-badge {
    padding: 0.3rem 0.6rem;
    gap: 0.35rem;
    max-width: 44vw;
  }

  .user-avatar {
    font-size: 1rem;
  }

  .user-name {
    font-size: 0.8rem;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .user-level {
    font-size: 0.66rem;
    padding: 0.1rem 0.38rem;
  }

  .hub-title-block {
    min-width: 0;
    width: 100%;
  }

  .hub-search-wrap {
    max-width: 100%;
  }

  .spotlight-showcase {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .spotlight-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 1.15rem;
    margin-bottom: 2.5rem;
  }

  .leaderboard-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lb-table th,
  .lb-table td {
    padding: 0.65rem 0.65rem;
    font-size: 0.84rem;
  }
}

@media (max-width: 640px) {
  /* Full-bleed Game Modal on mobile phones so games get 100% width and height */
  .game-modal {
    padding: 0;
  }

  .game-modal-dialog {
    max-width: 100vw;
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .game-modal-header {
    padding: 0.55rem 0.85rem;
    min-height: 46px;
    flex-shrink: 0;
  }

  .modal-game-icon {
    font-size: 1.3rem;
  }

  .modal-game-title {
    font-size: 1.02rem;
  }

  .modal-close-btn {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .game-stage-container {
    padding: 0.5rem 0.65rem;
    align-items: flex-start;
  }

  .game-top-bar {
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* Wordle / Sanakeidas 11-key Finnish keyboard fit on narrow phones */
  .virtual-keyboard {
    width: 100%;
  }

  .kbd-row {
    width: 100%;
    justify-content: center;
    gap: 0.2rem;
  }

  .kbd-btn {
    flex: 1;
    min-width: 0;
    max-width: 34px;
    height: 42px;
    padding: 0;
    font-size: 0.82rem;
  }

  .kbd-wide {
    flex: 1.5;
    max-width: 52px;
    font-size: 0.68rem;
  }

  /* Minesweeper easy board fit on 360px-390px screens */
  .mines-board.diff-easy .mine-cell {
    width: 33px;
    height: 33px;
    font-size: 1rem;
  }

  /* Pajatso Portrait Mobile Optimization: fit machine + controls on screen at once */
  .pajatso-top-bar {
    padding: 0.35rem 0.55rem;
    margin-bottom: 0.3rem;
  }

  .pajatso-bank-pill,
  .pajatso-streak-pill {
    padding: 0.22rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .pajatso-bank-pill strong {
    font-size: 0.85rem;
  }

  .pajatso-score-box strong {
    font-size: 1rem;
  }

  .pajatso-gates-tracker {
    gap: 0.15rem;
    margin-bottom: 0.3rem;
  }

  .pj-gate-badge {
    font-size: 0.58rem;
    padding: 0.16rem 0.05rem;
    white-space: nowrap;
  }

  .pajatso-canvas-container {
    height: calc(100dvh - 236px);
    max-height: 460px;
    width: auto;
    max-width: 100%;
    aspect-ratio: 480 / 640;
    margin: 0 auto;
  }

  #pjCanvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
  }

  .pajatso-controls-bar {
    margin-top: 0.35rem;
    gap: 0.3rem;
  }

  .pj-charge-meter-wrap {
    padding: 0.3rem 0.6rem;
  }

  .btn-pajatso-strike {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }

  .pj-hint-row {
    display: none;
  }

  /* Leaderboard compact mobile layout */
  .leaderboard-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lb-table th,
  .lb-table td {
    padding: 0.55rem 0.5rem;
    font-size: 0.82rem;
  }

  .lb-player {
    gap: 0.4rem;
  }

  .lb-player-info {
    gap: 0.2rem;
    flex-wrap: wrap;
  }

  .lb-player-name {
    font-size: 0.82rem;
  }

  .lb-level-badge {
    font-size: 0.62rem;
    padding: 0.1rem 0.35rem;
  }

  .lb-meta-tag {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
  }

  .lb-score {
    font-size: 0.92rem;
    white-space: nowrap;
    text-align: right;
  }
}

/* Dark theme scrollbars for game stage */
.game-stage-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 58, 237, 0.4) rgba(6, 9, 19, 0.95);
}

/* ==========================================================================
   WINDOWS SCALING / COMPACT VERTICAL VIEWPORT (125% / 150% / 175% DPI Zoom)
   ========================================================================== */
@media (max-height: 860px) {
  .game-modal {
    padding: 0.35rem;
  }

  .game-modal-dialog {
    max-height: 98dvh;
  }

  .game-modal-header {
    padding: 0.45rem 1rem;
    min-height: 44px;
    flex-shrink: 0;
  }

  .game-stage-container {
    padding: 0.5rem 0.85rem;
  }

  .game-top-bar {
    margin-bottom: 0.5rem;
  }

  /* Canvas games */
  .mahjong-canvas-viewport,
  .kytky-canvas-viewport,
  .pasianssi-canvas-viewport,
  .klondike-canvas-viewport {
    margin: 0.25rem auto;
    max-height: calc(100dvh - 125px);
  }

  .mahjong-canvas,
  .kytky-canvas,
  .pasianssi-canvas,
  .klondike-canvas,
  #cosmicCanvas,
  .spot-canvas {
    max-height: calc(100dvh - 130px);
    width: auto !important;
    max-width: 100%;
    margin: 0 auto;
  }
}

@media (max-height: 820px) {
  .wordle-board {
    gap: 0.3rem;
    margin-bottom: 0.65rem;
  }

  .wordle-row {
    gap: 0.3rem;
  }

  .wordle-tile {
    width: clamp(36px, 5.5dvh, 48px);
    height: clamp(36px, 5.5dvh, 48px);
    font-size: clamp(1.2rem, 2.5dvh, 1.6rem);
  }

  .kbd-btn {
    height: clamp(34px, 5dvh, 42px);
  }

  .sudoku-board {
    grid-template-columns: repeat(9, clamp(30px, 4.8dvh, 40px));
  }

  .sudoku-cell {
    width: clamp(30px, 4.8dvh, 40px);
    height: clamp(30px, 4.8dvh, 40px);
    font-size: clamp(0.95rem, 2.2dvh, 1.2rem);
  }

  .sudoku-numpad {
    margin-top: 0.5rem;
  }

  .num-btn {
    height: clamp(34px, 5dvh, 44px);
    width: clamp(34px, 5dvh, 42px);
  }

  .g2048-board {
    grid-template-columns: repeat(4, clamp(50px, 8.5dvh, 68px));
    gap: 0.45rem;
    padding: 0.45rem;
  }

  .g2048-cell {
    height: clamp(50px, 8.5dvh, 68px);
    font-size: 1.25rem;
  }

  .sh-grid {
    max-height: calc(100dvh - 140px);
    width: auto;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
  }
}

/* Pajatso Side-by-Side 2-Column Layout for Windows Scaling Laptops */
@media (min-width: 641px) and (max-height: 880px) {
  .pajatso-game-wrapper {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 0.85rem;
    row-gap: 0.35rem;
    max-width: 820px;
    width: 100%;
    align-items: start;
    justify-content: center;
  }

  .pajatso-canvas-container {
    grid-column: 1;
    grid-row: 1 / 4;
    height: clamp(320px, calc(100dvh - 96px), 620px);
    max-height: calc(100dvh - 96px);
    width: auto;
    max-width: none;
    aspect-ratio: 480 / 640;
    margin: 0;
  }

  #pjCanvas {
    height: 100% !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
  }

  .pajatso-top-bar {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 0;
    padding: 0.35rem 0.65rem;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  .pajatso-bank-pill,
  .pajatso-streak-pill {
    white-space: nowrap;
  }

  .pajatso-gates-tracker {
    grid-column: 2;
    grid-row: 2;
    margin-bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.22rem;
  }

  .pj-gate-badge {
    font-size: 0.62rem;
    padding: 0.2rem 0.15rem;
  }

  .pajatso-controls-bar {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
    align-self: end;
    gap: 0.35rem;
  }

  .btn-pajatso-strike {
    padding: 0.65rem 0.85rem;
    font-size: 0.92rem;
  }

  .pj-hint-row {
    font-size: 0.68rem;
    line-height: 1.25;
  }
}

/* ==========================================================================
   MOBILE LANDSCAPE MODE (Phone turned sideways: wide width, short height)
   ========================================================================== */
@media (orientation: landscape) and (max-height: 580px) {
  .site-header .header-inner {
    height: 48px;
  }

  .brand-logo-img {
    height: 30px;
  }

  .hero-section {
    padding: 1rem 0 0.75rem;
  }

  /* Fullscreen Modal with ultra-slim header in landscape */
  .game-modal {
    padding: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #04070f;
  }

  .game-modal-dialog {
    max-width: 100vw;
    width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }

  .game-modal-header {
    padding: 0.25rem 0.85rem;
    min-height: 36px;
    flex-shrink: 0;
  }

  .modal-game-icon {
    font-size: 1.15rem;
  }

  .modal-game-title {
    font-size: 0.95rem;
  }

  .modal-close-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }

  .game-stage-container {
    padding: 0.3rem 0.75rem;
    align-items: flex-start;
  }

  .game-top-bar {
    margin-bottom: 0.35rem;
  }

  /* Pajatso Side-by-Side 2-Column Landscape Layout */
  .pajatso-game-wrapper {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 0.85rem;
    row-gap: 0.3rem;
    max-width: 760px;
    width: 100%;
    align-items: start;
    justify-content: center;
  }

  .pajatso-canvas-container {
    grid-column: 1;
    grid-row: 1 / 4;
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    width: auto;
    max-width: none;
    aspect-ratio: 480 / 640;
    margin: 0;
  }

  #pjCanvas {
    height: 100% !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
  }

  .pajatso-top-bar {
    grid-column: 2;
    grid-row: 1;
    margin-bottom: 0;
    padding: 0.35rem 0.6rem;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  .pajatso-bank-pill,
  .pajatso-streak-pill {
    white-space: nowrap;
  }

  .pajatso-gates-tracker {
    grid-column: 2;
    grid-row: 2;
    margin-bottom: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.22rem;
  }

  .pj-gate-badge {
    font-size: 0.62rem;
    padding: 0.2rem 0.15rem;
  }

  .pajatso-controls-bar {
    grid-column: 2;
    grid-row: 3;
    margin-top: 0;
    align-self: end;
    gap: 0.35rem;
  }

  .btn-pajatso-strike {
    padding: 0.65rem 0.85rem;
    font-size: 0.92rem;
  }

  .pj-hint-row {
    font-size: 0.65rem;
    line-height: 1.2;
  }

  /* Other Canvas Games in Landscape */
  .mahjong-canvas-viewport,
  .kytky-canvas-viewport,
  .pasianssi-canvas-viewport,
  .klondike-canvas-viewport {
    margin: 0.25rem auto;
    max-height: calc(100dvh - 88px);
  }

  .mahjong-canvas,
  .kytky-canvas,
  .pasianssi-canvas,
  .klondike-canvas,
  #cosmicCanvas {
    max-height: calc(100dvh - 92px);
    width: auto !important;
    max-width: 100%;
    margin: 0 auto;
  }

  /* Etsi eroavaisuudet side-by-side in landscape */
  .spot-canvas-viewport {
    flex-direction: row !important;
    gap: 0.6rem;
    margin: 0.25rem auto;
  }

  .spot-canvas-box {
    padding: 0.4rem;
  }

  .spot-canvas {
    max-height: calc(100dvh - 115px);
    width: auto;
    max-width: 100%;
  }

  /* Sanahaku side-by-side in landscape */
  .sanahaku-main-layout {
    flex-direction: row !important;
    gap: 0.85rem;
    margin: 0.25rem auto;
    align-items: stretch;
  }

  .sh-grid-viewport {
    padding: 0.45rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .sh-grid {
    max-height: calc(100dvh - 105px);
    width: auto;
    aspect-ratio: 1 / 1;
  }

  .sh-words-panel {
    width: 210px;
    padding: 0.6rem;
    overflow-y: auto;
    max-height: calc(100dvh - 90px);
  }

  /* 2048 & Memory Matrix compact in landscape */
  .g2048-board {
    grid-template-columns: repeat(4, 48px);
    gap: 0.4rem;
    padding: 0.4rem;
  }

  .g2048-cell {
    height: 48px;
    font-size: 1.05rem;
  }

  .memory-grid-wrap {
    margin: 0.4rem 0;
  }

  .grid-3 { grid-template-columns: repeat(3, 54px); }
  .grid-3 .mem-tile { height: 54px; }
  .grid-4 { grid-template-columns: repeat(4, 44px); }
  .grid-4 .mem-tile { height: 44px; }
  .grid-5 { grid-template-columns: repeat(5, 36px); }
  .grid-5 .mem-tile { height: 36px; }
}

/* ==============================================================================
   YATZY MESTARI - SUOMIKLASSIKKO (Pohjoismainen Yatzy)
   ============================================================================== */
.yatzy-container {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  color: var(--text-main);
  user-select: none;
}

/* Top bar */
.yatzy-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.75rem;
}

.yatzy-mode-toggle {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-full);
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.yatzy-mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.yatzy-mode-btn.active {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4);
}

.yatzy-top-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.yatzy-turn-pill {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(0, 240, 255, 0.25);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.yatzy-score-pill {
  color: #fff;
}

.yatzy-score-pill strong {
  color: var(--neon-amber);
  font-size: 0.98rem;
}

.yatzy-top-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.yatzy-icon-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.yatzy-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--neon-cyan);
}

/* Dice play area */
.yatzy-dice-section {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

.yatzy-dice-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.yatzy-die-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

/* Die styling */
.yatzy-die {
  width: 50px;
  height: 50px;
  background: linear-gradient(145deg, #ffffff, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  border: 2px solid #cbd5e1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 5px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.yatzy-die:hover:not(.held):not(.rolling) {
  transform: translateY(-2px);
  border-color: var(--neon-cyan);
  box-shadow: 0 6px 14px rgba(0, 240, 255, 0.35);
}

.yatzy-die.held {
  background: linear-gradient(145deg, #f0fdf4, #dcfce7);
  border: 2px solid var(--neon-green);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.6), inset 0 0 6px rgba(16, 185, 129, 0.3);
  transform: translateY(-3px);
}

.yatzy-die.rolling {
  animation: yatzyDieRoll 0.28s cubic-bezier(0.25, 1, 0.5, 1);
  cursor: wait;
}

@keyframes yatzyDieRoll {
  0%   { transform: rotate(0deg) scale(0.95); }
  25%  { transform: rotate(-16deg) scale(1.08); }
  50%  { transform: rotate(14deg) scale(0.96); }
  75%  { transform: rotate(-8deg) scale(1.04); }
  100% { transform: rotate(0deg) scale(1); }
}

.die-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #0f172a;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
  justify-self: center;
  align-self: center;
}

.yatzy-die.held .die-pip {
  background-color: #064e3b;
}

.pos-tl { grid-column: 1; grid-row: 1; }
.pos-tr { grid-column: 3; grid-row: 1; }
.pos-ml { grid-column: 1; grid-row: 2; }
.pos-c  { grid-column: 2; grid-row: 2; }
.pos-mr { grid-column: 3; grid-row: 2; }
.pos-bl { grid-column: 1; grid-row: 3; }
.pos-br { grid-column: 3; grid-row: 3; }

.yatzy-die-lock {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--neon-green);
  color: #064e3b;
  font-size: 0.65rem;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
  font-weight: 800;
}

.yatzy-die-sub {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: center;
}

.yatzy-die-sub.held {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.yatzy-die-sub:hover:not(:disabled) {
  border-color: var(--neon-cyan);
  color: #fff;
}

/* Roll action row */
.yatzy-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.yatzy-rolls-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.yatzy-roll-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.yatzy-roll-dot.active {
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  border-color: #fff;
}

.yatzy-rolls-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.yatzy-roll-main-btn {
  flex: 1;
  min-width: 180px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.yatzy-hint-text {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  width: 100%;
  min-height: 1.1rem;
  transition: color 0.2s ease;
}

.yatzy-hint-text.alert {
  color: var(--neon-amber);
  font-weight: 700;
}

/* Scorecard */
.yatzy-scorecard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  width: 100%;
}

.yatzy-scorecard-col {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.yatzy-col-header {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  padding: 0.2rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.yatzy-col-rows {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.yatzy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  min-height: 30px;
}

.yatzy-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  line-height: 1.15;
  overflow: hidden;
}

.yatzy-row-name {
  font-size: 0.81rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yatzy-row-desc {
  font-size: 0.66rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.yatzy-row-score {
  min-width: 36px;
  height: 23px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0 0.35rem;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

/* Scored row */
.yatzy-row.scored {
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(255, 255, 255, 0.04);
}

.yatzy-row.scored .yatzy-row-score {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Available row with roll ready */
.yatzy-row.clickable {
  cursor: pointer;
}

.yatzy-row.clickable:hover {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

.yatzy-row-score.preview-positive {
  background: rgba(16, 185, 129, 0.2);
  color: var(--neon-green);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.yatzy-row-score.preview-zero {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Forced row active */
.yatzy-row.active-forced {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
  background: rgba(0, 240, 255, 0.08);
}

.yatzy-row.disabled-forced {
  opacity: 0.45;
  cursor: not-allowed;
}

/* High value highlight */
.yatzy-row.highlight-special {
  animation: yatzySpecialGlow 1.2s infinite alternate;
  border-color: var(--neon-amber);
}

.yatzy-row.highlight-special .yatzy-row-score {
  background: rgba(245, 158, 11, 0.25);
  color: var(--neon-amber);
  border-color: var(--neon-amber);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

@keyframes yatzySpecialGlow {
  from { box-shadow: 0 0 4px rgba(245, 158, 11, 0.3); }
  to   { box-shadow: 0 0 14px rgba(245, 158, 11, 0.7); }
}

/* Subtotal & bonus rows */
.yatzy-row.summary-row {
  background: rgba(124, 58, 237, 0.12);
  border-top: 1px solid rgba(124, 58, 237, 0.3);
  margin-top: 0.1rem;
}

.yatzy-row.summary-row .yatzy-row-name {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.yatzy-row.summary-row .yatzy-row-score {
  background: rgba(124, 58, 237, 0.2);
  color: #fff;
  border-color: rgba(124, 58, 237, 0.4);
}

.yatzy-row.bonus-won {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

.yatzy-row.bonus-won .yatzy-row-score {
  background: rgba(16, 185, 129, 0.3);
  color: var(--neon-green);
  border-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Total bottom bar */
.yatzy-total-bar {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(0, 240, 255, 0.25));
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.yatzy-total-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
}

.yatzy-total-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

/* Modal overlay */
.yatzy-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 19, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn 0.25s ease;
}

.yatzy-win-card {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  position: relative;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
  .yatzy-container {
    gap: 0.4rem;
  }

  .yatzy-top-bar {
    padding: 0.3rem 0.55rem;
  }

  .yatzy-dice-section {
    padding: 0.5rem 0.55rem;
    gap: 0.4rem;
  }

  .yatzy-dice-row {
    gap: 0.35rem;
  }

  .yatzy-die {
    width: 44px;
    height: 44px;
    padding: 4px;
    border-radius: 8px;
  }

  .die-pip {
    width: 6.5px;
    height: 6.5px;
  }

  .yatzy-die-sub {
    font-size: 0.62rem;
    padding: 0.1rem 0.25rem;
  }

  .yatzy-roll-main-btn {
    font-size: 0.82rem;
    padding: 0.42rem 0.75rem;
    min-width: 150px;
  }

  .yatzy-scorecard-grid {
    gap: 0.35rem;
  }

  .yatzy-scorecard-col {
    padding: 0.3rem;
    gap: 0.18rem;
  }

  .yatzy-row {
    padding: 0.22rem 0.35rem;
    min-height: 27px;
  }

  .yatzy-row-name {
    font-size: 0.73rem;
  }

  .yatzy-row-desc {
    font-size: 0.58rem;
  }

  .yatzy-row-score {
    min-width: 30px;
    height: 20px;
    font-size: 0.75rem;
  }

  .yatzy-col-header {
    font-size: 0.66rem;
    padding: 0.15rem 0.3rem;
  }
}

