/* =========================================================================
   DICE BLAZE — shared theme + lobby
   Loaded by lobby.html and launcher.php (game also loads game.css after it)
   ========================================================================= */

/* ---------- Fonts ---------- */
@font-face {
  font-family: Cinzel;
  src: url("../fonts/Cinzel-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Cinzel;
  src: url("../fonts/Cinzel-latin-ext.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Alegreya;
  src: url("../fonts/Alegreya-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Alegreya;
  src: url("../fonts/Alegreya-latin-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Alegreya;
  src: url("../fonts/Alegreya-cyrillic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Alegreya;
  src: url("../fonts/Alegreya-cyrillic-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Alegreya SC";
  src: url("../fonts/AlegreyaSC-cyrillic-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: DHunter;
  src: url("../fonts/DH-9Ynxj.otf") format("opentype");
  font-display: swap;
}

/* ---------- Theme tokens ---------- */
:root {
  --font-display: Cinzel, "Alegreya SC", Alegreya, Georgia, serif;
  --font-body: Alegreya, Georgia, "Times New Roman", serif;
  --font-brand: DHunter, Cinzel, serif;

  --gold-hi: #fff4cf;
  --gold-1: #f7dc8e;
  --gold-2: #e2b65a;
  --gold-3: #b9862f;
  --gold-4: #7d5418;
  --gold-5: #3e2808;

  --ember-hi: #ffd27a;
  --ember: #ff8f1f;
  --ember-2: #f26a0f;
  --ember-deep: #a8380a;

  --blood: #d01d22;
  --blood-deep: #5e0609;
  --mana: #3d8bff;
  --mana-deep: #0d2a78;
  --arcane: #46d6e4;
  --playable: #6dff7a;

  --wood-0: #140b06;
  --wood-1: #22140b;
  --wood-2: #33200f;
  --wood-3: #4a2f18;
  --stone-0: #0d0c10;
  --stone-1: #17151b;
  --stone-2: #221f27;
  --stone-3: #322d36;

  --text: #f5ead2;
  --text-dim: #c6b393;
  --text-mute: #8f7f66;
  --ink: #2a1505;

  --gold-border: linear-gradient(160deg, #fff1bf 0%, #e7bd60 18%, #9a6a22 42%, #f3d283 62%, #7a5016 82%, #e9c26b 100%);
  --ember-fill: linear-gradient(180deg, #ffe08a 0%, #ffb23c 30%, #f2770f 70%, #c24a0a 100%);

  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='300'><filter id='w'><feTurbulence type='fractalNoise' baseFrequency='.004 .09' numOctaves='4' seed='7' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .08  0 0 0 0 .04  0 0 0 0 .01  0 0 0 .9 -.2'/></filter><rect width='100%' height='100%' filter='url(%23w)'/></svg>");
}

/* ---------- Base ---------- */
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

html,
body {
  min-width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--stone-0);
  color: var(--text);
  font-family: var(--font-body);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.35); border-radius: 10px; }
::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold-4));
  border: 2px solid rgba(0, 0, 0, 0.35);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--gold-1), var(--gold-3)); }

/* ---------- Ambient scene (shared) ---------- */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 110%, #3b1a08 0%, #170c08 45%, #07060a 100%);
}

.scene-art {
  position: absolute;
  inset: -3%;
  background: url("../images/header_background.webp") center 30% / cover no-repeat;
  opacity: 0.55;
  filter: saturate(0.75) brightness(0.8);
  animation: scene-drift 60s ease-in-out infinite alternate;
}

.scene-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 45% at 50% 105%, rgba(255, 120, 30, 0.45), transparent 70%),
    radial-gradient(30% 30% at 15% 100%, rgba(255, 90, 20, 0.25), transparent 70%),
    radial-gradient(30% 30% at 85% 100%, rgba(255, 90, 20, 0.25), transparent 70%);
  mix-blend-mode: screen;
  animation: scene-flicker 5s ease-in-out infinite;
}

.scene-fog {
  position: absolute;
  inset: -20%;
  background: url("../images/fog.png") center / 120% auto repeat-x;
  opacity: 0.12;
  animation: scene-fog 80s linear infinite;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
}

@keyframes scene-drift { to { transform: scale(1.06) translate3d(-1%, -1%, 0); } }
@keyframes scene-fog { to { background-position: 1200px 0; } }
@keyframes scene-flicker {
  0%, 100% { opacity: 0.9; }
  45% { opacity: 1; }
  60% { opacity: 0.8; }
}

