/* Arcade Express — « néon automnal » autumn theme (public/js/themes/automne.js; theme.js sets
   <html data-theme="automne">). Orange, maple red and gold neon glowing on a very dark brown, with falling leaves.
   Recolours the site (home, lobby, HUD, panels, results) and styles the decorations; the games keep the neon palette
   (.game-host, style.css). */

:root[data-theme="automne"] {
  --bg: #0d0806;
  --bg-2: #160d08;
  --surface: rgba(40, 20, 10, 0.75);
  --surface-solid: #2a160c;
  --surface-2: rgba(255, 236, 220, 0.05);
  --input-bg: #0a0503;
  --border: rgba(255, 150, 60, 0.18);
  --border-strong: rgba(255, 140, 0, 0.4);
  --grid: rgba(255, 130, 40, 0.06);

  --text: #fff3e6;
  --muted: #c7a88f;
  --faint: #a98d77;   /* ≥ 4.5:1 (WCAG AA) on --bg, cards and overlays */

  --accent: #ff8a00;      /* pumpkin orange */
  --accent-2: #ff3d5a;    /* maple red */
  --accent-3: #ffd000;    /* birch gold */
  --success: #3dff9a;
  --danger: #ff4d6d;
  --warning: #ffb84d;

  --accent-soft: rgba(255, 138, 0, 0.13);
  --magenta-soft: rgba(255, 61, 90, 0.15);
  --accent-end: #ff3d5a;
  --on-accent: #1f0600;
  --glow-mid: #e0402a;

  --autumn-font: 'Bungee Inline', var(--font-display);
}

