/* Spillsidene.no color scheme */
:root {
  --bg1: #07122a;
  --bg2: #0c1d3f;
  --panel: #101b35;
  --card: #0f1a33;
  --text: #eaf1ff;
  --muted: #a7b2c9;
  --accent: #5ba8ff;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial;
}

body {
  background: radial-gradient(1200px 800px at 20% 0%, #1b2040 0%, #0d1122 60%, #070a16 100%);
  color: var(--text);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 56px 12px calc(5vh + 12px) 12px;
  min-height: 100vh;
  overflow-x: hidden;
  box-sizing: border-box;
}

.page {
  width: min(1100px, 96vw);
  min-height: calc(95vh - 24px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 480px) {
  .page {
    gap: 6px;
  }
  body {
    padding: 44px 8px calc(5vh + 8px) 8px;
  }
}

/* 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);
}

@media (max-width: 480px) {
  .logo-header {
    padding: 6px 0;
  }
}

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;
}

button {
  appearance: none;
  border: none;
  cursor: pointer;
  background: #263158;
  color: #e5ecff;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: .2px;
  font-size: 0.9em;
  transition: transform .06s ease, filter .2s ease, background .2s ease;
  border: 1px solid #2f3a69;
}

@media (max-width: 480px) {
  button {
    padding: 6px 10px;
    font-size: 0.85em;
  }
}

button:hover {
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px) scale(.995);
}

button.secondary {
  background: #1f2744;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Game container */
.game-container {
  width: min(90vw, 960px);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

@media (min-width: 480px) {
  .game-container {
    width: min(80vw, 960px);
  }
}

@media (min-width: 768px) {
  .game-container {
    width: min(70vw, 960px);
  }
}

/* HUD */
#hud {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-weight: 600;
  opacity: .95;
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  #hud {
    gap: 10px;
    font-size: .95rem;
  }
}

/* Game canvas */
canvas#game {
  width: 100%;
  height: auto;
  max-height: 65vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border: 2px solid rgba(255, 255, 255, .15);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  display: block;
}

@media (max-width: 700px) {
  canvas#game {
    max-height: 58vh;
  }
}

/* Overlay */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 26, 51, .55);
  backdrop-filter: blur(3px);
  border-radius: 16px;
}

#overlay.hidden {
  display: none;
}

.panel {
  background: rgba(4, 18, 36, .9);
  padding: 24px 28px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
  text-align: center;
}

.panel h2 {
  margin: 0 0 8px 0;
}

.panel button {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: #0f62fe;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
  font-size: 0.85em;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .hint {
    font-size: 0.8em;
    margin-top: 2px;
  }
}

/* Game controls */
.game-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
  flex-shrink: 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: 100px;
}

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

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

@media (max-width: 480px) {
  .game-controls {
    gap: 10px;
  }
  .control-btn {
    padding: 8px 16px;
    font-size: 0.85em;
    min-width: 90px;
  }
}

/* High scores section */
.highscores {
  width: min(92vw, 860px);
  background: linear-gradient(180deg, var(--panel), var(--card));
  border-radius: 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex: 1 1 300px;
  min-height: 300px;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  .highscores {
    width: min(95vw, 100%);
    padding: 12px 16px;
  }
}

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

#score-list {
  margin: 8px 0 0 20px;
  padding: 0;
  flex: 1;
  overflow-y: auto;
}

#score-list li {
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, .08);
  color: var(--text);
}

#score-list li:last-child {
  border-bottom: none;
}

.note {
  opacity: .8;
  font-size: .95rem;
  margin: 12px 0 0 0;
  color: var(--muted);
}

/* Game info section */
.game-info {
  width: min(92vw, 860px);
  background: linear-gradient(180deg, var(--panel), var(--card));
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-top: 12px;
  flex-shrink: 0;
  flex-grow: 0;
}

@media (max-width: 768px) {
  .game-info {
    width: min(95vw, 100%);
    padding: 12px;
  }
}

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

.info-content {
  color: var(--text);
  line-height: 1.6;
}

.info-content h4 {
  margin: 16px 0 8px 0;
  font-size: clamp(14px, 2vw, 16px);
  color: var(--accent);
  font-weight: 600;
}

.info-content p {
  margin: 0 0 12px 0;
  color: var(--muted);
}

.info-content ul {
  margin: 8px 0 16px 0;
  padding-left: 20px;
}

.info-content li {
  margin: 6px 0;
  color: var(--muted);
}

.info-content strong {
  color: var(--text);
  font-weight: 600;
}

.info-content em {
  color: var(--accent);
  font-style: italic;
}