/* Rising embers — pure CSS, 24 particles */
.embers {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.embers i {
  position: absolute;
  bottom: -20px;
  left: var(--x, 50%);
  width: var(--s, 4px);
  height: var(--s, 4px);
  border-radius: 50%;
  background: radial-gradient(circle, #fff3c4 0%, #ffb347 40%, rgba(255, 110, 20, 0) 70%);
  box-shadow: 0 0 6px 2px rgba(255, 140, 40, 0.55);
  opacity: 0;
  animation: ember-rise var(--d, 9s) linear var(--w, 0s) infinite;
  will-change: transform, opacity;
}

.embers i:nth-child(1)  { --x: 4%;  --s: 3px; --d: 11s; --w: -1s;  --sway: 30px; }
.embers i:nth-child(2)  { --x: 9%;  --s: 5px; --d: 8s;  --w: -5s;  --sway: -20px; }
.embers i:nth-child(3)  { --x: 14%; --s: 2px; --d: 13s; --w: -9s;  --sway: 40px; }
.embers i:nth-child(4)  { --x: 19%; --s: 4px; --d: 10s; --w: -3s;  --sway: -35px; }
.embers i:nth-child(5)  { --x: 23%; --s: 3px; --d: 12s; --w: -7s;  --sway: 25px; }
.embers i:nth-child(6)  { --x: 28%; --s: 6px; --d: 9s;  --w: -2s;  --sway: -15px; }
.embers i:nth-child(7)  { --x: 33%; --s: 2px; --d: 14s; --w: -11s; --sway: 35px; }
.embers i:nth-child(8)  { --x: 38%; --s: 4px; --d: 10s; --w: -6s;  --sway: -40px; }
.embers i:nth-child(9)  { --x: 42%; --s: 3px; --d: 12s; --w: -4s;  --sway: 20px; }
.embers i:nth-child(10) { --x: 47%; --s: 5px; --d: 9s;  --w: -8s;  --sway: -25px; }
.embers i:nth-child(11) { --x: 51%; --s: 2px; --d: 13s; --w: -1s;  --sway: 30px; }
.embers i:nth-child(12) { --x: 56%; --s: 4px; --d: 11s; --w: -10s; --sway: -30px; }
.embers i:nth-child(13) { --x: 60%; --s: 3px; --d: 10s; --w: -5s;  --sway: 45px; }
.embers i:nth-child(14) { --x: 65%; --s: 6px; --d: 8s;  --w: -3s;  --sway: -20px; }
.embers i:nth-child(15) { --x: 69%; --s: 2px; --d: 14s; --w: -12s; --sway: 25px; }
.embers i:nth-child(16) { --x: 74%; --s: 4px; --d: 9s;  --w: -7s;  --sway: -35px; }
.embers i:nth-child(17) { --x: 78%; --s: 3px; --d: 12s; --w: -2s;  --sway: 20px; }
.embers i:nth-child(18) { --x: 83%; --s: 5px; --d: 10s; --w: -9s;  --sway: -25px; }
.embers i:nth-child(19) { --x: 87%; --s: 2px; --d: 13s; --w: -4s;  --sway: 35px; }
.embers i:nth-child(20) { --x: 92%; --s: 4px; --d: 11s; --w: -6s;  --sway: -30px; }
.embers i:nth-child(21) { --x: 96%; --s: 3px; --d: 9s;  --w: -1s;  --sway: 15px; }
.embers i:nth-child(22) { --x: 36%; --s: 7px; --d: 15s; --w: -13s; --sway: -50px; }
.embers i:nth-child(23) { --x: 62%; --s: 7px; --d: 16s; --w: -8s;  --sway: 50px; }
.embers i:nth-child(24) { --x: 12%; --s: 6px; --d: 15s; --w: -10s; --sway: 40px; }

@keyframes ember-rise {
  0%   { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
  8%   { opacity: 1; }
  50%  { transform: translate3d(var(--sway, 20px), -50vh, 0) scale(0.85); }
  85%  { opacity: 0.7; }
  100% { transform: translate3d(calc(var(--sway, 20px) * -0.6), -105vh, 0) scale(0.4); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .embers, .scene-fog { display: none; }
  .scene-art, .scene-glow, #login-page::after, #searchingGame::after, content div.menu span a.bigBtn { animation: none; }
}

/* ---------- Ornate panel (shared) ---------- */
.panel,
#login-page,
#download-app,
#registration,
#assets-loader,
content,
#searchingGame,
#opponentFound,
#discordPopup {
  box-sizing: border-box;
  color: var(--text);
  border: 3px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, 0.06), rgba(0, 0, 0, 0) 30%) padding-box,
    var(--grain) center / 100% 100% no-repeat padding-box,
    linear-gradient(180deg, #3a2414 0%, #24150b 55%, #1a0f08 100%) padding-box,
    var(--gold-border) border-box;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.8),
    0 18px 50px rgba(0, 0, 0, 0.75),
    0 0 40px rgba(255, 120, 30, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 0 0 4px rgba(255, 210, 130, 0.07),
    inset 0 0 60px rgba(0, 0, 0, 0.55);
}

/* corner rivets */
.panel::before,
#login-page::before,
content::before,
#registration::before,
#opponentFound::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border-radius: 9px;
  background:
    radial-gradient(circle at 6px 6px, var(--gold-1) 0 2px, var(--gold-4) 3px, transparent 4px) top left / 12px 12px no-repeat,
    radial-gradient(circle at 6px 6px, var(--gold-1) 0 2px, var(--gold-4) 3px, transparent 4px) top right / 12px 12px no-repeat,
    radial-gradient(circle at 6px 6px, var(--gold-1) 0 2px, var(--gold-4) 3px, transparent 4px) bottom left / 12px 12px no-repeat,
    radial-gradient(circle at 6px 6px, var(--gold-1) 0 2px, var(--gold-4) 3px, transparent 4px) bottom right / 12px 12px no-repeat;
  opacity: 0.85;
}

/* ---------- Buttons ---------- */
.btn,
button.fancy {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  box-sizing: border-box;
  padding: 0.7em 1.5em 0.62em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.1;
  cursor: pointer;
  border-radius: 10px;
  border: 2px solid transparent;
  color: var(--text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 45%) padding-box,
    linear-gradient(180deg, #4b3020, #2a180c) padding-box,
    linear-gradient(180deg, var(--gold-1), var(--gold-3) 50%, var(--gold-4)) border-box;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.75),
    0 4px 10px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 240, 200, 0.25),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.btn:hover,
button.fancy:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.75),
    0 8px 18px rgba(0, 0, 0, 0.6),
    0 0 18px rgba(255, 170, 60, 0.35),
    inset 0 1px 0 rgba(255, 240, 200, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.35);
}

