/* ═══════════════════════════════════════════════════
   HISTLE — Historical Black & White Aesthetic
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=EB+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=UnifrakturCook:wght@700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --parchment: #f0ebe1;
  --parchment-dark: #e0d8c8;
  --parchment-translucent: rgba(240, 235, 225, 0.88);
  --ink: #1a1612;
  --ink-light: #3d3529;
  --ink-faded: #6b5e4f;
  --sepia: #7a6545;
  --sepia-light: #a89279;
  --gold: #8b7355;
  --border: #c4b8a4;
  --border-dark: #9e9180;
  --shadow: rgba(26, 22, 18, 0.18);
}

html {
  font-size: 16px;
}

body {
  font-family: 'EB Garamond', 'Georgia', serif;
  background-color: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* ══════════════════════════════════════
   COMPOSITE HISTORICAL BACKGROUND
   A faded montage of historical motifs
   ══════════════════════════════════════ */

.bg-montage {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Layer 1: faded engraving-style SVG collage */
.bg-montage::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    /* Compass rose — top right */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' opacity='0.06'%3E%3Ccircle cx='100' cy='100' r='90' fill='none' stroke='%234a3f30' stroke-width='1.5'/%3E%3Ccircle cx='100' cy='100' r='70' fill='none' stroke='%234a3f30' stroke-width='0.8'/%3E%3Ccircle cx='100' cy='100' r='50' fill='none' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cpath d='M100 10 L105 90 L100 100 L95 90Z' fill='%234a3f30'/%3E%3Cpath d='M100 190 L95 110 L100 100 L105 110Z' fill='%234a3f30' opacity='0.5'/%3E%3Cpath d='M10 100 L90 95 L100 100 L90 105Z' fill='%234a3f30' opacity='0.5'/%3E%3Cpath d='M190 100 L110 105 L100 100 L110 95Z' fill='%234a3f30'/%3E%3Ctext x='100' y='8' text-anchor='middle' font-size='10' fill='%234a3f30' font-family='serif'%3EN%3C/text%3E%3Ctext x='100' y='198' text-anchor='middle' font-size='10' fill='%234a3f30' font-family='serif'%3ES%3C/text%3E%3Ctext x='5' y='103' text-anchor='middle' font-size='10' fill='%234a3f30' font-family='serif'%3EW%3C/text%3E%3Ctext x='196' y='103' text-anchor='middle' font-size='10' fill='%234a3f30' font-family='serif'%3EE%3C/text%3E%3C/svg%3E"),
    /* Classical column — bottom left */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 300' opacity='0.05'%3E%3Crect x='20' y='10' width='80' height='12' rx='2' fill='%234a3f30'/%3E%3Crect x='15' y='22' width='90' height='8' fill='%234a3f30'/%3E%3Crect x='25' y='30' width='10' height='240' fill='%234a3f30'/%3E%3Crect x='45' y='30' width='10' height='240' fill='%234a3f30'/%3E%3Crect x='65' y='30' width='10' height='240' fill='%234a3f30'/%3E%3Crect x='85' y='30' width='10' height='240' fill='%234a3f30'/%3E%3Crect x='15' y='270' width='90' height='8' fill='%234a3f30'/%3E%3Crect x='10' y='278' width='100' height='12' rx='2' fill='%234a3f30'/%3E%3C/svg%3E"),
    /* Old world map grid — center */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 300' opacity='0.03'%3E%3Cellipse cx='200' cy='150' rx='180' ry='130' fill='none' stroke='%234a3f30' stroke-width='1'/%3E%3Cline x1='20' y1='150' x2='380' y2='150' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='200' y1='20' x2='200' y2='280' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cellipse cx='200' cy='150' rx='180' ry='50' fill='none' stroke='%234a3f30' stroke-width='0.3'/%3E%3Cellipse cx='200' cy='150' rx='180' ry='90' fill='none' stroke='%234a3f30' stroke-width='0.3'/%3E%3Cellipse cx='200' cy='150' rx='60' ry='130' fill='none' stroke='%234a3f30' stroke-width='0.3'/%3E%3Cellipse cx='200' cy='150' rx='120' ry='130' fill='none' stroke='%234a3f30' stroke-width='0.3'/%3E%3C/svg%3E"),
    /* Crossed swords — right side */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 150' opacity='0.04'%3E%3Cline x1='20' y1='130' x2='130' y2='20' stroke='%234a3f30' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='20' y1='20' x2='130' y2='130' stroke='%234a3f30' stroke-width='2.5' stroke-linecap='round'/%3E%3Cline x1='55' y1='95' x2='95' y2='55' stroke='%234a3f30' stroke-width='6' stroke-linecap='round'/%3E%3Cline x1='55' y1='55' x2='95' y2='95' stroke='%234a3f30' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E"),
    /* Scroll / document — left */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 180' opacity='0.04'%3E%3Cpath d='M20 20 C20 10 30 10 30 20 L30 160 C30 170 20 170 20 160Z' fill='none' stroke='%234a3f30' stroke-width='1.5'/%3E%3Cpath d='M120 20 C120 10 110 10 110 20 L110 160 C110 170 120 170 120 160Z' fill='none' stroke='%234a3f30' stroke-width='1.5'/%3E%3Crect x='30' y='15' width='80' height='150' fill='none' stroke='%234a3f30' stroke-width='0.8'/%3E%3Cline x1='40' y1='40' x2='100' y2='40' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='40' y1='55' x2='100' y2='55' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='40' y1='70' x2='90' y2='70' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='40' y1='85' x2='100' y2='85' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='40' y1='100' x2='80' y2='100' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='40' y1='115' x2='100' y2='115' stroke='%234a3f30' stroke-width='0.5'/%3E%3Cline x1='40' y1='130' x2='95' y2='130' stroke='%234a3f30' stroke-width='0.5'/%3E%3C/svg%3E"),
    /* Hourglass — bottom right */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 160' opacity='0.05'%3E%3Crect x='15' y='10' width='70' height='6' rx='3' fill='%234a3f30'/%3E%3Crect x='15' y='144' width='70' height='6' rx='3' fill='%234a3f30'/%3E%3Cpath d='M20 16 L50 78 L80 16' fill='none' stroke='%234a3f30' stroke-width='1.5'/%3E%3Cpath d='M20 144 L50 82 L80 144' fill='none' stroke='%234a3f30' stroke-width='1.5'/%3E%3Cellipse cx='50' cy='80' rx='4' ry='3' fill='%234a3f30'/%3E%3C/svg%3E");
  background-position:
    top 60px right 40px,
    bottom 40px left 30px,
    center center,
    right 60px center,
    left 50px top 40%,
    bottom 80px right 25%;
  background-size:
    320px 320px,
    140px 350px,
    700px 500px,
    180px 180px,
    160px 200px,
    120px 190px;
  background-repeat: no-repeat;
}

