:root{
  --bg:#0f1220;
  --panel:#171a2b;
  --panel-2:#1e2338;
  --text:#e9ecf1;
  --muted:#aab3c8;
  --accent:#5da9ff;
  --win:#f7d35b;
  --gap:12px;
  --radius:18px;
  --tile-radius:14px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body{
  margin:0;
  padding:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 20% 0%, #1b2040 0%, #0d1122 60%, #070a16 100%);
  color:var(--text);
  min-height:100vh;
  overflow-x:hidden;
  box-sizing:border-box;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Logo header */
.logo-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  padding: 8px 0;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.logo-header a {
  font-family: Arial, sans-serif;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.2rem;
  user-select: none;
}

.logo-header a:hover {
  opacity: 0.8;
}

.page{ 
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.wrap{
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: 100%;
}

h1{
  margin:0;
  font-weight:800;
  letter-spacing:.3px;
  text-align:center;
  font-size:clamp(16px, 4vw, 28px);
  background:linear-gradient(90deg,#c7d6ff, #fff, #c7d6ff);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  flex-shrink:0;
}

/* Game stats display */
.game-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: center;
  font-size: 0.9em;
  color: var(--text);
  width: 100%;
  max-width: 900px;
  margin: 2px 0;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-label {
  color: var(--muted);
  font-size: 0.8em;
}
.stat-value {
  font-weight: 700;
  font-size: 1.2em;
}

/* Game controls */
.game-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 2px 0;
}

.control-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  background: #263158;
  color: #e5ecff;
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.2px;
  transition: transform 0.06s ease, filter 0.2s ease, background 0.2s ease;
  border: 1px solid #2f3a69;
  min-width: 120px;
}

.control-btn:hover {
  filter: brightness(1.08);
}

.control-btn:active {
  transform: translateY(1px) scale(0.995);
}

/* Game info and stats sections */
.game-info, .top100{
  width: 100%;
  max-width: 900px;
  background:linear-gradient(180deg, var(--panel), var(--panel-2));
  border-radius:var(--radius);
  padding:16px;
  border:1px solid #2b335b;
  box-shadow:var(--shadow);
  color: var(--text);
}

/* Topp 10 spesifikke stiler */
.top100 {
  max-height: 350px;
  margin: 2px 0;
  display: flex;
  flex-direction: column;
}

.table-container {
  flex: 1;
  overflow: auto;
  border-radius: 12px;
  max-height: 250px;
  border: 1px solid #2b335b;
  background: #0e1430;
}

/* Tabell-styling for Topp 10 */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  border-radius:12px;
  border:1px solid #2b335b;
  background:#0e1430;
  overflow:hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.table thead th{
  position:sticky; 
  top:0; 
  background:linear-gradient(180deg, #1e2648, #162048);
  text-align:center; 
  padding:12px 8px; 
  font-size:14px; 
  color:#e9ecf1;
  font-weight:600;
  border-bottom:2px solid #2b335b;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.table tbody td{
  padding:12px 8px; 
  border-bottom:1px solid #1a2140; 
  color:#e9ecf1; 
  font-variant-numeric: tabular-nums;
  text-align:center;
  font-size:14px;
  transition: background-color 0.2s ease;
}

.table tbody tr:nth-child(odd) td{ 
  background:#0f1530; 
}

.table tbody tr:nth-child(even) td{ 
  background:#0a1026; 
}

.table tbody tr:hover td{ 
  background:#1a2140; 
}

.table tbody tr:last-child td{
  border-bottom: none;
}

/* Spesielle stiler for første plass */
.table tbody tr:first-child td{
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #000;
  font-weight: bold;
  text-shadow: none;
}

.table tbody tr:first-child:hover td{
  background: linear-gradient(135deg, #ffed4e, #ffd700);
}

/* Gratulasjon overlay */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.5s ease-out;
}

.celebration-overlay.show {
  display: flex;
}

.celebration-container {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid #ffd700;
  animation: slideIn 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.celebration-container::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700, #ffed4e);
  border-radius: 22px;
  z-index: -1;
  animation: borderGlow 2s linear infinite;
}

.trophy-container {
  position: relative;
  margin-bottom: 30px;
}

.trophy {
  font-size: 200px;
  animation: trophyBounce 1s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1)) drop-shadow(0 0 60px rgba(255, 215, 0, 0.6));
  position: relative;
  z-index: 2;
  text-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
}

.trophy-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.2), transparent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  z-index: 1;
}