.btn:active,
button.fancy:active {
  transform: translateY(1px);
  filter: brightness(0.95);
}

.btn:focus-visible,
button.fancy:focus-visible {
  box-shadow: 0 0 0 2px var(--stone-0), 0 0 0 4px var(--ember-hi);
}

.btn:disabled,
button.fancy:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7) brightness(0.7);
  transform: none;
}

/* primary: molten gold */
.btn--primary {
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 42%) padding-box,
    var(--ember-fill) padding-box,
    linear-gradient(180deg, #fff2c4, #c98a2a 45%, #5e3a0c) border-box;
  box-shadow:
    0 0 0 1px rgba(40, 15, 0, 0.9),
    0 6px 14px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(255, 140, 30, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -3px 0 rgba(120, 40, 0, 0.45);
}

.btn--primary:hover {
  box-shadow:
    0 0 0 1px rgba(40, 15, 0, 0.9),
    0 10px 22px rgba(0, 0, 0, 0.55),
    0 0 34px rgba(255, 150, 40, 0.6),
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    inset 0 -3px 0 rgba(120, 40, 0, 0.45);
}

.btn--ghost {
  background:
    linear-gradient(180deg, #2e1d11, #1a0f08) padding-box,
    linear-gradient(180deg, var(--gold-2), var(--gold-4)) border-box;
  color: var(--gold-1);
}

.btn--lg { font-size: 18px; padding: 0.8em 2em 0.72em; }
.btn--sm { font-size: 12px; padding: 0.55em 1.1em 0.5em; }
.btn--block { display: flex; width: 100%; }

/* ---------- Inputs ---------- */
.lobby input[type="text"],
.lobby input[type="password"],
.lobby input[type="email"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 12px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 19px;
  color: var(--text);
  background:
    linear-gradient(180deg, #0e0704, #1c1008) padding-box,
    linear-gradient(180deg, var(--gold-4), var(--gold-3) 60%, var(--gold-2)) border-box;
  border: 2px solid transparent;
  border-radius: 9px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 220, 160, 0.08);
  outline: none;
  transition: box-shadow 0.2s ease;
}

.lobby input::placeholder { color: var(--text-mute); font-style: italic; }

.lobby input[type="text"]:focus,
.lobby input[type="password"]:focus,
.lobby input[type="email"]:focus {
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 160, 60, 0.7), 0 0 16px rgba(255, 140, 30, 0.45);
}

.lobby input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  background:
    linear-gradient(180deg, #0e0704, #22130a) padding-box,
    linear-gradient(180deg, var(--gold-2), var(--gold-4)) border-box;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
  display: inline-grid;
  place-content: center;
  vertical-align: middle;
}

.lobby input[type="checkbox"]::after {
  content: "";
  width: 12px;
  height: 12px;
  transform: scale(0);
  transition: transform 0.15s ease;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: var(--ember-fill);
  filter: drop-shadow(0 0 3px rgba(255, 150, 40, 0.9));
}

.lobby input[type="checkbox"]:checked::after { transform: scale(1); }

/* ---------- Tooltip (shared base; game.css refines) ---------- */
.tooltip {
  display: none;
  position: absolute;
  z-index: 2147485450;
  width: 380px;
  max-width: 90%;
  box-sizing: border-box;
  padding: 14px 18px 14px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.35;
  white-space: normal;
  color: var(--text);
  border: 2px solid transparent;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 230, 180, 0.08), rgba(0, 0, 0, 0) 40%) padding-box,
    linear-gradient(180deg, #2c1b10, #170d07) padding-box,
    var(--gold-border) border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 14px 34px rgba(0, 0, 0, 0.7);
  transform-origin: 50% 100%;
}

