* {
  box-sizing: border-box;
}

:root {
  --bg: #0f1115;
  --panel: #161a20;
  --text: #e8eaed;
  --muted: #9aa3af;
  --accent: #ffd93d;
  --accent-2: #00d1ff;
  --danger: #ff4d4d;
  --success: #32d583;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #15202b 0%, var(--bg) 60%);
  color: var(--text);
}

.container {
  max-width: 980px;
  padding: 0 16px;
  margin: 0 auto;
}

.site-header {
  padding: 28px 0 10px;
}

.logo {
  margin: 0;
  letter-spacing: 1px;
  font-weight: 900;
  font-size: clamp(24px, 4vw, 38px);
}

.logo span {
  font-weight: 300;
  color: var(--accent-2);
  letter-spacing: 2px;
}

.tagline {
  margin: 6px 0 0;
  color: var(--muted);
}

.game-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.0));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden; /* Peida canvas, kui see ületab kaardi piire */
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  margin-bottom: 10px;
}

#game {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: linear-gradient(180deg, #0e1218 30%, #0b0f14 100%);
  border: 1px solid rgba(255,255,255,0.06);
  max-height: 100%;
  box-sizing: border-box;
  vertical-align: top;
  aspect-ratio: 5 / 2; /* Hoiab proportsiooni */
}

.controls {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--accent), #ffbd1b);
  color: #121212;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(255,217,61,0.25);
  text-decoration: none;
}

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

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

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
}

.btn.outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.foot-note {
  color: var(--muted);
  margin: 16px 0 6px;
}

.disclaimer {
  font-size: 12px;
  opacity: 0.8;
}

.site-footer {
  margin: 20px 0 40px;
  color: var(--muted);
  text-align: center;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  width: min(520px, calc(100% - 24px));
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.overlay-card h2 {
  margin-top: 0;
}

.over-score {
  color: var(--muted);
}

.over-tip {
  font-style: italic;
  margin: 10px 0 16px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

/* —— header inline: ära lase murda teisele reale —— */
.header-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* jäta esialgne clamp() kehtima; ära suurenda üle, ja ära murra */
.logo {
  /* font-size on üleval (clamp). siia EI pane uut suurust */
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
}

.logo span {
  color: #00D1FF;
}

.tagline {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 4px;
}

/* canvas täislaius */
#game {
  width: 100%;
  display: block;
}

/* Mobiilne kohandus */
@media (max-width: 480px) {
  .game-card {
    padding: 8px;
    min-height: 350px; /* Suurenenud mobiili miinimumkõrgus */
  }
  .topbar {
    font-size: 12px;
    gap: 8px;
  }

  .topbar {
  flex-shrink: 0; /* Ei lase ülaosal kokku tõmbuda */
}
 .game-card {
  min-height: 400px; /* Suurenenud miinimumkõrgus, kohandatav */
  height: auto; /* Kohaneb sisu järgi */
  overflow: hidden; /* Peida ülejääk */
  position: relative;
  display: flex; /* Lisatud, et kõrgus kohaneks canvasega */
  flex-direction: column; /* Vertikaalne paigutus */
}
  .site-header .logo {
    font-size: 1.2rem;
  }
  .logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  #game {
  width: 100% !important;
  height: auto !important;
  max-height: 100%; /* Kohaneb vanema elemendi kõrgusega */
  aspect-ratio: 5 / 3; /* Säilitab proportsiooni, kohandatav */
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
  flex-grow: 1; /* Võtab kogu saadava kõrguse */
}

}