.trophy-glow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.2), transparent);
  border-radius: 50%;
  animation: pulse 3s ease-in-out infinite reverse;
}

.confetti {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffd700;
  animation: confettiFall 4s linear infinite;
  border-radius: 2px;
}

.confetti-piece:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
  background: #ff6b6b;
}

.confetti-piece:nth-child(2) {
  left: 20%;
  animation-delay: 0.2s;
  background: #4ecdc4;
}

.confetti-piece:nth-child(3) {
  left: 30%;
  animation-delay: 0.4s;
  background: #45b7d1;
}

.confetti-piece:nth-child(4) {
  left: 40%;
  animation-delay: 0.6s;
  background: #96ceb4;
}

.confetti-piece:nth-child(5) {
  left: 60%;
  animation-delay: 0.8s;
  background: #feca57;
}

.confetti-piece:nth-child(6) {
  left: 70%;
  animation-delay: 1s;
  background: #ff9ff3;
}

.confetti-piece:nth-child(7) {
  left: 80%;
  animation-delay: 1.2s;
  background: #54a0ff;
}

.confetti-piece:nth-child(8) {
  left: 90%;
  animation-delay: 1.4s;
  background: #5f27cd;
}

.confetti-piece:nth-child(9) {
  left: 15%;
  animation-delay: 1.6s;
  background: #ff9f43;
}

.confetti-piece:nth-child(10) {
  left: 25%;
  animation-delay: 1.8s;
  background: #10ac84;
}

.confetti-piece:nth-child(11) {
  left: 35%;
  animation-delay: 2.0s;
  background: #ee5a24;
}

.confetti-piece:nth-child(12) {
  left: 45%;
  animation-delay: 2.2s;
  background: #0984e3;
}

.confetti-piece:nth-child(13) {
  left: 55%;
  animation-delay: 2.4s;
  background: #a29bfe;
}

.confetti-piece:nth-child(14) {
  left: 65%;
  animation-delay: 2.6s;
  background: #fd79a8;
}

.confetti-piece:nth-child(15) {
  left: 75%;
  animation-delay: 2.8s;
  background: #fdcb6e;
}

.confetti-piece:nth-child(16) {
  left: 85%;
  animation-delay: 3.0s;
  background: #6c5ce7;
}

.celebration-text {
  margin-bottom: 30px;
}

.congratulations {
  font-size: 3rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  margin: 0 0 20px 0;
  animation: textGlow 2s ease-in-out infinite alternate;
}

.achievement {
  font-size: 1.5rem;
  color: #e9ecf1;
  margin: 0 0 20px 0;
  font-weight: 600;
}

.score-display, .position-display {
  font-size: 1.2rem;
  color: #aab3c8;
  margin: 10px 0;
}

.score-display span, .position-display span {
  color: #ffd700;
  font-weight: bold;
  font-size: 1.4rem;
}

.celebration-btn {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #000;
  border: none;
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}

.celebration-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
  background: linear-gradient(135deg, #ffed4e, #ffd700);
}

.celebration-btn:active {
  transform: translateY(0);
}

/* Animasjoner */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-50px) scale(0.8);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes trophyBounce {
  from { transform: translateY(0px) rotate(-5deg); }
  to { transform: translateY(-10px) rotate(5deg); }
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.3; }
}