.tooltip span {
  display: block;
  margin: 0 0 6px;
  padding-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--gold-1);
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, rgba(226, 182, 90, 0.8), rgba(226, 182, 90, 0)) 1;
}

.tooltip p { margin: 0; color: var(--text-dim); }
.tooltip p b, .tooltip p i { color: var(--text); }

/* ---------- Level ring ---------- */
level {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0;
  display: inline-flex;
  background: conic-gradient(var(--ember) var(--deg, 0deg), rgba(255, 143, 31, 0.18) 0deg);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 140, 30, 0.35);
}

level::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a2d16, #1a0e06);
  box-shadow: inset 0 1px 2px rgba(255, 220, 160, 0.2);
}

level::after {
  content: attr(data-level);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  color: var(--gold-1);
}

/* ---------- Dim ---------- */
#dim-background {
  position: fixed;
  z-index: 100;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(ellipse at center, rgba(10, 5, 2, 0.55), rgba(0, 0, 0, 0.85));
  backdrop-filter: blur(2px);
}

.float-animation { animation: float-animation 4s ease-in-out infinite alternate; }
@keyframes float-animation { 100% { transform: translateY(-8px); } }

/* =========================================================================
   LOBBY
   ========================================================================= */

body.lobby { overflow: hidden; }

/* #lobbyBody must not create a stacking context: #opponentFound (z 150) has to sit above #dim-background (z 100) */

/* ---------- Asset loader ---------- */
#assets-loader {
  position: fixed;
  z-index: 5;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 90vw);
  padding: 38px 40px 34px;
  text-align: center;
}

#assets-loader::after {
  content: "";
  display: block;
  position: absolute;
  top: -62px;
  left: 50%;
  width: 110px;
  height: 140px;
  margin-left: -55px;
  background: url("../images/logo.webp") center / contain no-repeat;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 20px rgba(255, 120, 30, 0.45));
  animation: float-animation 2.4s ease-in-out infinite alternate;
}

#assets-loader h2 {
  margin: 48px 0 6px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.14em;
  color: var(--gold-1);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8), 0 0 18px rgba(255, 150, 40, 0.35);
}

#assets-loader p {
  margin: 0 0 22px;
  font-size: 18px;
  color: var(--text-dim);
  font-style: italic;
}

#assets-loader div {
  position: relative;
  height: 18px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background:
    linear-gradient(180deg, #0b0604, #22130a) padding-box,
    linear-gradient(180deg, var(--gold-2), var(--gold-4)) border-box;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.8);
}

#assets-loader div > span {
  position: relative;
  display: block;
  width: var(--width-loader, 0%);
  height: 100%;
  border-radius: 8px;
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.16) 0 8px, rgba(255, 255, 255, 0) 8px 16px),
    var(--ember-fill);
  background-size: 22px 22px, 100% 100%;
  box-shadow: 0 0 14px rgba(255, 140, 30, 0.8);
  transition: width 0.25s ease;
  animation: loader-stripes 0.8s linear infinite;
}

#assets-loader div > span::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #ffd27a 40%, rgba(255, 140, 30, 0) 70%);
  box-shadow: 0 0 12px 6px rgba(255, 170, 60, 0.7);
}

@keyframes loader-stripes { to { background-position: 22px 0, 0 0; } }

/* ---------- Login ---------- */
.chain {
  position: absolute;
  display: none;
  width: 15px;
  z-index: 0;
  background-image: url("/assets/images/Chain.webp");
  background-repeat: repeat-y;
  background-size: contain;
  filter: drop-shadow(3px 3px 2px rgba(0, 0, 0, 0.6)) sepia(0.6) saturate(1.4) brightness(0.85);
}

#login-page,
#download-app,
#registration {
  position: absolute;
  z-index: 1;
  width: min(500px, 92vw);
  padding: 26px 34px 24px;
}

/* breathing glow: opacity-animated pseudo (composited) instead of animating box-shadow */
#login-page::after,
#searchingGame::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -3px;
  border-radius: 14px;
  pointer-events: none;
  box-shadow: 0 0 70px rgba(255, 120, 30, 0.38);
  opacity: 0;
  animation: glow-breathe 4s ease-in-out infinite;
}

#searchingGame::after { animation-duration: 2.4s; }

@keyframes glow-breathe { 50% { opacity: 1; } }

#login-page > img {
  z-index: 3;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(255, 120, 30, 0.4));
}

#login-page h2,
#registration h2 {
  margin: 40px 0 6px;
  padding: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--text);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.9), 0 0 16px rgba(0, 0, 0, 0.6);
}

#login-page h2 b,
#registration h2 b {
  display: block;
  margin-top: 2px;
  font-family: var(--font-brand);
  font-weight: normal;
  font-size: 46px;
  letter-spacing: 0.08em;
  color: var(--ember);
  background: linear-gradient(180deg, #fff1a8 10%, #ffb23c 45%, #f05a0a 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.85)) drop-shadow(0 0 14px rgba(255, 110, 20, 0.45));
}

