:root {
  --navy: #1b3a70;
  --navy-dark: #0d1b33;
  --white: #ffffff;
  --accent-green: #3ecf6e;
  --accent-red: #e6493f;
  --grey-light: #d7dce5;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: var(--navy-dark);
  color: var(--white);
  font-family: 'Barlow', -apple-system, system-ui, sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

.screen {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* ---------- Sentrerte paneler (gruppevalg, passord, nickname, resultat) ---------- */

.page-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
  width: min(46vw, 900px);
  min-width: 480px;
}

.panel-center {
  background: var(--navy);
  padding: clamp(40px, 4vw, 64px) clamp(40px, 5vw, 80px);
  border-radius: 12px;
  border: 2px solid var(--white);
  text-align: center;
  width: min(46vw, 900px);
  min-width: 480px;
}

.page-stack .panel-center {
  width: 100%;
  min-width: 0;
}


.logo-top {
  width: 100%;
  height: auto;
}

.logo {
  max-width: 340px;
  width: 100%;
  height: auto;
  margin-bottom: 20px;
}

h1, h2, h3 {
  font-family: 'Saira Condensed', 'Barlow', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
}

h1 {
  font-size: 28px;
  margin: 0 0 4px;
}

.brand-title {
  font-family: 'Saira Condensed', sans-serif;
  font-style: italic;
  font-weight: 800;
  font-size: clamp(48px, 4.6vw, 82px);
  margin: 0 0 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.brand-subtitle {
  color: var(--grey-light);
  font-size: clamp(15px, 1.15vw, 22px);
  margin: 0 0 20px;
}

h2 {
  font-size: clamp(22px, 1.7vw, 34px);
  margin: 0 0 10px;
}

.subtitle {
  color: var(--grey-light);
  font-size: clamp(16px, 1.1vw, 20px);
  margin-bottom: 24px;
}

.hint-text {
  color: var(--grey-light);
  font-size: clamp(14px, 1vw, 18px);
  margin-bottom: 20px;
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.group-btn {
  background: var(--navy-dark);
  color: var(--white);
  border: 2px solid var(--white);
  border-radius: 8px;
  padding: clamp(14px, 1.3vw, 22px) 18px;
  font-size: clamp(16px, 1.15vw, 22px);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.group-btn:hover {
  background: #16294f;
}

input {
  width: 100%;
  padding: clamp(12px, 1.2vw, 18px) 14px;
  font-size: clamp(16px, 1.15vw, 21px);
  border-radius: 8px;
  border: 2px solid var(--white);
  margin-bottom: 12px;
  font-family: inherit;
  background: var(--white);
  color: var(--navy-dark);
}

.btn-primary {
  width: 100%;
  background: var(--white);
  color: var(--navy);
  border: none;
  border-radius: 8px;
  padding: clamp(14px, 1.3vw, 20px);
  font-size: clamp(16px, 1.15vw, 21px);
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--grey-light);
}

.btn-link {
  background: none;
  border: none;
  color: var(--grey-light);
  text-decoration: underline;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  margin-top: 16px;
}


.error-text {
  color: var(--accent-red);
  font-size: 14px;
  margin: -4px 0 12px;
}

/* ---------- Hub ---------- */

.hub-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.hub-main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px;
  overflow-y: auto;
}

.hub-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.hub-header-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hub-logo {
  width: clamp(240px, 22vw, 400px);
  height: auto;
  border-radius: 4px;
}

.hub-meta {
  color: var(--grey-light);
  font-size: 14px;
}

.section-title {
  margin-bottom: 16px;
}

.mode-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.mode-card {
  background: var(--navy);
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  padding: 26px 22px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--white);
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}

.mode-card:hover {
  background: #1f4382;
  border-color: var(--white);
  transform: translateY(-3px);
}

.mode-card-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  color: var(--accent-green);
}

.mode-card-icon svg {
  width: 100%;
  height: 100%;
}

.mode-card-disabled .mode-card-icon {
  color: var(--grey-light);
}

.mode-card-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mode-card-disabled:hover {
  transform: none;
  background: var(--navy);
}