/* Layer 2: film grain + parchment texture */
.bg-montage::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
}

/* Vignette overlay on body */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(26, 22, 18, 0.18) 100%);
}

/* All content above the background */
header, .auth-container, .container, .toast {
  position: relative;
  z-index: 1;
}

/* ══════════════════
   HEADER
   ══════════════════ */

header {
  text-align: center;
  padding: 2.5rem 1rem 1.2rem;
  border-bottom: 2px solid var(--ink);
  background: linear-gradient(180deg, var(--parchment-translucent) 0%, rgba(240,235,225,0.75) 100%);
  backdrop-filter: blur(2px);
  position: relative;
}

header::before {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: var(--border);
}

.logo {
  font-family: 'UnifrakturCook', 'Playfair Display', serif;
  font-size: 4rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow: 2px 2px 0 rgba(139, 115, 85, 0.15);
  margin-bottom: 0.1rem;
  line-height: 1.1;
}

.tagline {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--sepia);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.user-bar {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.user-bar .username {
  color: var(--ink-faded);
  font-style: italic;
}

/* ══════════════════
   BUTTONS
   ══════════════════ */

button, .btn {
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  padding: 0.65rem 1.8rem;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: all 0.25s ease;
  text-transform: uppercase;
  position: relative;
}

button:hover, .btn:hover {
  background: var(--ink);
  color: var(--parchment);
  box-shadow: 0 2px 8px var(--shadow);
}

button.small {
  font-size: 0.85rem;
  padding: 0.35rem 1rem;
}

button.ghost {
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.3rem 0.5rem;
  text-transform: none;
}

button.ghost:hover {
  background: transparent;
  color: var(--sepia);
  box-shadow: none;
}

/* ══════════════════
   FORMS
   ══════════════════ */

input, select {
  font-family: 'EB Garamond', serif;
  font-size: 1.05rem;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.5);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.25s, box-shadow 0.25s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--border);
}

input::placeholder {
  color: var(--sepia-light);
  font-style: italic;
}

label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faded);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.form-group {
  margin-bottom: 1.3rem;
}

/* ══════════════════
   LAYOUT
   ══════════════════ */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.card {
  background: var(--parchment-translucent);
  backdrop-filter: blur(4px);
  border: 1.5px solid var(--border);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  box-shadow: 0 1px 6px rgba(26,22,18,0.06);
}