#login-page .login-sub {
  margin: 0 0 20px;
  text-align: center;
  font-style: italic;
  font-size: 17px;
  color: var(--text-dim);
}

#login-page .login-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

#login-page .login-actions .btn { flex: 1; }

#login-page hr,
.ornament-divider {
  position: relative;
  height: 14px;
  margin: 20px 0 16px;
  border: 0;
  background:
    linear-gradient(90deg, rgba(226, 182, 90, 0), rgba(226, 182, 90, 0.85) 30%, rgba(226, 182, 90, 0.85) 70%, rgba(226, 182, 90, 0)) center / 100% 1px no-repeat;
  overflow: visible;
}

#login-page hr::after,
.ornament-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  transform: rotate(45deg);
  background: var(--ember-fill);
  box-shadow: 0 0 0 2px #24150b, 0 0 0 3px var(--gold-3), 0 0 12px rgba(255, 140, 30, 0.7);
}

#login-page .guest-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

#login-page .guest-row .btn { flex: 1; }

.exit-game {
  display: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  transition: color 0.2s ease;
}

.exit-game:hover { color: var(--ember-hi); }

#login-page .exit-game {
  position: absolute;
  top: 18px;
  right: 22px;
}

span.footer_social {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

span.footer_social a { display: inline-flex; }

span.footer_social img {
  width: 26px;
  height: 26px;
  opacity: 0.85;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
  transition: opacity 0.2s ease;
}

span.footer_social a:hover img { opacity: 1; }

#download-app {
  padding: 16px 24px 18px;
  text-align: center;
}

#download-app p {
  margin: 0 0 12px;
  font-size: 18px;
  font-style: italic;
  color: var(--text-dim);
}

#download-app > div { text-align: center; }

/* ---------- Registration ---------- */
#registration { z-index: 101; }

#registration h2 { margin-top: 10px; margin-bottom: 18px; font-size: 24px; }

#registration > span {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--gold-1);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px var(--gold-4);
  transition: background 0.2s ease;
}

#registration > span:hover { background: rgba(255, 120, 30, 0.35); }

#registration img {
  display: block;
  margin: 2px auto 10px;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--gold-4);
}

#registration .btn { width: 100%; margin-top: 4px; }

#registration > div > div {
  padding: 18px 8px 8px;
  text-align: center;
  font-size: 22px;
  color: var(--gold-1);
}

/* ---------- Main content frame ---------- */
content {
  position: fixed;
  display: block;
  width: min(1500px, 95vw);
  height: 94vh;
  overflow: hidden;
  padding: 0;
  border-radius: 18px;
  background:
    radial-gradient(70% 40% at 50% 0%, rgba(255, 160, 70, 0.1), rgba(0, 0, 0, 0) 70%) padding-box,
    var(--grain) center / 100% 100% no-repeat padding-box,
    linear-gradient(180deg, #2a1a0e 0%, #1a100a 55%, #110a06 100%) padding-box,
    var(--gold-border) border-box;
}

content .topbar {
  position: relative;
  height: 132px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0)) padding-box;
}

content .topbar::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(226, 182, 90, 0), var(--gold-2) 20%, var(--gold-1) 50%, var(--gold-2) 80%, rgba(226, 182, 90, 0));
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 170, 60, 0.35);
}

content span.logo {
  position: absolute;
  z-index: 2;
  left: 22px;
  top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

content img#logo {
  width: 92px;
  display: inline-block;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 18px rgba(255, 110, 20, 0.35));
}

content span.logo br { display: none; }

content span.logo b {
  display: none;
  font-family: var(--font-brand);
  font-weight: normal;
  font-size: 34px;
  line-height: 0.9;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff1a8 10%, #ffb23c 45%, #f05a0a 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.85));
}

content div.menu {
  display: none;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  padding-top: 34px;
  text-align: center;
  pointer-events: none;
}

content div.menu span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 40px;
  pointer-events: auto;
  background:
    linear-gradient(180deg, #120a05, #22150b) padding-box,
    linear-gradient(180deg, var(--gold-2), var(--gold-4)) border-box;
  border: 2px solid transparent;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 220, 160, 0.1), 0 6px 18px rgba(0, 0, 0, 0.5);
}

content div.menu a {
  position: relative;
  display: inline-block;
  padding: 12px 22px 10px;
  border-radius: 30px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-dim);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
  transition: color 0.2s ease, background 0.2s ease;
}

content div.menu a:not(.bigBtn):hover { color: var(--gold-1); background: rgba(255, 200, 120, 0.06); }

content div.menu a:not(.bigBtn).active {
  color: var(--gold-hi);
  background: radial-gradient(ellipse at 50% 120%, rgba(255, 150, 40, 0.35), rgba(255, 150, 40, 0) 70%);
}

content div.menu a:not(.bigBtn).active::after {
  content: "";
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--ember);
  box-shadow: 0 0 8px var(--ember);
}