.mode-card-title {
  font-family: 'Saira Condensed', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.result-banner {
  font-family: 'Saira Condensed', sans-serif;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: clamp(22px, 2vw, 34px);
  padding: 14px 20px;
  border-radius: 10px;
  margin: -12px -12px 20px;
}

.result-banner-record {
  background: var(--accent-green);
  color: var(--navy-dark);
  animation: pulse 0.6s ease-out 2;
}

.result-banner-first {
  background: var(--white);
  color: var(--navy);
}

.result-banner-normal {
  background: rgba(255, 255, 255, 0.12);
  color: var(--grey-light);
  font-size: clamp(16px, 1.3vw, 22px);
  font-style: normal;
}

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

.btn-locked {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.result-pb {
  color: var(--grey-light);
  font-size: clamp(14px, 1.05vw, 18px);
  margin: 0 0 8px;
}

.mode-card-sub {
  font-size: 13px;
  color: var(--grey-light);
}

/* ---------- Sidepanel (highscore) ---------- */

.sidebar {
  width: clamp(380px, 27vw, 560px);
  background: #10203e;
  border-left: 2px solid var(--navy);
  padding: clamp(24px, 1.8vw, 36px);
  display: flex;
  flex-direction: column;
}

.sidebar h3 {
  margin: 0 0 16px;
  font-size: clamp(24px, 1.8vw, 34px);
}

.lb-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.lb-tab {
  flex: 1;
  background: var(--navy-dark);
  color: var(--grey-light);
  border: 1px solid var(--navy);
  border-radius: 8px;
  padding: 12px 6px;
  font-size: clamp(12px, 0.85vw, 15px);
  line-height: 1.25;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lb-tab:hover {
  background: #1a3260;
  color: var(--white);
}

.lb-tab.active {
  background: var(--white);
  color: var(--navy);
  font-weight: 700;
  border-color: var(--white);
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lb-list-scroll {
  overflow-y: auto;
}

.sidebar .lb-list-scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
}


.lb-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  font-size: clamp(15px, 1.05vw, 19px);
  border-radius: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.lb-row:nth-child(odd) {
  background: rgba(255,255,255,0.035);
}

.lb-rank {
  color: var(--grey-light);
  font-family: 'Saira Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(17px, 1.2vw, 22px);
  text-align: center;
}

.lb-row:nth-child(1) .lb-rank { color: #f2c94c; }
.lb-row:nth-child(2) .lb-rank { color: #cfd6e2; }
.lb-row:nth-child(3) .lb-rank { color: #d08b52; }

.lb-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-group-tag {
  display: block;
  color: var(--grey-light);
  font-size: clamp(11px, 0.75vw, 14px);
  font-weight: 400;
  margin-top: 2px;
}

.lb-score {
  font-family: 'Saira Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(19px, 1.35vw, 26px);
  text-align: right;
  color: var(--accent-green);
}

.lb-empty, .lb-loading {
  color: var(--grey-light);
  font-size: clamp(14px, 1vw, 17px);
  padding: 16px 0;
}

/* ---------- Spillskjerm ---------- */

.game-container {
  position: relative;
  width: 95vw;
  height: 88vh;
  max-width: 95vw;
  max-height: 88vh;
}

.game-watermark {
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: clamp(38px, 3.5vw, 62px);
  height: auto;
  opacity: 0.22;
  border-radius: 4px;
  pointer-events: none;
}

#game-canvas {
  width: 100%;
  height: 100%;
  cursor: none;
  border: 2px solid var(--navy);
}

.countdown-overlay {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vh, 48px);
  position: absolute;
  inset: 0;
  background: var(--navy-dark);
  border: 2px solid var(--navy);
}

.countdown-logo {
  width: clamp(280px, 30vw, 620px);
  height: auto;
  opacity: 0.9;
  border-radius: 6px;
}

#countdown-number {
  font-family: 'Saira Condensed', sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: clamp(90px, 13vh, 170px);
  line-height: 1;
  color: var(--white);
}

/* ---------- Resultatskjerm ---------- */

.result-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 24px 0;
}

#result-extra-stats {
  display: contents;
}

.mode-select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid var(--navy);
  background: var(--navy-dark);
  color: var(--white);
  font-family: 'Saira Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 1.15vw, 21px);
  cursor: pointer;
}

.stat-block {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 36px;
  font-weight: bold;
}

.stat-label {
  font-size: 13px;
  color: var(--grey-light);
}

.result-context {
  font-size: 16px;
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