:root[data-theme="automne"] body {
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(255, 120, 0, 0.26), transparent 60%),
    radial-gradient(900px 560px at 108% 8%, rgba(255, 40, 80, 0.15), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(255, 200, 0, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- Site components (never used inside the games) ---------- */

:root[data-theme="automne"] .title-display {
  font-family: var(--autumn-font);
  background: linear-gradient(90deg, #ffd000, var(--accent) 45%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 14px rgba(255, 138, 0, .55));
}
:root[data-theme="automne"] .logo-badge {
  background: linear-gradient(135deg, #3a1406, #7a2a08 55%, #c2410c);
  box-shadow: 0 14px 40px -12px var(--accent), 0 0 0 1px rgba(255, 176, 0, .35) inset;
  font-size: 46px;
}
:root[data-theme="automne"] .btn-glow {
  color: #1f0600;
  background: linear-gradient(135deg, #ffb000, #ff7a00 55%, var(--accent-2));
  box-shadow: 0 10px 34px -10px #ff8a00, 0 0 18px -4px rgba(255, 120, 0, .6), 0 0 0 1px rgba(255, 255, 255, .12) inset;
}

:root[data-theme="automne"] .room-code { text-shadow: 0 0 22px rgba(255, 176, 0, .55); }

:root[data-theme="automne"] .player-row.me,
:root[data-theme="automne"] .score-row.me,
:root[data-theme="automne"] .final-ranking li.me { box-shadow: inset 0 0 0 1px rgba(255, 138, 0, .45); }
:root[data-theme="automne"] .game-card.selected {
  background: linear-gradient(160deg, rgba(255, 138, 0, .2), rgba(255, 61, 90, .12));
  box-shadow: 0 0 22px -8px rgba(255, 138, 0, .7);
}
:root[data-theme="automne"] .toggle.on .toggle-track { box-shadow: 0 0 14px rgba(255, 138, 0, .6); }
:root[data-theme="automne"] .preset-btn.on { box-shadow: 0 0 14px rgba(255, 138, 0, .55); }
:root[data-theme="automne"] .chat-msg.mine .chat-text { color: #ffe2c2; }

:root[data-theme="automne"] .hud { background: rgba(26, 13, 7, .88); }
:root[data-theme="automne"] .hud-timer { text-shadow: 0 0 18px rgba(255, 176, 0, .6); }
/* The game board itself: the neon look of style.css, made opaque so the decorations stay out of it. */
:root[data-theme="automne"] .stage {
  background: radial-gradient(ellipse at 50% 30%, rgba(60, 80, 200, .18), transparent 70%), #050818;
}

:root[data-theme="automne"] .overlay-card,
:root[data-theme="automne"] .countdown-card { background: rgba(38, 18, 9, .93); }
:root[data-theme="automne"] .overlay-card,
:root[data-theme="automne"] .confirm-card { box-shadow: var(--shadow), 0 0 60px -18px rgba(255, 120, 0, .6); }
:root[data-theme="automne"] .overlay-roundEnd { background: rgba(13, 8, 6, .86); }
:root[data-theme="automne"] .overlay-matchEnd { background: rgba(13, 8, 6, .95); }
:root[data-theme="automne"] .confirm-dialog::backdrop { background: rgba(13, 8, 6, .8); }
:root[data-theme="automne"] .countdown-number {
  text-shadow: 0 0 30px rgba(255, 176, 0, .65), 0 0 80px rgba(255, 61, 90, .4);
}
:root[data-theme="automne"] .overlay-matchEnd .overlay-title {
  font-family: var(--autumn-font);
  font-weight: 400;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(255, 138, 0, .55);
}

/* A squash on each podium step. */
:root[data-theme="automne"] .podium-deco { top: -18px; font-size: 32px; }

/* ---------- Decorations (theme.js layers) ---------- */

/* Falling leaves: the <i> falls and drifts, its .au-flutter sways and spins. */
.au-leaves i {
  position: absolute;
  top: -40px;
  left: var(--x);
  font-size: var(--size);
  opacity: var(--alpha);
  animation: au-fall var(--dur) linear var(--delay) infinite;
}
.au-flutter { display: block; animation: au-flutter var(--sway) ease-in-out infinite alternate; }

/* Corner scenes (automne.js, VIGNETTES): props standing on the bottom edge. */
.au-corner {
  position: absolute;
  bottom: 1vh;
  display: flex;
  align-items: flex-end;
  gap: .08em;
  font-size: clamp(52px, 7vw, 96px);
}
.au-corner-left { left: 2vw; }
.au-corner-right { right: 3vw; flex-direction: row-reverse; }
.au-corner-right .au-hedgehog { transform: scaleX(-1); }
.au-prop { display: block; }
.au-small { font-size: .66em; }
.au-tiny { font-size: .4em; }
.au-lying { transform: rotate(-70deg); margin-bottom: -.1em; }
.au-lying-2 { transform: rotate(80deg); margin-bottom: -.1em; }
.au-hedgehog { font-size: .8em; }
.au-corner .au-prop:first-child .icon { animation: au-glow 4s ease-in-out infinite; }

/* A leafy twig in each top corner, swaying a little in the wind. */
.au-branch {
  position: absolute;
  top: -6px;
  font-size: clamp(90px, 12vw, 160px);
  line-height: 0;
  opacity: .8;
  transform-origin: 0 0;
  animation: au-sway 6s ease-in-out infinite;
}
.au-branch-left { left: -6px; }
.au-branch-right { right: -6px; }
.au-branch-right .icon { transform: scaleX(-1); }
.au-branch-right { transform-origin: 100% 0; animation-delay: -3s; }

/* Gusts: leaves swept across (theme-flyer), tumbling. */
.au-gust { animation-timing-function: cubic-bezier(.35, .1, .6, .9); }
.au-tumble { display: block; animation: au-tumble .9s linear infinite; }
.au-gust.rtl .au-tumble { animation-direction: reverse; }

/* A V of geese: the leader in front, each other goose --k rows behind it, on one --side of the V. */
.au-formation { position: relative; display: block; width: 1em; height: 1em; }
.au-geese.rtl .au-formation { transform: scaleX(-1); }
.au-goose {
  position: absolute;
  left: calc(var(--k) * -1.1em);
  top: calc(var(--k) * var(--side) * .5em);
  font-size: calc(1em - var(--k) * .06em);
}
.au-goose .icon { animation: au-flap .5s ease-in-out var(--flap) infinite alternate; transform-origin: 50% 55%; }

/* A squirrel running along the bottom edge, hopping. */
.au-squirrel {
  position: absolute;
  bottom: 1vh;
  left: 0;
  font-size: clamp(40px, 4.4vw, 60px);
  --rise: 0px;
  animation: theme-fly-ltr 8s linear both;
}
.au-squirrel.rtl { animation-name: theme-fly-rtl; }
.au-squirrel.rtl .icon { transform: scaleX(-1); }
.au-hop { display: block; animation: au-hop .42s ease-in-out infinite alternate; }

/* Game view: twigs only over the HUD corners, no squirrel running under the screen. */
body:has(.game-view) .au-branch { font-size: clamp(60px, 6vw, 92px); opacity: .55; }
body:has(.game-view) .au-squirrel { display: none; }
@media (max-width: 760px) {
  .au-branch { font-size: 80px; }
  .au-leaves i:nth-child(n + 11) { display: none; }
}

/* Leaves fluttering down through the final results (theme.js, resultsBurst). */
:root[data-theme="automne"] .theme-burst-item {
  top: -100px;
  animation: au-burst 4.2s cubic-bezier(.4, .1, .6, 1) var(--delay) forwards;
}

@keyframes au-fall {
  from { transform: translate(0, 0); }
  to { transform: translate(var(--drift), calc(100vh + 80px)); }
}
@keyframes au-flutter {
  from { transform: translateX(-18px) rotate(-35deg) rotateY(0deg); }
  to { transform: translateX(18px) rotate(40deg) rotateY(60deg); }
}
@keyframes au-glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25) drop-shadow(0 0 10px rgba(255, 150, 0, .55)); }
}
@keyframes au-sway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(3deg); }
}
@keyframes au-tumble {
  from { transform: rotate(0deg) rotateX(0deg); }
  to { transform: rotate(360deg) rotateX(360deg); }
}
@keyframes au-flap { to { transform: scaleY(.45); } }
@keyframes au-hop { to { transform: translateY(-14px) rotate(-4deg); } }
@keyframes au-burst {
  0% { transform: translate(0, 0) rotate(-30deg) scale(.8); opacity: 0; }
  12% { opacity: 1; }
  30% { transform: translate(calc(var(--sway) * -.6), 30vh) rotate(40deg) scale(.95); }
  55% { transform: translate(var(--sway), 60vh) rotate(-25deg) scale(1); }
  80% { opacity: .9; }
  100% { transform: translate(calc(var(--sway) * .3), 112vh) rotate(30deg) scale(1); opacity: 0; }
}
