/* =========================================================
   FocusLa – shared styles
   Colours and fonts live in :root so every page and game
   uses the same look. Change a value here, it changes everywhere.
   ========================================================= */

:root {
  /* Backgrounds, darkest to lightest */
  --bg: #15171c;
  --surface: #1e2128;
  --surface-2: #262a33;
  --inset: #191b21;

  /* Borders */
  --border: #2c303a;
  --border-strong: #3a404c;

  /* Text */
  --text: #eef0f4;
  --text-muted: #9aa3b2;
  --text-faint: #5b6372;

  /* Accent (buttons, highlights) */
  --accent: #7be0b0;
  --accent-text: #10231a;

  /* Type */
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;

  /* Shape */
  --radius: 16px;
  --radius-sm: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

/* ---------- Layout ---------- */

/* Centred column with side padding, used on every page */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.hero {
  margin: 32px 0 28px;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.muted {
  margin: 0;
  color: var(--text-muted);
  font-size: 17px;
}

.small {
  font-size: 14px;
}

/* ---------- Join form ---------- */

.join-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.join-form input {
  width: 96px;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.join-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.join-message {
  min-height: 21px;
  margin-top: 8px;
  text-align: right;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--text-faint);
}

.btn:disabled {
  cursor: not-allowed;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  filter: none;
}

.btn:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Category chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 36px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.chip-count {
  font-size: 12px;
  opacity: 0.75;
}

/* ---------- Sections + cards ---------- */

.sections {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.section-head {
  margin-bottom: 16px;
}

.section-title {
  margin: 0 0 2px;
  font-family: var(--font-display);
  font-size: 24px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.card-art {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  border-radius: var(--radius-sm);
  background: var(--inset);
}

.card-art img {
  max-width: 160px;
  max-height: 92px;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}

.card-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.card-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-actions .btn {
  flex: 1 1 0;
  padding: 0 10px;
}

/* ---------- Game pages (shared by every game) ---------- */

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.game-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-muted);
}

.game-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
}

/* Easy / Medium / Hard style toggle */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.segmented button {
  height: 40px;
  min-width: 80px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
}

.segmented button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scoreboard {
  display: flex;
  gap: 36px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-label {
  font-size: 13px;
  color: var(--text-muted);
}

.score-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}

.mark-x {
  color: var(--accent);
  font-weight: 700;
}

.mark-o {
  color: var(--text);
  font-weight: 700;
}

.game-status {
  min-height: 30px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.game-status[data-tone="good"] {
  color: var(--accent);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* ---------- Small screens ---------- */

@media (max-width: 560px) {
  .join-form label {
    display: none;
  }
  .join-message {
    text-align: left;
  }
}