content div.menu span a.bigBtn {
  transform: scale(0);
  margin: -26px 8px;
  width: 112px;
  height: 112px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6);
  border: 3px solid transparent;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 45%) padding-box,
    radial-gradient(circle at 50% 60%, #ffcf5a, #f58a1a 55%, #a8380a 100%) padding-box,
    linear-gradient(160deg, #fff4cf, #b9862f 40%, #5e3a0c 70%, #e2b65a) border-box;
  box-shadow:
    0 0 0 2px rgba(30, 10, 0, 0.9),
    0 0 0 7px rgba(36, 21, 11, 0.95),
    0 0 0 9px var(--gold-3),
    0 10px 26px rgba(0, 0, 0, 0.7),
    0 0 40px rgba(255, 130, 30, 0.55),
    inset 0 -6px 12px rgba(120, 30, 0, 0.5);
  animation: play-pulse 2.6s ease-in-out infinite;
}

content div.menu span a.bigBtn:hover { filter: brightness(1.1) saturate(1.1); }

@keyframes play-pulse {
  50% {
    box-shadow:
      0 0 0 2px rgba(30, 10, 0, 0.9),
      0 0 0 7px rgba(36, 21, 11, 0.95),
      0 0 0 9px var(--gold-2),
      0 10px 26px rgba(0, 0, 0, 0.7),
      0 0 70px rgba(255, 140, 30, 0.85),
      inset 0 -6px 12px rgba(120, 30, 0, 0.5);
  }
}

/* profile plaque */
content div.profile {
  position: absolute;
  z-index: 5;
  display: none;
  grid-template-columns: auto auto;
  grid-template-areas: "name logout" "bp logout";
  column-gap: 16px;
  row-gap: 6px;
  align-items: center;
  top: 26px;
  right: 24px;
  padding: 10px 12px 10px 14px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #140b06, #22150b) padding-box,
    linear-gradient(180deg, var(--gold-3), var(--gold-5)) border-box;
  border: 1px solid transparent;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.7), 0 6px 14px rgba(0, 0, 0, 0.4);
}

content div.profile b {
  grid-area: name;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--text);
}

content div.profile b.name span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

content div.profile b.bp {
  grid-area: bp;
  justify-self: start;
  position: relative;
  display: inline-flex;
  gap: 6px;
  margin: 0;
  padding: 3px 12px 3px 34px;
  font-size: 15px;
  color: var(--gold-1);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 120, 30, 0.35), rgba(120, 40, 0, 0.35));
  box-shadow: inset 0 0 0 1px rgba(255, 170, 60, 0.55);
}

content div.profile b.bp::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  border-radius: 50%;
  background: url("../images/bp.png") center / 70% no-repeat, radial-gradient(circle at 35% 30%, #fff4cf, #e2b65a 45%, #7d5418);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 170, 60, 0.5);
}

#logout { grid-area: logout; display: flex; }

content div.profile b.hide { display: none; }

content div.profile b.name.anonymous { font-weight: 600; font-style: italic; color: var(--text-dim); }
content div.profile b.name.anonymous level { display: none; }

/* page area */
#current-page {
  display: none;
  clear: both;
  box-sizing: border-box;
  margin: 0 18px;
  padding: 24px 18px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  transform: translateY(5px);
}

content span.footer_social {
  display: none;
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 10px;
  float: none;
  text-align: right;
  padding: 8px 0 0;
  border-top: 1px solid rgba(226, 182, 90, 0.25);
}

content span.footer_social a { margin-left: 8px; vertical-align: middle; }

content .exit-game {
  float: left;
  margin-top: 6px;
}

/* ---------- Page: shared typography ---------- */
#current-page h1,
#current-page h2,
#current-page h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-1);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.8);
}

#current-page p,
#current-page li {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-dim);
}

#current-page a {
  color: var(--ember-hi);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 210, 122, 0.4);
  transition: color 0.2s ease, border-color 0.2s ease;
}

#current-page a:hover { color: var(--gold-hi); border-color: var(--gold-hi); }

.page-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 22px;
}

.page-title::before,
.page-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(226, 182, 90, 0), rgba(226, 182, 90, 0.7));
}

.page-title::after { background: linear-gradient(90deg, rgba(226, 182, 90, 0.7), rgba(226, 182, 90, 0)); }

#current-page .page-title h2 { margin: 0; font-size: 26px; letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------- Page: Play ---------- */
#page-play .modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  max-width: 1180px;
  margin: 0 auto;
}

#page-play .game-type {
  position: relative;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  box-sizing: border-box;
  padding: 24px 24px 22px;
  border-radius: 14px;
  border: 2px solid transparent;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 150, 50, 0.12), rgba(0, 0, 0, 0) 55%) padding-box,
    linear-gradient(180deg, #2a1a0f, #150c07) padding-box,
    linear-gradient(160deg, var(--gold-2), var(--gold-5) 40%, var(--gold-4) 70%, var(--gold-2)) border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 10px 26px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 220, 160, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#page-play .game-type:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8), 0 16px 34px rgba(0, 0, 0, 0.6), 0 0 28px rgba(255, 140, 30, 0.22), inset 0 1px 0 rgba(255, 220, 160, 0.14);
}

