/* ============================================================
   Citroniņš — lobija čaula jaunajā Spēļotavas dizainā
   Pašpietiekams fails (nelieto home.css, lai nekonfliktētu
   ar spēles laukuma .game-card stiliem).
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #05080f;
  --panel: rgba(148, 176, 215, 0.045);
  --panel-solid: #0b1220;
  --line: rgba(158, 182, 214, 0.12);
  --line-strong: rgba(158, 182, 214, 0.24);
  --text: #eef3fa;
  --muted: #93a3ba;
  --muted-2: #64748e;
  --lime: #c8f542;
  --violet: #8b7bff;
  --blue: #4d94ff;
  --green: #3ddc84;
  --red: #ff6474;
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body.ct-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(36rem 22rem at 12% -8%, rgba(200, 245, 66, 0.08), transparent 68%),
    radial-gradient(30rem 20rem at 95% 12%, rgba(255, 215, 110, 0.06), transparent 68%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.hidden { display: none !important; }

::selection { background: rgba(200, 245, 66, 0.28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: 6px;
}

@keyframes ctIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes ctFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* ==================== Augšējā josla ==================== */

.ct-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 24px 0;
}

.ct-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.ct-back:hover {
  color: var(--text);
  border-color: rgba(200, 245, 66, 0.4);
  transform: translateX(-2px);
}

.ct-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.ct-logo b { color: var(--lime); }

.ct-logo-mark {
  display: grid;
  grid-template-columns: repeat(2, 7px);
  gap: 3px;
  transform: rotate(-8deg);
}

.ct-logo-mark i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--lime);
}

.ct-logo-mark i:nth-child(2),
.ct-logo-mark i:nth-child(3) { background: #fff; }

/* ==================== Čaula un hero ==================== */

.ct-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 24px 40px;
}

.ct-hero {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 26px 30px;
  border: 1px solid rgba(200, 245, 66, 0.2);
  border-radius: 22px;
  background:
    radial-gradient(24rem 14rem at 100% -30%, rgba(200, 245, 66, 0.1), transparent 70%),
    linear-gradient(155deg, #0d1526, #080e1a 70%);
  overflow: hidden;
  animation: ctIn 0.6s cubic-bezier(0.2, 0.65, 0.25, 1) both;
}

.ct-hero-art {
  position: relative;
  flex: none;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
}

.ct-lemon {
  font-size: 58px;
  filter: drop-shadow(0 10px 26px rgba(200, 245, 66, 0.3));
  display: inline-block;
  backface-visibility: hidden;
}

/* Vispārīgs hero emoji jebkurai spēlei (tonis caur --hero-tone) */
.ct-hero-emoji {
  font-size: 54px;
  filter: drop-shadow(0 10px 26px var(--hero-tone, rgba(200, 245, 66, 0.3)));
  display: inline-block;
  backface-visibility: hidden;
}

.ct-card-float {
  position: absolute;
  display: grid;
  place-items: center;
  width: 26px;
  height: 36px;
  border-radius: 6px;
  background: linear-gradient(160deg, #f7fafc, #d8e0ea);
  color: #1b2436;
  font-family: var(--font-display);
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(3, 7, 14, 0.5);
}

.ct-card-float.c1 { left: -8px; top: 2px; transform: rotate(-5deg); }
.ct-card-float.c2 { right: -8px; bottom: 2px; color: #d33b52; transform: rotate(5deg); }

.ct-hero-art {
  animation: ctArtIn 420ms cubic-bezier(0.2, 0.72, 0.24, 1) both;
}

@keyframes ctArtIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ct-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--lime);
}

.ct-hero h1 {
  margin: 4px 0 6px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 800;
  letter-spacing: -1.2px;
}

.ct-hero p {
  margin: 0 0 12px;
  max-width: 560px;
  font-size: 13.5px;
  color: var(--muted);
}

.ct-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ct-meta span {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(5, 9, 17, 0.55);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.ct-meta span.on {
  border-color: rgba(61, 220, 132, 0.35);
  color: var(--green);
}

/* ==================== Paneļi un sadaļas ==================== */

.auth-section,
.lobby-section,
.room-section,
.game-section {
  margin-top: 18px;
  animation: ctIn 0.5s cubic-bezier(0.2, 0.65, 0.25, 1) both;
}

.ct-panel {
  padding: 26px 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-solid);
}

.ct-panel-lead {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}

/* ==================== Auth ==================== */

.auth-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.auth-tab {
  padding: 9px 20px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab:hover { color: var(--text); }

.auth-tab.active {
  background: var(--lime);
  color: #16230a;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(200, 245, 66, 0.2);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
}

.auth-form input,
.lobby-card input {
  padding: 13px 15px;
  font-size: 14.5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(5, 9, 17, 0.6);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form input::placeholder,
.lobby-card input::placeholder { color: var(--muted-2); }

.auth-form input:focus,
.lobby-card input:focus {
  outline: none;
  border-color: rgba(200, 245, 66, 0.5);
  box-shadow: 0 0 0 3px rgba(200, 245, 66, 0.08);
}

.auth-msg {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  color: var(--red);
}

/* ==================== Pogas ==================== */

.btn-primary {
  padding: 13px 24px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--lime), #a5e32c);
  color: #131f05;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(200, 245, 66, 0.18);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(200, 245, 66, 0.26);
}

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

.btn-secondary {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  color: var(--text);
  border-color: rgba(200, 245, 66, 0.4);
}

/* ==================== Spēles rīkjosla ==================== */

.game-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.game-toolbar a {
  padding: 7px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.game-toolbar a:hover { background: var(--panel-2); color: var(--text); }

.ct-topbar,
body.ct-body .page-header { flex-wrap: wrap; row-gap: 10px; }

@media (max-width: 720px) {
  .game-toolbar { order: 3; width: 100%; justify-content: space-between; }
  .game-toolbar a { flex: 1; text-align: center; padding: 7px 4px; font-size: 11.5px; }
}

/* ==================== Auth ielādes stāvoklis ====================
   Rāda uzreiz (bez "hidden"), kamēr Firebase paziņo auth stāvokli, lai
   nekad neuzplaiksnī nepareizais ekrāns (login forma tam, kas jau ir
   ielogojies) pirms pārmet uz pareizo sadaļu. */

.auth-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 70px 30px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.auth-loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--lime);
  animation: authSpin 0.8s linear infinite;
}

@keyframes authSpin { to { transform: rotate(360deg); } }

/* ==================== Lobija izvēle ==================== */

.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-solid);
}

