/* ═══════════════════════════════════════════════
   Wordle — Game Room theme
   Fonts: Bebas Neue (display) · DM Sans (body) · DM Mono (mono)
   ═══════════════════════════════════════════════ */

:root {
  --bg:         #000000;
  --surface:    #121212;
  --surface2:   #181818;
  --surface3:   #282828;
  --border:     #282828;
  --border2:    #404040;
  --text:       #ffffff;
  --muted:      #a7a7a7;
  --muted2:     #535353;
  --green:      #1db954;
  --green-lt:   #1ed760;
  --green-dark: #14833c;
  --green-dim:  rgba(29,185,84,0.12);
  --green-glow: rgba(29,185,84,0.28);
  --red:        #e91429;
  --red-dim:    rgba(233,20,41,0.10);
  --yellow:     #e3a900;
  --yellow-dim: rgba(227,169,0,0.12);
  --radius:     10px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', monospace;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background: radial-gradient(ellipse 70% 50% at 10% 0%, rgba(29,185,84,0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── HOME button ── */
.home-btn {
  display: flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--muted);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  padding: 5px 12px; border: 1px solid var(--border2); border-radius: 999px;
  background: var(--surface3); transition: border-color .2s, color .2s, background .2s;
  flex-shrink: 0; white-space: nowrap;
}
.home-btn:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.home-btn svg { width: 12px; height: 12px; }

.topbar {
  position: relative; z-index: 1;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-left h1 { font-family: var(--font-display); font-size: 24px; letter-spacing: 3px; margin: 0; }
.topbar-left p { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin: 2px 0 0; }

h1, h2, h3, h4 { margin: 0 0 .6rem 0; }
p { margin: .25rem 0; }

.auth-menu {
  position: relative;
  display: grid;
  justify-items: end;
  gap: .5rem;
}

.auth-panel {
  width: min(360px, calc(100vw - 2rem));
}

.app-layout {
  position: relative; z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem;
}

.main-column {
  display: grid;
  gap: 1rem;
}

.right-sidebar {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.hidden { display: none !important; }

.row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  color: var(--muted);
  font-size: .95rem;
}

input, select {
  font: inherit;
  border-radius: 500px;
  border: 1.5px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  padding: .55rem .9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

input { min-height: 40px; }

button {
  font: inherit;
  border-radius: 500px;
  border: none;
  background: var(--green);
  color: #000;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  padding: .55rem 1rem;
  transition: transform .15s, background .15s, box-shadow .15s;
  box-shadow: 0 0 12px var(--green-glow);
}

button:hover { background: var(--green-lt); transform: translateY(-1px); box-shadow: 0 0 20px var(--green-glow); }
button.secondary { background: var(--surface3); color: var(--muted); box-shadow: none; border: 1px solid var(--border2); }
button.secondary:hover { background: var(--surface2); border-color: var(--green); color: var(--green); }
button.danger { background: var(--red); color: #fff; box-shadow: none; }
button.full-width { width: 100%; }

.mode-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: .5rem;
}

.mode-card {
  display: grid;
  gap: .1rem;
  justify-items: start;
  text-align: left;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}

.mode-card span {
  color: var(--muted);
  font-size: .85rem;
}

.mode-card.active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

#board {
  margin: .75rem auto;
  display: grid;
  gap: .4rem;
  justify-content: center;
}

.guess-row {
  display: grid;
  gap: .35rem;
  grid-template-columns: repeat(8, minmax(22px, 1fr));
}

.tile {
  border: 1px solid var(--border2);
  min-height: 38px;
  display: grid;
  place-items: center;
  font-weight: 700;
  border-radius: 8px;
  text-transform: uppercase;
}

.tile.correct { background: #1d6f3a; border-color: #1d6f3a; }
.tile.present { background: #4d4d22; border-color: #4d4d22; }
.tile.absent { background: #303030; border-color: #303030; color: var(--muted); }

/* ── Tile Input Row ── */
.tile-input-row {
  display: flex;
  gap: .4rem;
  justify-content: center;
  margin: 0 auto .75rem;
}
.tile-input-row .tile-input {
  width: 44px;
  height: 48px;
  border: 2px solid var(--border2);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  caret-color: var(--green);
  transition: border-color .15s, box-shadow .15s;
}
.tile-input-row .tile-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}
.tile-input-row .tile-input.active-cursor {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.keyboard {
  margin-top: .85rem;
  display: grid;
  gap: .4rem;
  justify-content: center;
}

.keyboard-row {
  display: flex;
  gap: .35rem;
  justify-content: center;
}

.key {
  min-height: 42px;
  min-width: 34px;
  padding: .5rem;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--muted2);
  color: var(--text);
  font-weight: 700;
}

.key.wide { min-width: 64px; }

.key.absent {
  background: var(--surface3);
  border-color: var(--surface3);
  color: var(--muted);
}

.key.present {
  background: #8a7e2f;
  border-color: #8a7e2f;
  color: var(--text);
}

.key.correct {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #000;
}

.mode-section {
  margin-top: .85rem;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}

.challenge-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem;
  margin-bottom: .5rem;
}

.challenge-item input {
  width: 100%;
  margin-top: .45rem;
}

#hint-box {
  color: var(--green-lt);
  font-size: .95rem;
}

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

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .right-sidebar {
    order: -1;
  }
  .mode-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .auth-menu {
    justify-items: stretch;
  }
  .mode-cards {
    grid-template-columns: 1fr;
  }
  .row { flex-direction: column; }
  .row > * { width: 100%; }
}

/* ── Light mode ── */
[data-theme="light"] {
  --bg:         #ffffff;
  --surface:    #f5f5f5;
  --surface2:   #eeeeee;
  --surface3:   #e0e0e0;
  --border:     #d0d0d0;
  --border2:    #b0b0b0;
  --text:       #121212;
  --muted:      #555555;
  --muted2:     #888888;
  --green-dim:  rgba(29,185,84,0.08);
  --green-glow: rgba(29,185,84,0.18);
  --red-dim:    rgba(233,20,41,0.06);
  --yellow-dim: rgba(227,169,0,0.06);
}
[data-theme="light"] body::before {
  background: radial-gradient(ellipse 70% 50% at 10% 0%, rgba(29,185,84,0.04) 0%, transparent 60%);
}
