/* Removed Google Fonts dependency - using system fonts instead */

/* Modern color scheme inspired by 2048 and Astroidejeger */
:root {
  --bg1: #07122a;
  --bg2: #0c1d3f;
  --panel: #171a2b;
  --panel-2: #1e2338;
  --text: #eaf1ff;
  --muted: #a7b2c9;
  --accent: #5ba8ff;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 12px;
}

html, body {
  margin: 0;
  overflow-x: hidden;
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  color: var(--text);
}

body {
  overflow-y: auto;
}

/* Header styling */
.main-header {
  text-align: center;
  padding: 15px 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.main-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
}

.main-title-link {
  color: var(--text);
  text-decoration: none;
  user-select: none;
  background: linear-gradient(90deg, #c7d6ff, #fff, #c7d6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.main-title-link:hover {
  opacity: 0.8;
}

/* Game section */
.game-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px 20px;
  min-height: 100vh;
  gap: 20px;
}

.game-title {
  font-size: 2.5rem;
  margin: 0;
  color: var(--text);
  text-align: center;
  font-weight: 800;
  background: linear-gradient(90deg, #c7d6ff, #fff, #c7d6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

#container {
  width: min(625px, 100vw);
  height: 60vh;
  margin: 0 auto;
  position: relative;
}
#game #block-counter {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: auto;
  text-align: right;
  font-size: 2.5vh;
  color: white;
  font-weight: bold;
  z-index: 1000;
  pointer-events: none;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Fullscreen styling for game area */
#game.fullscreen-active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 9999 !important;
  background: #87CEEB !important; /* Sky blue background */
}

#game.fullscreen-active canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

#game.fullscreen-active #block-counter {
  font-size: 4vh !important;
  bottom: 30px !important;
  right: 30px !important;
}

/* Fullscreen icon in game */
#fullscreen-icon {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  color: white;
  cursor: pointer;
  z-index: 1001;
  user-select: none;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.3s ease;
  border: 2px solid rgba(255,255,255,0.2);
}

#fullscreen-icon:hover {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.4);
  transform: translateX(-50%) scale(1.1);
  text-shadow: 0 0 10px rgba(255,255,255,0.8);
}

#fullscreen-icon:active {
  transform: translateX(-50%) scale(0.95);
}

/* Adjust fullscreen icon when in fullscreen mode */
#game.fullscreen-active #fullscreen-icon {
  font-size: 32px !important;
  bottom: 25px !important;
  padding: 12px 16px !important;
}
#container #game {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 60px;
  left: 0;
  border: 4px solid white;
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: -2px;
  box-sizing: border-box;
}
#container .game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
#container .game-over * {
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  color: #333344;
}
#container .game-over h2 {
  margin: 0;
  padding: 0;
  font-size: 40px;
}
#container .game-ready {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}
#container .game-ready #start-button {
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  border: 3px solid #333344;
  padding: 10px 20px;
  background-color: transparent;
  color: #333344;
  font-size: 30px;
}
#container #instructions {
  position: absolute;
  width: 100%;
  top: 16vh;
  left: 0;
  text-align: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
}
#container #instructions.hide {
  opacity: 0 !important;
}
#container.playing #instructions {
  opacity: 1;
}
#container.ready .game-ready #start-button {
  opacity: 1;
  transform: translatey(0);
}
#container.ended .game-over * {
  opacity: 1;
  transform: translatey(0);
}
#container.ended .game-over p {
  transition-delay: 0.3s;
}

/* Game controls */
.game-controls {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  z-index: 10;
}

.control-button {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  user-select: none;
}

.control-button:hover {
  background: var(--accent);
  color: var(--bg1);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.control-button:active {
  transform: translateY(0);
}

/* Leaderboard */
.leaderboard {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: min(625px, 100vw);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.leaderboard h3 {
  margin: 0 0 20px 0;
  color: var(--accent);
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.leaderboard-content {
  overflow-x: auto;
}

.top-scores-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg1);
  border: 1px solid var(--border);
}

.top-scores-table thead th {
  background: var(--bg2);
  color: var(--accent);
  text-align: left;
  padding: 12px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.top-scores-table tbody td {
  padding: 10px 15px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.top-scores-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

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

/* Topp 3 highlighting */
.top-scores-table tbody tr:nth-child(1) td:first-child { color: #FFD700; font-weight: bold; } /* Gull */
.top-scores-table tbody tr:nth-child(2) td:first-child { color: #C0C0C0; font-weight: bold; } /* Sølv */
.top-scores-table tbody tr:nth-child(3) td:first-child { color: #CD7F32; font-weight: bold; } /* Bronse */

/* Info section */
.info-section {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 600px;
  text-align: center;
  box-shadow: var(--shadow);
}

.info-section h3 {
  margin: 0 0 15px 0;
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 700;
}

.info-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Responsive design */
@media (max-width: 768px) {
  .game-section {
    padding: 70px 15px 15px;
    gap: 15px;
  }
  
  .game-title {
    font-size: 2rem;
  }
  
  .game-wrapper {
    padding: 15px;
  }
  
  #container {
    width: min(550px, 100vw);
    height: 50vh;
  }
  
  .control-button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .leaderboard {
    width: min(550px, 100vw);
  }
}

/* Hide any external social media icons or links */
a[href*="twitter"], 
a[href*="codepen"], 
.social-icon, 
.twitter-icon,
[class*="twitter"],
[class*="social"] {
  display: none !important;
}

/* Hide any floating icons in bottom right */
div[style*="position: fixed"][style*="bottom"][style*="right"] {
  display: none !important;
}