/* ═══════════════════════════════════════════════
   Angledle — Game Room theme
   Fonts: Bebas Neue (display) · DM Sans (body) · DM Mono (mono)
   ═══════════════════════════════════════════════ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

: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-dim:  #1aa34a;
  --green-glow: rgba(29,185,84,0.28);
  --red:        #ff4444;
  --warning:    #ff6b35;
  --radius:     10px;
  --transition: 0.2s ease;
  --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; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  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;
}

/* --- Layout --- */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* --- Top bar --- */
.topbar {
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.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;
  white-space: nowrap;
}
.home-btn:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.home-btn svg { width: 12px; height: 12px; }

.settings-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border2);
  border-radius: 50%;
  background: var(--surface3);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.settings-btn:hover { border-color: var(--green); color: var(--green); background: var(--green-dim); transform: rotate(30deg); }
.settings-btn svg { width: 18px; height: 18px; }

/* --- Header --- */
.header { text-align: center; margin-bottom: 1.5rem; }

.title {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 4px;
  line-height: 1;
  color: var(--text);
}
.title .accent { color: var(--green); }

.subtitle {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--muted2);
  text-transform: uppercase;
}

/* --- Stats --- */
.stats-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  width: 100%;
  max-width: 460px;
  margin-bottom: 1.25rem;
}
.stats-bar.hidden { display: none; }
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* --- Angle diagram --- */
.board-wrap {
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 1.25rem;
  transition: box-shadow .3s ease, border-color .3s ease;
}
.board-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
.board-wrap.solved {
  border-color: var(--green);
  box-shadow: 0 0 30px var(--green-glow);
}

/* SVG element colours (theme-aware) */
.angle-ray { stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.target-ray { stroke: var(--green); }
.angle-arc { stroke: var(--green); stroke-width: 3; fill: none; stroke-linecap: round; }
.arc-arrow { fill: var(--green); }
.guess-line { stroke: var(--muted2); stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; opacity: 0.9; }
.vertex-dot { fill: var(--text); }

/* --- Feedback --- */
.feedback {
  min-height: 2.2rem;
  margin-bottom: 1rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  transition: border-color .2s, color .2s, background .2s;
}
.feedback.higher { border-color: var(--warning); color: var(--warning); background: rgba(255,107,53,0.08); }
.feedback.lower  { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,0.08); }
.feedback.win    { border-color: var(--green); color: var(--green); background: rgba(29,185,84,0.12); }
.feedback.error  { border-color: var(--red); color: var(--red); background: rgba(255,68,68,0.08); }

/* --- Guess area --- */
.guess-area {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 460px;
}
.guess-area input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -moz-appearance: textfield;
  appearance: textfield;
}
.guess-area input::-webkit-outer-spin-button,
.guess-area input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.guess-area input::placeholder { color: var(--muted2); }
.guess-area input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,185,84,0.12); }
.guess-area input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,68,68,0.12); }
.guess-area input:disabled { opacity: 0.5; }

.guess-btn {
  flex: 0 0 auto;
  padding: 12px 26px;
  border: none;
  border-radius: 999px;
  background: var(--green);
  color: #041005;
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 0 16px var(--green-glow);
}
.guess-btn:hover { background: var(--green-lt); transform: scale(1.03); }
.guess-btn:active { transform: scale(0.97); }
.guess-btn:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

/* 3-column segmented control (shared settings.css provides 2 & 4) */
.segmented-control.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* --- Responsive --- */
@media (max-width: 520px) {
  .app { padding: 5rem 1rem 2.5rem; }
  .title { font-size: 2.4rem; }
  .stats-bar { gap: 8px; }
  .guess-btn { padding: 12px 18px; }
}

/* ── Light mode ── */
[data-theme="light"] {
  --bg:         #ffffff;
  --surface:    #f5f5f5;
  --surface2:   #eeeeee;
  --surface3:   #e0e0e0;
  --border:     #d0d0d0;
  --border2:    #b0b0b0;
  --text:       #121212;
  --muted:      #555555;
  --muted2:     #767676;
  --green-dim:  #1aa34a;
  --green-glow: rgba(29,185,84,0.20);
}
[data-theme="light"] body::before {
  background: radial-gradient(ellipse 70% 50% at 10% 0%, rgba(29,185,84,0.04) 0%, transparent 60%);
}
[data-theme="light"] .guess-btn { color: #ffffff; }