.card::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px; right: 3px; bottom: 3px;
  border: 1px solid rgba(196, 184, 164, 0.4);
  pointer-events: none;
}

.card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

/* ══════════════════
   HOW TO PLAY
   ══════════════════ */

.how-to-play {
  border: 2px solid var(--border-dark);
}

.how-to-play h2 {
  font-family: 'Playfair Display', serif;
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
}

.how-steps {
  display: grid;
  gap: 1rem;
  margin-top: 0.5rem;
}

.how-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--sepia);
  min-width: 2rem;
  text-align: center;
  line-height: 1.4;
  flex-shrink: 0;
}

.step-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-light);
}

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

/* In-app collapsible version */
.how-to-play-inline {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  background: var(--parchment-translucent);
  padding: 0;
}

.how-to-play-inline summary {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sepia);
  cursor: pointer;
  padding: 0.8rem 1.2rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.how-to-play-inline summary::before {
  content: '\25B6';
  font-size: 0.6rem;
  transition: transform 0.2s;
}

.how-to-play-inline[open] summary::before {
  transform: rotate(90deg);
}

.how-to-play-inline summary:hover {
  color: var(--ink);
}

.how-to-play-inline .how-steps {
  padding: 0 1.2rem 1.2rem;
}

/* ══════════════════
   PROMPT CARD
   ══════════════════ */

.prompt-card {
  text-align: center;
  padding: 2.5rem 2rem;
  border: 2px solid var(--ink);
  background: var(--parchment-translucent);
  backdrop-filter: blur(4px);
  position: relative;
}

.prompt-card::before {
  content: '';
  position: absolute;
  top: 5px; left: 5px; right: 5px; bottom: 5px;
  border: 1px solid var(--border);
  pointer-events: none;
}

.prompt-card::after {
  content: '';
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 0.5px solid rgba(196,184,164,0.3);
  pointer-events: none;
}

.prompt-category {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--sepia);
  margin-bottom: 0.6rem;
}

.prompt-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem;
  font-weight: 900;
  margin-bottom: 0.8rem;
  line-height: 1.2;
}

.prompt-description {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink-light);
  max-width: 540px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

.prompt-date {
  font-size: 0.78rem;
  color: var(--sepia-light);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ══════════════════
   ANSWER FORM
   ══════════════════ */

.answer-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.answer-form .form-group.full {
  grid-column: 1 / -1;
}

.answer-form .submit-row {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 0.5rem;
}

/* ══════════════════
   SCORES
   ══════════════════ */

.score-display {
  text-align: center;
  padding: 1.5rem;
}

.score-total {
  font-family: 'Playfair Display', serif;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.score-total small {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--sepia);
}

.score-breakdown {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 1.2rem;
  font-size: 0.9rem;
}

.score-item {
  text-align: center;
}

.score-item .pts {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
}

.score-item .lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--sepia);
}

.correct-answers {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--ink-faded);
  text-align: left;
}

.correct-answers h3 {
  font-family: 'Playfair Display', serif;
  margin-bottom: 0.5rem;
}

.correct-answers dt {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--sepia);
  margin-top: 0.6rem;
}

.correct-answers dd {
  margin-left: 0;
  color: var(--ink-light);
}

/* ══════════════════
   LEAGUES
   ══════════════════ */

.leagues-grid {
  display: grid;
  gap: 1rem;
}

.league-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--parchment-translucent);
}

.league-item:hover {
  border-color: var(--ink);
  box-shadow: 0 2px 8px var(--shadow);
}

.league-item .league-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.league-item .league-meta {
  font-size: 0.8rem;
  color: var(--sepia);
}

/* ══════════════════
   LEADERBOARD
   ══════════════════ */

.leaderboard {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sepia);
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem;
  text-align: left;
  font-weight: 600;
}

.leaderboard th:last-child {
  text-align: right;
}

.leaderboard td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.leaderboard td:last-child {
  text-align: right;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.leaderboard tr:first-child td {
  font-weight: 700;
}

.leaderboard .rank {
  color: var(--sepia);
  font-style: italic;
  width: 2rem;
}

.leaderboard .not-played {
  color: var(--sepia-light);
  font-style: italic;
  font-size: 0.85rem;
}

/* ══════════════════
   INVITE CODE
   ══════════════════ */

.invite-code {
  display: inline-block;
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  padding: 0.5rem 1.5rem;
  border: 2px dashed var(--border);
  background: rgba(255,255,255,0.3);
  cursor: pointer;
  transition: border-color 0.2s;
  user-select: all;
}

.invite-code:hover {
  border-color: var(--ink);
}

.invite-hint {
  font-size: 0.8rem;
  color: var(--sepia-light);
  font-style: italic;
  margin-top: 0.3rem;
}

/* ══════════════════
   AUTH PAGE
   ══════════════════ */

.auth-container {
  max-width: 480px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

.auth-container .card {
  padding: 2rem 2.5rem;
}

.auth-container .card h2 {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
}

/* ══════════════════
   DECORATIVE
   ══════════════════ */

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--sepia);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.ornament {
  text-align: center;
  font-size: 1.2rem;
  color: var(--sepia-light);
  margin: 1rem 0;
  letter-spacing: 0.3em;
}

/* ══════════════════
   TAB NAV
   ══════════════════ */

.tab-nav {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--ink);
}