.user-hello {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  color: var(--muted);
}

.user-hello strong { color: var(--text); }

.user-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid rgba(200, 245, 66, 0.35);
  background: rgba(200, 245, 66, 0.1);
  font-style: normal;
  font-size: 16px;
}

.lobby-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.lobby-card {
  --tone: var(--lime);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(14rem 8rem at 100% 0%, color-mix(in srgb, var(--tone) 8%, transparent), transparent 70%),
    var(--panel-solid);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.lobby-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--tone) 38%, transparent);
  box-shadow: 0 18px 40px rgba(2, 6, 14, 0.5);
}

.lobby-card.tone-lime { --tone: #c8f542; }
.lobby-card.tone-blue { --tone: #4d94ff; }
.lobby-card.tone-violet { --tone: #8b7bff; }

.lobby-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--tone) 30%, #0b1322), #0a101d);
  border: 1px solid color-mix(in srgb, var(--tone) 44%, transparent);
  color: color-mix(in srgb, var(--tone) 86%, #fff);
  font-size: 19px;
  font-weight: 800;
}

.lobby-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 800;
}

.card-sub {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.lobby-card input {
  width: 100%;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  text-align: center;
}

.lobby-card .btn-primary { width: 100%; margin-top: auto; }

.kg-mode-toggle { margin-bottom: 14px; user-select: none; }

/* ==================== Iestatījumi un togli ==================== */

.settings-row { margin-bottom: 14px; }

.settings-row label {
  display: block;
  margin-bottom: 7px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.deck-choice {
  display: flex;
  gap: 6px;
}

.deck-btn {
  flex: 1;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.deck-btn:hover { border-color: color-mix(in srgb, var(--tone, #c8f542) 50%, transparent); color: var(--text); }

.deck-btn.active {
  background: color-mix(in srgb, var(--tone, #c8f542) 85%, #fff);
  border-color: transparent;
  color: #131f05;
  font-weight: 800;
}

.kg-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.kg-toggle-row input[type="checkbox"] { display: none; }

.kg-toggle-track {
  flex-shrink: 0;
  position: relative;
  width: 38px;
  height: 21px;
  margin-top: 1px;
  border-radius: 11px;
  background: rgba(158, 182, 214, 0.22);
  transition: background 0.2s;
}

.kg-toggle-row input:checked + .kg-toggle-track { background: var(--lime); }

.kg-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.kg-toggle-row input:checked + .kg-toggle-track .kg-toggle-knob { transform: translateX(17px); }

.kg-toggle-label { display: flex; flex-direction: column; gap: 2px; }
.kg-toggle-name { font-size: 13px; font-weight: 700; color: var(--text); }
.kg-toggle-desc { font-size: 11px; color: var(--muted-2); line-height: 1.4; }

.settings-hint {
  margin: -8px 0 8px;
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.4;
}

/* ==================== Lobija telpa ==================== */

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  margin-bottom: 14px;
  border: 1px solid rgba(200, 245, 66, 0.25);
  border-radius: 20px;
  background:
    radial-gradient(20rem 10rem at 0% -30%, rgba(200, 245, 66, 0.1), transparent 70%),
    var(--panel-solid);
}

.room-label {
  margin: 0 0 2px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.room-code {
  margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--lime);
  text-shadow: 0 0 26px rgba(200, 245, 66, 0.35);
}

.room-info {
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: var(--panel);
}

.hint-text {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.hint-text strong { color: var(--text); }

.players-list h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.player-count {
  font-weight: 600;
  letter-spacing: normal;
  color: var(--muted-2);
}

.players-list ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 20px;
  padding: 0;
}

.players-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-solid);
  color: var(--text);
  animation: ctIn 0.35s ease both;
}

.player-name {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
}

.player-badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.player-badge.host {
  background: rgba(255, 215, 110, 0.12);
  border: 1px solid rgba(255, 215, 110, 0.35);
  color: #ffd76e;
}

.player-badge.you {
  background: rgba(77, 148, 255, 0.13);
  border: 1px solid rgba(77, 148, 255, 0.35);
  color: #8fbcff;
}

.room-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.room-actions .btn-primary {
  padding: 15px 32px;
  font-size: 16px;
}

/* ==================== Spēles placeholder ==================== */

.game-placeholder {
  padding: 3rem 2rem;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
}

.game-placeholder p { margin-bottom: 0.5rem; font-size: 16px; }
.game-placeholder .btn-secondary { margin-top: 1.5rem; }

/* ==================== Kājene ==================== */

.ct-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 980px;
  margin: 30px auto 0;
  padding: 18px 24px 26px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted-2);
}

.ct-footer b { color: var(--muted); }

.ct-footer nav {
  display: flex;
  gap: 16px;
}

.ct-footer a {
  color: var(--muted-2);
  font-weight: 600;
  transition: color 0.2s ease;
}

.ct-footer a:hover { color: var(--lime); }

/* ==================== Responsivitāte ==================== */

@media (max-width: 860px) {
  .lobby-options { grid-template-columns: 1fr 1fr; }
  .lobby-options .lobby-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .ct-topbar { padding: 14px 16px 0; }
  .ct-shell { padding: 18px 16px 30px; }
  .ct-hero { flex-direction: column; text-align: center; padding: 22px; gap: 14px; }
  .ct-hero p { margin-inline: auto; }
  .ct-meta { justify-content: center; }
  .ct-panel { padding: 20px; }
  .lobby-options { grid-template-columns: 1fr; }
  .room-code { font-size: 32px; }
  .room-header { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Saderība ar vecāko spēļu lapu marķējumu (page-header, card u.c.)
   Ļauj vienai čaulai apkalpot visas spēles.
   ============================================================ */

body.ct-body .container {
  max-width: 980px;
  margin: 0 auto;
  padding: 6px 24px 40px;
}

body.ct-body .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 0 0;
}

body.ct-body .back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

body.ct-body .back-link:hover {
  color: var(--text);
  border-color: rgba(200, 245, 66, 0.4);
  transform: translateX(-2px);
}

body.ct-body .path { display: none; }

body.ct-body .page-title {
  margin: 22px 0 6px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4.5vw, 38px);
  font-weight: 800;
  letter-spacing: -1.2px;
  color: var(--text);
}

body.ct-body .page-content {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
}

body.ct-body .card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-solid);
  box-shadow: none;
}

body.ct-body h3 { color: var(--text); }

body.ct-body .auth-section .page-content { margin-bottom: 18px; }

/* Vecajām lapām auth sadaļa izskatās kā panelis */
body.ct-body .auth-section {
  padding: 26px 30px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-solid);
}

/* Kuģīšu lauka izmēra izvēle tumšajā tēmā */
body.ct-body .kg-size-picker > h3 {
  color: var(--muted-2);
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-size: 11px;
}

body.ct-body .kg-size-card {
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  color: var(--text);
  box-shadow: none;
}

body.ct-body .kg-size-option:hover .kg-size-card {
  border-color: rgba(200, 245, 66, 0.4);
}

body.ct-body .kg-size-option input:checked + .kg-size-card {
  border-color: var(--lime);
  background: rgba(200, 245, 66, 0.08);
  box-shadow: 0 0 0 1px var(--lime);
}

body.ct-body .kg-size-name { color: var(--text); }
body.ct-body .kg-size-dim { color: var(--lime); }
body.ct-body .kg-size-desc { color: var(--muted-2); }