@keyframes borderGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes textGlow {
  from { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
  to { text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.8); }
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(50vh) rotate(180deg) scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: translateY(100vh) rotate(360deg) scale(0.8);
    opacity: 0;
  }
}

.game-info h3, .top100 h3{ 
  margin:0 0 12px; 
  font-size: clamp(16px, 2.5vw, 20px); 
  color: var(--text);
}

.game-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px 20px;
  background: rgba(255,255,255,.06);
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,.1);
}

.score-info {
  display: flex;
  gap: 20px;
  align-items: center;
}

.score-label, .lives-label, .status-label {
  font-weight: 500;
  font-size: 14px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-label span, .lives-label span, .status-label span {
  color: #ffffff;
  font-weight: 700;
  background: rgba(91,168,255,.2);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(91,168,255,.3);
}

.game-status {
  display: flex;
  align-items: center;
}

.status-label {
  color: #ffd700;
}

/* Game board sizing: responsive */
.board-outer{ 
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.game-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 100%;
}

.game-wrap canvas {
  width: 100%;
  height: auto;
  min-width: 320px;
  min-height: 180px;
  max-width: 900px;
  max-height: 506px; /* 16:9 ratio for max-width 900px */
  aspect-ratio: 16/9;
  border: 2px solid #2b335b;
  border-radius: var(--radius);
  display: block;
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, #121730, #0f1530);
  transition: all 0.3s ease;
  object-fit: contain;
}

.game-wrap canvas:hover {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  transform: scale(1.01);
}

/* Touch indicator for mobile */
@media (hover: none) and (pointer: coarse) {
  .game-wrap canvas {
    cursor: pointer;
    touch-action: none; /* Prevent default touch behaviors */
    -webkit-touch-callout: none; /* Prevent callout on iOS */
    -webkit-user-select: none; /* Prevent text selection */
    user-select: none;
  }
  
  .game-wrap canvas:active {
    transform: scale(0.99);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  }
  
  /* Improve touch targets for mobile */
  .btn {
    min-height: 44px; /* iOS recommended touch target size */
    min-width: 44px;
  }
  
  .control-btn {
    min-height: 44px;
    padding: 12px 20px;
  }
  
  /* Make HUD elements more touch-friendly */
  .pill {
    min-height: 36px;
    padding: 8px 12px;
  }
}

/* Fullscreen styling */
.game-wrap.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-wrap.fullscreen canvas {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: none;
  border-radius: 0;
  transform: none;
  object-fit: contain; /* Maintain aspect ratio in fullscreen */
}

.game-wrap.fullscreen .hud {
  z-index: 10000;
}

/* Fullscreen responsive adjustments */
@media (orientation: landscape) and (max-height: 600px) {
  .game-wrap.fullscreen .hud {
    padding: 8px 12px;
  }
  .game-wrap.fullscreen .topbar {
    gap: 6px;
  }
  .game-wrap.fullscreen .pill {
    padding: 4px 8px;
    font-size: 12px;
  }
  .game-wrap.fullscreen .bottom {
    gap: 6px;
  }
  .game-wrap.fullscreen .legend {
    font-size: 10px;
  }
}

@media (orientation: portrait) and (max-width: 600px) {
  .game-wrap.fullscreen .hud {
    padding: 6px 8px;
  }
  .game-wrap.fullscreen .topbar {
    gap: 4px;
    flex-wrap: wrap;
  }
  .game-wrap.fullscreen .pill {
    padding: 3px 6px;
    font-size: 10px;
  }
  .game-wrap.fullscreen .bottom {
    gap: 4px;
    flex-wrap: wrap;
  }
  .game-wrap.fullscreen .legend {
    font-size: 9px;
  }
}

/* HUD styling for the game overlay */
.hud{
  position:absolute; 
  inset:0; 
  pointer-events:none;
  display:flex; 
  flex-direction:column; 
  justify-content:space-between;
  padding:12px 16px;
}

.topbar{ 
  display:flex; 
  gap:12px; 
  align-items:center; 
  justify-content:space-between; 
  flex-wrap:wrap; 
  text-shadow:0 1px 0 rgba(0,0,0,.4); 
}

.pill{
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.18));
  border:1px solid rgba(255,255,255,.08);
  border-radius:999px;
  padding:6px 12px;
  display:inline-flex; 
  gap:10px; 
  align-items:center;
  font-weight:600; 
  letter-spacing:.2px;
  font-size: clamp(12px, 2.5vw, 16px);
}