#page-play .game-type--featured {
  grid-row: span 3;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  min-height: 420px;
  padding: 28px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 10, 4, 0) 0%, rgba(20, 10, 4, 0.6) 45%, rgba(20, 10, 4, 0.97) 75%) padding-box,
    url("../images/heroes/big/Ardent.webp") 120% 10% / 62% auto no-repeat padding-box,
    url("../images/heroes/big/Lyra.webp") -22% 10% / 60% auto no-repeat padding-box,
    radial-gradient(80% 70% at 50% 25%, rgba(255, 140, 40, 0.35), rgba(0, 0, 0, 0) 70%) padding-box,
    linear-gradient(180deg, #2c1a0e, #140b06) padding-box,
    linear-gradient(160deg, var(--gold-1), var(--gold-4) 40%, var(--gold-3) 70%, var(--gold-1)) border-box;
}

#page-play .game-type--featured .mode-emblem { position: absolute; top: 22px; left: 22px; }

#page-play .mode-emblem {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, #5a2a10, #1e0d05 70%);
  box-shadow: 0 0 0 2px #120803, 0 0 0 4px var(--gold-3), 0 6px 14px rgba(0, 0, 0, 0.6), inset 0 0 14px rgba(255, 120, 30, 0.35);
}

#page-play .mode-emblem::before {
  content: "";
  width: 60%;
  height: 60%;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-2) 50%, var(--ember-2));
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.8));
}

#page-play .mode-body { flex: 1; min-width: 0; }
#page-play .game-type--featured .mode-body { flex: none; }

#page-play .game-type h2 {
  margin: 4px 0 6px;
  font-size: 23px;
  letter-spacing: 0.06em;
  text-align: left;
}

#page-play .game-type--featured h2 { font-size: 34px; color: var(--gold-hi); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.85), 0 0 20px rgba(255, 140, 30, 0.4); }

#page-play .game-type p { margin: 0 0 16px; font-size: 17px; }
#page-play .game-type--featured p { font-size: 19px; color: var(--text); }

#page-play #match_with_guests,
#page-play #long_time_game {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.35;
  color: var(--text-dim);
  cursor: pointer;
}

#page-play #match_with_guests i,
#page-play #long_time_game i { color: var(--text-mute); }

#page-play .btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#page-play #host_panel,
#page-play #join_panel {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed rgba(226, 182, 90, 0.35);
}

#page-play #host_key {
  display: block;
  margin-bottom: 12px;
}

#page-play #host_key input { margin: 0; font-family: var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; }

/* ---------- Page: News ---------- */
#page-news { max-width: 980px; margin: 0 auto; }

#page-news .short-new,
#page-new {
  position: relative;
  box-sizing: border-box;
  padding: 20px 24px 18px;
  margin-bottom: 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, #2a1a0f, #160d07) padding-box,
    linear-gradient(160deg, var(--gold-3), var(--gold-5) 50%, var(--gold-4)) border-box;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 220, 160, 0.08);
}

#page-news .short-new::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--ember-fill);
  box-shadow: 0 0 10px rgba(255, 140, 30, 0.6);
}

#current-page #page-news h2,
#current-page #page-new h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--text);
}

#current-page #page-new h1 { justify-content: center; font-size: 28px; }

#current-page #page-news h2 span,
#current-page #page-new h1 span {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink);
  padding: 3px 10px;
  border-radius: 20px;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-3));
  text-shadow: none;
}

#current-page #page-news p { margin: 0 0 10px; }

#current-page #page-news a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 0;
}

#current-page #page-news a::after { content: " \2192"; }

/* ---------- Page: About ---------- */
#page-about { max-width: 920px; margin: 0 auto; }
#current-page #page-about h2 { font-size: 24px; margin: 8px 0 14px; text-align: left; letter-spacing: 0.08em; }
#current-page #page-about h2:not(:first-child) { margin-top: 30px; }
#current-page #page-about ul { padding-left: 22px; }
#current-page #page-about li::marker { color: var(--ember); }

/* ---------- Page: Ranking ---------- */
#page-ranking {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 60%;
  padding-top: 40px;
  text-align: center;
}

#page-ranking::before {
  content: "";
  width: 120px;
  height: 120px;
  margin-bottom: 18px;
  background: url("../images/trophy.png") center / contain no-repeat;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 22px rgba(255, 170, 60, 0.35)) sepia(0.3);
  animation: float-animation 3s ease-in-out infinite alternate;
}

#current-page #page-ranking h1 { margin: 0 0 8px; font-size: 26px; }
#current-page #page-ranking h3 { margin: 0; font-family: var(--font-body); font-weight: 400; font-style: italic; font-size: 19px; color: var(--text-dim); }

/* ---------- Matchmaking popups ---------- */
#searchingGame {
  display: none;
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  top: auto;
  bottom: 9vh;
  width: max-content;
  max-width: 90vw;
  margin: 0 auto;
  padding: 18px 26px 18px;
  text-align: center;
}