.tab-nav button {
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1.8rem;
  margin-bottom: -2px;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sepia);
  background: transparent;
}

.tab-nav button:hover {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

.tab-nav button.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 700;
}

/* ══════════════════
   TOAST
   ══════════════════ */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: var(--parchment);
  padding: 0.8rem 2rem;
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  border: 1px solid var(--sepia);
  letter-spacing: 0.04em;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ══════════════════
   UTILITY
   ══════════════════ */

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }

/* ══════════════════
   ERROR
   ══════════════════ */

.error-msg {
  color: #7a3030;
  font-size: 0.9rem;
  font-style: italic;
  margin-top: 0.5rem;
  text-align: center;
}

/* ══════════════════
   RESPONSIVE
   ══════════════════ */

/* ── Tablet ── */
@media (max-width: 768px) {
  .bg-montage::before {
    background-size:
      200px 200px,
      100px 250px,
      500px 350px,
      120px 120px,
      110px 140px,
      80px 130px;
  }

  .logo { font-size: 3.2rem; }
  .prompt-title { font-size: 2rem; }
  .score-total { font-size: 3.5rem; }
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .bg-montage::before {
    opacity: 0.6;
    background-size:
      160px 160px,
      80px 200px,
      350px 250px,
      100px 100px,
      90px 120px,
      70px 110px;
  }

  .logo { font-size: 2.6rem; }
  .tagline { font-size: 0.85rem; letter-spacing: 0.12em; }

  header { padding: 1.5rem 1rem 1rem; }
  header::before { left: 5%; right: 5%; }

  .user-bar {
    position: static;
    justify-content: center;
    margin-top: 0.5rem;
  }

  .container { padding: 1.2rem 0.8rem; }

  .card { padding: 1.2rem; }
  .card::before { top: 2px; left: 2px; right: 2px; bottom: 2px; }

  .auth-container { margin: 1.5rem auto; padding: 0 0.8rem; }
  .auth-container .card { padding: 1.5rem 1.2rem; }

  /* Bigger touch targets */
  button, .btn {
    padding: 0.8rem 1.6rem;
    min-height: 48px;
    font-size: 0.95rem;
  }

  button.small {
    padding: 0.5rem 1rem;
    min-height: 40px;
  }

  input, select {
    padding: 0.75rem 0.9rem;
    min-height: 48px;
    font-size: 1.05rem;
  }

  .tab-nav button {
    padding: 0.7rem 1.2rem;
    min-height: 44px;
    font-size: 0.8rem;
  }

  /* Prompt */
  .prompt-card { padding: 1.5rem 1rem; }
  .prompt-card::after { top: 6px; left: 6px; right: 6px; bottom: 6px; }
  .prompt-title { font-size: 1.5rem; }
  .prompt-description { font-size: 1rem; }

  /* Answer form */
  .answer-form { grid-template-columns: 1fr; gap: 0.8rem; }

  /* Scores */
  .score-total { font-size: 3.5rem; }
  .score-breakdown { gap: 1.2rem; }

  /* Leagues */
  .league-item { padding: 0.9rem 1rem; }
  .league-item .league-name { font-size: 1.05rem; }

  .invite-code {
    font-size: 1.2rem;
    padding: 0.6rem 1.2rem;
    letter-spacing: 0.18em;
  }

  /* How to play */
  .how-step { gap: 0.7rem; }
  .step-number { font-size: 1.2rem; min-width: 1.6rem; }
  .step-text { font-size: 0.9rem; }

  /* Leaderboard */
  .leaderboard td { padding: 0.55rem 0.4rem; font-size: 0.9rem; }
  .leaderboard td:last-child { font-size: 1rem; }
  .leaderboard th { font-size: 0.68rem; }
}

/* ── Small phones ── */
@media (max-width: 380px) {
  .logo { font-size: 2.2rem; }
  .prompt-title { font-size: 1.3rem; }
  .score-total { font-size: 3rem; }
  .tab-nav button { padding: 0.6rem 0.8rem; font-size: 0.75rem; }
}