.bad{ color: var(--danger); } 
.good{ color: var(--ok); }

.centerPanel{ 
  position:absolute; 
  inset:0; 
  display:grid; 
  place-items:center; 
  pointer-events:none; 
}

.card{
  pointer-events:auto; 
  width:min(560px, 88%); 
  border-radius:18px; 
  padding:22px;
  background: linear-gradient(180deg, rgba(20,12,35,.85), rgba(20,12,35,.7));
  border:1px solid rgba(255,255,255,.08);
  box-shadow: 0 10px 40px rgba(0,0,0,.45); 
  text-align:center;
}

.title{ 
  font-size: clamp(20px, 4.4vmin, 34px); 
  font-weight:800; 
  letter-spacing:.4px; 
  margin:0 0 6px 0; 
}

.subtitle{ 
  opacity:.8; 
  margin:0 0 14px 0; 
}

.btns{ 
  display:flex; 
  gap:10px; 
  flex-wrap:wrap; 
  justify-content:center; 
  margin-top:10px; 
}

.btn{
  pointer-events:auto; 
  user-select:none; 
  cursor:pointer;
  border:1px solid rgba(255,255,255,.1);
  background: linear-gradient(180deg, rgba(193,125,255,.22), rgba(193,125,255,.06));
  color:var(--hud); 
  border-radius:12px; 
  padding:10px 14px; 
  font-weight:700;
  transition: transform .08s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 6px 18px rgba(193,125,255,.12);
}

.btn:hover{ 
  transform: translateY(-1px); 
}

.btn.secondary{ 
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); 
}

.kbd{ 
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; 
  font-weight:700; 
  font-size:.95em;
  background: rgba(255,255,255,.06); 
  border:1px solid rgba(255,255,255,.1); 
  padding:2px 8px; 
  border-radius:8px; 
}

.legend{ 
  opacity:.8; 
  font-size:.95em; 
}

.bottom{ 
  display:flex; 
  align-items:center; 
  justify-content:space-between; 
  gap:10px; 
  flex-wrap:wrap; 
}

code {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: #ecf0f1;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Large desktop optimizations */
@media (min-width: 1400px) {
  .page {
    max-width: 1200px;
    padding: 60px 40px 30px 40px;
  }
  .board-outer {
    max-width: 1000px;
  }
  .game-wrap canvas {
    max-width: 1000px;
    max-height: 563px; /* 16:9 ratio for 1000px */
  }
  .game-stats {
    gap: 60px;
    font-size: 1.1em;
  }
  .stat-value {
    font-size: 1.4em;
  }
  .control-btn {
    padding: 15px 30px;
    font-size: 1.1em;
    min-width: 160px;
  }
  .game-info, .top100 {
    max-width: 1000px;
    padding: 24px;
  }
  .table-container {
    max-height: 350px;
  }
  .table thead th {
    padding: 16px 12px;
    font-size: 16px;
  }
  .table tbody td {
    padding: 16px 12px;
    font-size: 16px;
  }
  .celebration-container {
    padding: 50px;
    margin: 30px;
  }
  .trophy {
    font-size: 250px;
  }
  .trophy-glow {
    width: 400px;
    height: 400px;
  }
  .trophy-glow::before {
    width: 300px;
    height: 300px;
  }
  .congratulations {
    font-size: 3.5rem;
  }
  .achievement {
    font-size: 1.8rem;
  }
}

/* Responsive design */
@media (max-width: 1024px) {
  .page {
    padding: 50px 16px 20px 16px;
  }
  .board-outer {
    max-width: 800px;
  }
  .game-stats {
    gap: 35px;
  }
  .game-info, .top100 {
    max-width: 800px;
  }
}

/* Tablet specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
  .page {
    padding: 50px 20px 20px 20px;
  }
  .board-outer {
    max-width: 800px;
  }
  .game-wrap canvas {
    max-width: 800px;
    max-height: 450px; /* 16:9 ratio for 800px */
  }
  .game-stats {
    gap: 40px;
  }
  .control-btn {
    padding: 12px 24px;
    font-size: 1em;
    min-width: 140px;
  }
  .table-container {
    max-height: 280px;
  }
  .celebration-container {
    padding: 35px;
    margin: 20px;
  }
  .trophy {
    font-size: 180px;
  }
  .trophy-glow {
    width: 300px;
    height: 300px;
  }
  .trophy-glow::before {
    width: 220px;
    height: 220px;
  }
  .congratulations {
    font-size: 2.8rem;
  }
  .achievement {
    font-size: 1.4rem;
  }
}