#searchingGame h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: var(--gold-1);
}

#searchingGame h3::before {
  content: "";
  flex: none;
  width: 30px;
  height: 30px;
  background: url("../images/logo.webp") center / contain no-repeat;
  animation: spin-die 1.6s cubic-bezier(0.6, 0, 0.4, 1) infinite;
  filter: drop-shadow(0 0 8px rgba(255, 120, 30, 0.7));
}

@keyframes spin-die {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}

#searchingGame > span {
  display: none;
  margin-bottom: 14px;
  font-size: 18px;
  color: var(--text-dim);
}

#searchingGame > span > span {
  display: inline-block;
  margin-left: 8px;
  padding: 6px 16px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2em;
  color: var(--gold-hi);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1px var(--gold-3), inset 0 2px 6px rgba(0, 0, 0, 0.8);
  transition: box-shadow 0.2s ease;
}

#searchingGame > span > span:hover { box-shadow: inset 0 0 0 1px var(--gold-1), 0 0 14px rgba(255, 170, 60, 0.5); }

#opponentFound {
  display: none;
  position: absolute;
  z-index: 150;
  width: min(520px, 90vw);
  padding: 34px 34px 30px;
  text-align: center;
}

#opponentFound h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: 0.06em;
  color: var(--gold-hi);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.8), 0 0 24px rgba(255, 150, 40, 0.6);
}

#opponentFound span,
#opponentFound b {
  display: inline-block;
  margin-bottom: 18px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 20px;
  color: var(--text-dim);
}

#opponentFound b { display: block; font-style: italic; }

/* ---------- Discord popup ---------- */
#discordPopup {
  display: none;
  position: absolute;
  z-index: 105;
  width: min(620px, 90vw);
  padding: 24px 30px 22px;
  font-size: 19px;
  line-height: 1.45;
  color: var(--text-dim);
}

#discordPopup span { display: block; margin-top: 16px; text-align: center; }

#discordPopup a {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(180deg, #7b86ff, #4c57d9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

#discordPopup img {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 14px;
  height: 14px;
  cursor: pointer;
  filter: invert(1) sepia(1) saturate(2) hue-rotate(-10deg);
  opacity: 0.8;
}

/* ---------- Toasts ---------- */
.toastjs-container {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: calc(100% - 60px);
  max-width: 420px;
  transform: translateX(-150%);
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  z-index: 120;
}

.toastjs-container[aria-hidden="false"] { transform: translateX(0%); }

.toastjs {
  padding: 16px 18px 6px;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  border-radius: 12px;
  border: 2px solid transparent;
  border-left-width: 2px;
  background:
    linear-gradient(180deg, #2f1d10, #170d07) padding-box,
    var(--gold-border) border-box;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(255, 140, 30, 0.2);
}

.toastjs-btn {
  display: inline-block;
  margin: 12px 8px 10px 0;
  padding: 8px 14px 7px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #4b3020, #2a180c);
  box-shadow: 0 0 0 1px var(--gold-4), inset 0 1px 0 rgba(255, 240, 200, 0.2);
}

.toastjs-btn:first-of-type {
  color: var(--ink);
  background: var(--ember-fill);
  box-shadow: 0 0 0 1px #5e3a0c, inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.toastjs-btn:hover { filter: brightness(1.12); }

/* ---------- Legacy chat panel (kept for compatibility) ---------- */
#chatPanel { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1250px) {
  content div.menu a { padding: 10px 14px 8px; font-size: 15px; letter-spacing: 0.1em; }
  content span.logo b { display: none !important; }
  #page-play .modes { grid-template-columns: 1fr; }
  #page-play .game-type--featured { grid-row: auto; min-height: 340px; }
}

@media (max-height: 820px) {
  content .topbar { height: 116px; }
  content img#logo { width: 76px; }
  content span.logo b { font-size: 28px; }
  content div.menu { padding-top: 28px; }
  content div.menu span a.bigBtn { width: 96px; height: 96px; font-size: 21px; }
  content div.profile { top: 20px; }
  #current-page { padding-top: 16px; }
  #page-play .modes { gap: 14px; }
  #page-play .game-type { padding: 16px 18px 15px; gap: 16px; }
  #page-play .game-type--featured { min-height: 0; padding: 22px; }
  #page-play .mode-emblem { width: 52px; height: 52px; }
  #page-play .game-type h2 { font-size: 20px; margin: 2px 0 4px; }
  #page-play .game-type--featured h2 { font-size: 28px; }
  #page-play .game-type p { font-size: 15.5px; margin-bottom: 10px; line-height: 1.4; }
  #page-play .game-type--featured p { font-size: 17px; }
  #page-play #match_with_guests, #page-play #long_time_game { margin-bottom: 12px; font-size: 15px; }
  #page-play .btn { font-size: 13px; }
  #page-play .btn--lg { font-size: 16px; }
}
