/* ═══════════════════════════════════════════════════════════
   Clapp Hub · theme
   Black canvas, pine green.
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #000000;
  --bg-soft: #101010;
  --surface: #161616;
  --surface-2: #1d1d1d;
  --line: #2a2a2a;

  --green: #2e7258;
  --green-bright: #4cae80;
  --green-deep: #1c5238;
  --green-glow: rgba(46, 114, 88, 0.35);

  --text: #f4ede2;
  --muted: #9b938a;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg); /* exactly black */
}

body {
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

::selection { background: var(--green); color: #111; }

/* ─── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--green-bright), var(--green-deep));
  box-shadow: 0 0 12px var(--green-glow);
}

/* ─── Screens ─────────────────────────────────────────────── */
main { flex: 1; display: flex; }

.screen {
  display: none;
  flex: 1;
  width: 100%;
}

.screen.active { display: flex; animation: fadeIn 0.28s ease; }

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

.hidden { display: none !important; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ─── Home (snake embedded) ───────────────────────────────── */
#screen-home {
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  padding: 20px 20px 28px;
}

.logo-wrap {
  width: min(430px, 84vw);
  margin-bottom: 18px;
  pointer-events: none;
}

.logo {
  display: block;
  width: 100%;
  max-height: 26vh;
  object-fit: contain;
  margin: 0 auto;
  /* no box, no frame — the logo's own background blends into the page */
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  /* color shift: orange flame → pine green (same hue-shift the UI uses) */
  filter: hue-rotate(112deg) saturate(0.55) brightness(0.6);
}

.logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 148px;
  height: 148px;
  margin: 0 auto;
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(46, 114, 88, 0.16), rgba(46, 114, 88, 0.05)),
    var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 0 50px var(--green-glow);
}

.logo-fallback .fa-hands-clapping {
  font-size: 64px;
  color: var(--green-bright);
  filter: drop-shadow(0 0 16px var(--green-glow));
}

.home-content {
  flex: 1;
  width: 100%;
  max-width: 980px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.snake-embed {
  flex: 1;
  min-height: 0;
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

#snakeFrame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* ─── Shared UI bits ──────────────────────────────────────── */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  color: #08130d;
  background: linear-gradient(135deg, var(--green-bright), var(--green));
  box-shadow: 0 6px 22px rgba(46, 114, 88, 0.35);
}

.btn-primary:hover { box-shadow: 0 8px 28px rgba(46, 114, 88, 0.5); }

.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.btn-ghost:hover { color: var(--text); border-color: var(--green); }

.input {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 114, 88, 0.18);
}

.input::placeholder { color: #6b645c; }

.screen-title { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; }

/* (legacy built-in snake styles kept for reference) */
.snake-shell { width: 100%; max-width: 520px; }

.snake-frame {
  border: 1px solid #c9bd97;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #e9e1c8;
}

.snake-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 58px;
  padding: 0 14px;
  background: #644d1f;
  user-select: none;
}

.snake-bar-scores {
  display: flex;
  align-items: center;
  gap: 10px;
}

.snake-bar-icon { font-size: 1.1rem; color: #fff; }

.snake-bar-value {
  font-family: "Nunito", "Inter", sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  min-width: 22px;
  margin-right: 4px;
}

.snake-bar-actions { display: flex; gap: 4px; }

.snake-bar-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 8px 9px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.snake-bar-btn:hover { background: rgba(0, 0, 0, 0.28); color: #fff; }

.canvas-wrap {
  position: relative;
  background: #e9e1c8;
}

#snakeCanvas { display: block; width: 100%; height: auto; background: #e9e1c8; }

.snake-keys {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.55);
  text-align: center;
}

.snake-keys .fa-arrows {
  font-size: 2.4rem;
  color: #fff;
  padding: 20px 26px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 16px;
}

.snake-keys span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.snake-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Nunito", "Inter", sans-serif;
  font-size: 7rem;
  font-weight: 900;
  color: #2e7d32;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
  pointer-events: none;
  z-index: 5;
}

.snake-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  transition: opacity 0.3s;
  padding: 20px;
}

.snake-panel {
  width: min(300px, 86%);
  background: #644d1f;
  border-radius: 10px;
  padding: 26px 30px 24px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
}

.overlay-title {
  margin: 0 0 4px;
  font-family: "Nunito", "Inter", sans-serif;
  font-size: 1.9rem;
  font-weight: 900;
  color: #fff;
}

.overlay-hint {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}

.snake-panel-scores {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 18px;
}

.snake-panel-score {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Nunito", "Inter", sans-serif;
  font-weight: 800;
  font-size: 1.55rem;
  color: #fff;
}

.snake-panel-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.btn-snake {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 800 1.05rem/1 "Nunito", "Inter", sans-serif;
  color: #fff;
  background: #56ad1e;
  border: none;
  border-radius: 10px;
  padding: 13px 26px;
  cursor: pointer;
  transition: transform 0.12s, filter 0.12s;
}

.btn-snake:hover { filter: brightness(1.12); }

.btn-snake:active { transform: scale(0.97); }

.btn-snake-shuffle {
  width: 50px;
  padding: 0;
  font-size: 1.05rem;
}

/* ─── Footer ──────────────────────────────────────────────── */
.footer {
  padding: 14px 22px;
  text-align: center;
  color: #55504a;
  font-size: 0.78rem;
  border-top: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.6);
}

@media (max-width: 520px) {
  #screen-home { padding: 14px 14px 20px; }
  .logo-wrap { width: min(320px, 78vw); margin-bottom: 12px; }
  .brand { gap: 7px; }
}

@media (max-width: 380px) {
  .brand-name { display: none; } /* keep just the green dot on tiny screens */
  .topbar { padding: 12px 14px; }
}