@media (max-width: 768px) {
  .page {
    padding: 44px 12px 20px 12px;
  }
  .wrap {
    gap: 4px;
  }
  h1 {
    font-size: clamp(18px, 5vw, 24px);
  }
  .board-outer {
    max-width: 100%;
  }
  .game-wrap canvas {
    border-radius: 12px;
  }
  .hud {
    padding: 10px 12px;
  }
  .topbar {
    gap: 8px;
  }
  .pill {
    padding: 5px 10px;
    font-size: clamp(11px, 2.2vw, 14px);
  }
  .bottom {
    gap: 8px;
  }
  .legend {
    font-size: clamp(10px, 2vw, 12px);
  }
  .kbd {
    font-size: 0.9em;
    padding: 1px 6px;
  }
  .game-stats {
    gap: 25px;
    flex-wrap: wrap;
  }
  .stat-item {
    min-width: 80px;
  }
  .control-btn {
    padding: 8px 16px;
    font-size: 0.85em;
    min-width: 100px;
  }
  .table-container {
    max-height: 200px;
  }
  .table thead th {
    padding: 10px 6px;
    font-size: 12px;
  }
  .table tbody td {
    padding: 10px 6px;
    font-size: 12px;
  }
  .game-info h3, .top100 h3 {
    font-size: clamp(14px, 3vw, 18px);
  }
  .info-content {
    font-size: 14px;
  }
  .info-content h4 {
    font-size: 16px;
  }
  .info-content ul {
    padding-left: 20px;
  }
  .info-content li {
    margin-bottom: 8px;
  }
}

@media (max-width: 600px) {
  .page {
    padding: 44px 10px 20px 10px;
  }
  .game-stats {
    gap: 20px;
    flex-direction: column;
    align-items: center;
  }
  .stat-item {
    min-width: 120px;
  }
  .game-controls {
    flex-direction: column;
    gap: 8px;
  }
  .control-btn {
    width: 100%;
    max-width: 200px;
  }
  .table-container {
    max-height: 180px;
  }
  .celebration-container {
    padding: 25px;
    margin: 15px;
  }
  .trophy {
    font-size: 140px;
  }
  .trophy-glow {
    width: 250px;
    height: 250px;
  }
  .trophy-glow::before {
    width: 180px;
    height: 180px;
  }
  .congratulations {
    font-size: 2.2rem;
  }
  .achievement {
    font-size: 1.3rem;
  }
}

@media (max-width: 480px) {
  .page {
    padding: 44px 8px 20px 8px;
  }
  .wrap {
    gap: 3px;
  }
  h1 {
    font-size: clamp(16px, 6vw, 20px);
  }
  .logo-header {
    padding: 6px 0;
  }
  .logo-header a {
    font-size: 1rem;
  }
  .board-outer {
    margin: 0;
  }
  .game-wrap canvas {
    border-radius: 8px;
    border-width: 1px;
  }
  .hud {
    padding: 8px 10px;
  }
  .topbar {
    gap: 6px;
    flex-wrap: wrap;
  }
  .pill {
    padding: 4px 8px;
    font-size: clamp(10px, 2vw, 12px);
  }
  .bottom {
    gap: 6px;
    flex-wrap: wrap;
  }
  .legend {
    font-size: clamp(9px, 1.8vw, 11px);
  }
  .kbd {
    font-size: 0.8em;
    padding: 1px 4px;
  }
  .game-stats {
    flex-direction: column;
    gap: 15px;
  }
  .stat-item {
    min-width: 100px;
  }
  .control-btn {
    padding: 6px 12px;
    font-size: 0.8em;
    min-width: 80px;
  }
  .table-container {
    max-height: 150px;
  }
  .table thead th {
    padding: 8px 4px;
    font-size: 11px;
  }
  .table tbody td {
    padding: 8px 4px;
    font-size: 11px;
  }
  .game-info, .top100 {
    padding: 12px;
  }
  .game-info h3, .top100 h3 {
    font-size: clamp(12px, 4vw, 16px);
    margin-bottom: 8px;
  }
  .info-content {
    font-size: 13px;
  }
  .info-content h4 {
    font-size: 14px;
    margin: 12px 0 6px 0;
  }
  .info-content ul {
    padding-left: 16px;
  }
  .info-content li {
    margin-bottom: 6px;
  }
  .celebration-container {
    padding: 20px;
    margin: 20px;
  }
  .trophy {
    font-size: 120px;
  }
  .trophy-glow {
    width: 200px;
    height: 200px;
  }
  .trophy-glow::before {
    width: 150px;
    height: 150px;
  }
  .congratulations {
    font-size: 2rem;
  }
  .achievement {
    font-size: 1.2rem;
  }
  .celebration-btn {
    padding: 12px 24px;
    font-size: 1rem;
  }
}

@media (max-width: 360px) {
  .page {
    padding: 40px 6px 16px 6px;
  }
  .wrap {
    gap: 2px;
  }
  h1 {
    font-size: clamp(14px, 7vw, 18px);
  }
  .game-stats {
    gap: 12px;
  }
  .stat-item {
    min-width: 80px;
  }
  .stat-label {
    font-size: 0.7em;
  }
  .stat-value {
    font-size: 1em;
  }
  .control-btn {
    padding: 5px 10px;
    font-size: 0.75em;
    min-width: 70px;
  }
  .table thead th {
    padding: 6px 3px;
    font-size: 10px;
  }
  .table tbody td {
    padding: 6px 3px;
    font-size: 10px;
  }
  .game-info, .top100 {
    padding: 10px;
  }
  .info-content {
    font-size: 12px;
  }
  .info-content h4 {
    font-size: 13px;
  }
  .celebration-container {
    padding: 15px;
    margin: 15px;
  }
  .trophy {
    font-size: 100px;
  }
  .trophy-glow {
    width: 180px;
    height: 180px;
  }
  .trophy-glow::before {
    width: 130px;
    height: 130px;
  }
  .congratulations {
    font-size: 1.8rem;
  }
  .achievement {
    font-size: 1.1rem;
  }
  .celebration-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .page {
    padding: 40px 20px 10px 20px;
  }
  .wrap {
    gap: 2px;
  }
  .game-stats {
    gap: 20px;
  }
  .table-container {
    max-height: 120px;
  }
  .celebration-container {
    padding: 15px;
    margin: 10px;
  }
  .trophy {
    font-size: 80px;
  }
  .trophy-glow {
    width: 150px;
    height: 150px;
  }
  .trophy-glow::before {
    width: 100px;
    height: 100px;
  }
  .congratulations {
    font-size: 1.5rem;
  }
  .achievement {
    font-size: 1rem;
  }
}