:root {
  --bg: #0a0e1a;
  --bg-card: #131a2e;
  --bg-card-hover: #1a2540;
  --border: #1e2d4a;
  --text: #f0f4ff;
  --muted: #8ba0c4;
  --accent: #00e5ff;
  --accent-2: #b06aff;
  --hot: #ff4d6d;
  --star: #ffe066;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  --gradient-card: linear-gradient(145deg, #131a2e 0%, #1a1040 100%);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
  width: 100%;
  overscroll-behavior-x: none;
  touch-action: pan-y pinch-zoom;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0, 229, 255, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(176, 106, 255, 0.12), transparent 50%);
  animation: bg-drift 18s ease-in-out infinite alternate;
}

body::after {
  background: radial-gradient(600px 400px at 50% 100%, rgba(255, 107, 107, 0.05), transparent 60%);
  animation: bg-drift 24s ease-in-out infinite alternate-reverse;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.header,
.container,
.footer {
  position: relative;
  z-index: 1;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
}

.orb-a {
  width: 320px; height: 320px;
  background: rgba(0, 229, 255, 0.3);
  top: 8%; left: -4%;
  animation: orb-float-a 22s ease-in-out infinite;
}
.orb-b {
  width: 260px; height: 260px;
  background: rgba(176, 106, 255, 0.28);
  top: 55%; right: -2%;
  animation: orb-float-b 26s ease-in-out infinite;
}
.orb-c {
  width: 200px; height: 200px;
  background: rgba(255, 77, 109, 0.22);
  bottom: 10%; left: 30%;
  animation: orb-float-c 19s ease-in-out infinite;
}
.orb-d {
  width: 160px; height: 160px;
  background: rgba(255, 224, 102, 0.18);
  top: 35%; left: 55%;
  animation: orb-float-d 24s ease-in-out infinite;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.header {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 23, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  flex: 1 1 auto;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  background-size: 200% 200%;
  color: #081018;
  font-weight: 800;
  box-shadow: 0 0 24px rgba(110, 231, 255, 0.35);
  animation: brand-gradient 4s ease infinite;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

h1, h2 { margin: 0.15rem 0 0; line-height: 1.15; }
h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
h2 { font-size: 1.25rem; }

.header-nav { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.header-nav-primary,
.header-nav-sites {
  display: contents;
}
.header-nav-sites .nav-link {
  flex: 0 0 auto;
}
.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.12rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.lang-btn {
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  font: 600 0.72rem/1 inherit;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  font-family: inherit;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  color: var(--text);
  background: rgba(99, 179, 255, 0.18);
}
.auth-card .lang-switcher {
  position: absolute;
  top: 1rem;
  right: 1rem;
}
.auth-card { position: relative; }
.nav-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.nav-user {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-btn,
a.nav-btn,
button.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-btn:hover,
a.nav-btn:hover,
button.nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-bottom: 0.65rem;
}
.nav-btn-accent {
  border-color: rgba(110, 231, 255, 0.45);
  color: var(--accent);
}
.pwa-install-dialog ul.pwa-install-steps {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.pwa-install-dialog ul.pwa-install-steps li + li { margin-top: 0.5rem; }
.pwa-install-dialog h2 { margin: 0 0 0.5rem; font-size: 1.15rem; }
.pwa-install-dialog p { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.pwa-install-dialog { padding: 1.25rem; }
.add-game-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--bg-card);
  color: var(--text);
  max-width: min(520px, calc(100% - 2rem));
  width: 100%;
}
.add-game-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}
.add-game-dialog form {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: min(85dvh, 720px);
  overflow-y: auto;
}
.add-game-dialog h2 { margin: 0; font-size: 1.15rem; }
.add-game-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}
.add-game-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}
.add-game-dialog .auth-error.visible,
.add-game-dialog .auth-success.visible { display: block; }
.nav-link {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  position: relative;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  text-decoration: none;
  background: rgba(255,255,255,0.03);
  transform: translateY(-2px);
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 2px;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease, left 0.25s ease;
  border-radius: 2px;
}
.nav-link:hover::after {
  width: 70%;
  left: 15%;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 1.25rem;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
}

.hero-lead {
  margin: 0 0 0.85rem;
  color: var(--muted);
  animation: hero-fade 0.8s ease both;
  background: linear-gradient(90deg, var(--muted), var(--text), var(--muted));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hero-shimmer 5s linear infinite, hero-fade 0.8s ease both;
}

.search-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.search-wrap input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-wrap input:focus {
  outline: 2px solid rgba(110, 231, 255, 0.35);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(110, 231, 255, 0.12), 0 0 24px rgba(110, 231, 255, 0.15);
  transform: translateY(-1px);
}

.category-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(143, 160, 188, 0.55);
  box-shadow: inset 0 1px 0 rgba(110, 231, 255, 0.06);
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chip.active, .chip:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(110, 231, 255, 0.08);
  transform: translateY(-1px);
}
.chip.active {
  box-shadow: 0 0 16px rgba(110, 231, 255, 0.2);
  animation: chip-glow 2s ease-in-out infinite;
}

@keyframes chip-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(110, 231, 255, 0.15); }
  50% { box-shadow: 0 0 22px rgba(110, 231, 255, 0.35); }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

.section { margin-bottom: 2rem; animation: section-rise 0.7s ease both; }
.section-trending { animation-delay: 0.1s; }
.section-featured { animation-delay: 0.2s; }
.section-all { animation-delay: 0.3s; }

.section-icon {
  display: inline-block;
  margin-right: 0.25rem;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  min-width: 0;
}
.section-sub { margin: 0; color: var(--muted); font-size: 0.9rem; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.game-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  box-shadow: var(--shadow);
  opacity: 0;
}

.card-enter-up { animation: card-enter-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.card-enter-left { animation: card-enter-left 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.card-enter-right { animation: card-enter-right 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.card-enter-scale { animation: card-enter-scale 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.card-enter-flip { animation: card-enter-flip 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.card-enter-zoom { animation: card-enter-zoom 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

.game-card:hover {
  transform: translateY(-8px) scale(1.03) rotate(-0.5deg);
  background: var(--bg-card-hover);
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 35px rgba(0, 229, 255, 0.2), inset 0 0 30px rgba(0, 229, 255, 0.03);
  text-decoration: none;
}

.game-card:nth-child(even):hover {
  transform: translateY(-8px) scale(1.03) rotate(0.5deg);
}

.game-card:hover .thumb-emoji {
  transform: scale(1.15) rotate(5deg);
  filter: drop-shadow(0 0 20px rgba(110, 231, 255, 0.6));
}

.thumb {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1a1040, #0d1f3c);
  background-size: 200% 200%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  position: relative;
  overflow: hidden;
  animation: thumb-bg-shift 8s ease infinite;
}

.thumb-g1 { background: linear-gradient(135deg, #1a2744, #0f1a30, #243656); }
.thumb-g2 { background: linear-gradient(135deg, #2a1844, #150f28, #3d2560); }
.thumb-g3 { background: linear-gradient(135deg, #1a3330, #0f221f, #1f5048); }
.thumb-g4 { background: linear-gradient(135deg, #442018, #281008, #603020); }
.thumb-g5 { background: linear-gradient(135deg, #183044, #0c1828, #204868); }
.thumb-g6 { background: linear-gradient(135deg, #302018, #1a1008, #483020); }
.thumb-g7 { background: linear-gradient(135deg, #1a4428, #0f2818, #286840); }
.thumb-g8 { background: linear-gradient(135deg, #441828, #280810, #602838); }
.thumb-g9 { background: linear-gradient(135deg, #284428, #142814, #386038); }
.thumb-g10 { background: linear-gradient(135deg, #443018, #281808, #604830); }
.thumb-g11 { background: linear-gradient(135deg, #182844, #0c1428, #203860); }
.thumb-g12 { background: linear-gradient(135deg, #402844, #201428, #583860); }

.thumb-g1, .thumb-g2, .thumb-g3, .thumb-g4, .thumb-g5, .thumb-g6,
.thumb-g7, .thumb-g8, .thumb-g9, .thumb-g10, .thumb-g11, .thumb-g12 {
  background-size: 200% 200%;
  animation: thumb-bg-shift 7s ease infinite;
}

.thumb::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(110,231,255,0.08), transparent, rgba(167,139,250,0.08), transparent);
  animation: thumb-rotate 12s linear infinite;
  pointer-events: none;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.06) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: thumb-shine 4s ease-in-out infinite;
  pointer-events: none;
}

.game-card:hover .thumb::after {
  animation-duration: 2s;
}

.thumb img,
.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-emoji {
  font-size: 3.25rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.34, 1.5, 0.64, 1), filter 0.3s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
  will-change: transform;
  position: relative;
  z-index: 1;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  z-index: 2;
}

.badge-hot { animation: badge-fire 1.5s ease-in-out infinite; }
.badge-star { animation: badge-star-spin 3s ease-in-out infinite; }

.cat-pill {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card:hover .cat-pill {
  background: rgba(110, 231, 255, 0.1);
  border-color: rgba(110, 231, 255, 0.3);
}

.play-btn {
  color: var(--accent);
  font-weight: 700;
  transition: letter-spacing 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.play-arrow {
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.5, 0.64, 1);
}

.game-card:hover .play-arrow {
  transform: translateX(4px) scale(1.2);
}

.game-card:hover .play-btn {
  color: var(--accent-2);
  letter-spacing: 0.04em;
}

.card-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.card-title { font-weight: 700; line-height: 1.2; }
.card-desc {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 0;
}

.section-head h2 {
  animation: section-glow 4s ease-in-out infinite alternate;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}
.hidden { display: none !important; }

/* Layout switcher — below category chips */
.layout-switcher {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  margin-top: 0.75rem;
  padding: 0.55rem 0.65rem;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(110, 231, 255, 0.22);
  border-radius: 12px;
  background: rgba(15, 22, 36, 0.85);
}
.layout-switcher-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.layout-switcher-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  align-items: center;
}
.layout-btn {
  min-height: 2.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.layout-btn-text {
  white-space: nowrap;
}
.layout-btn:hover {
  background: rgba(110, 231, 255, 0.08);
  border-color: rgba(110, 231, 255, 0.35);
}
.layout-btn.active {
  background: rgba(110, 231, 255, 0.14);
  border-color: rgba(110, 231, 255, 0.5);
  color: var(--accent);
}

/* Layout: one (large single-column cards) */
body.layout-one .game-grid {
  grid-template-columns: 1fr;
  gap: 1.1rem;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}
body.layout-one .game-card--one {
  min-height: 0;
  opacity: 1;
  animation: none;
}
body.layout-one .game-card--one .thumb {
  aspect-ratio: 21 / 9;
}
body.layout-one .game-card--one .card-desc {
  -webkit-line-clamp: 3;
}
body.layout-one .play-btn-lg {
  font-size: 0.95rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: rgba(110, 231, 255, 0.1);
  border: 1px solid rgba(110, 231, 255, 0.25);
}

/* Layout: story (horizontal story tiles) */
body.layout-story .game-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
body.layout-story .game-card--story {
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  opacity: 1;
  animation: none;
}
body.layout-story .story-media {
  width: 7.5rem;
  min-width: 7.5rem;
  flex-shrink: 0;
  aspect-ratio: 3 / 4;
  border-radius: 12px 0 0 12px;
}
body.layout-story .story-body {
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
body.layout-story .game-card--story .card-desc {
  -webkit-line-clamp: 3;
}

/* Layout: table */
.game-table-head {
  display: grid;
  grid-template-columns: 2.5rem 1fr 5.5rem 4rem 4.5rem;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(0, 0, 0, 0.25);
  margin-bottom: 0;
}
.game-table-col-play {
  text-align: right;
}
body.layout-table .game-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  border-top: none;
}
body.layout-table .game-table-head + .game-grid {
  border-top: none;
}
body.layout-table .game-card--table {
  display: grid;
  grid-template-columns: 2.5rem 1fr 5.5rem 4rem 4.5rem;
  gap: 0.5rem;
  align-items: center;
  min-height: 0;
  opacity: 1;
  animation: none;
  flex-direction: row;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  padding: 0.65rem 0.85rem;
}
body.layout-table .game-card--table:last-child {
  border-bottom: none;
}
body.layout-table .game-card--table:hover {
  transform: none;
  background: var(--bg-card-hover);
}
body.layout-table .tbl-icon {
  font-size: 1.35rem;
  line-height: 1;
  text-align: center;
}
body.layout-table .tbl-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.layout-table .tbl-cat {
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.layout-table .tbl-plays {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
body.layout-table .tbl-play {
  text-align: right;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
  animation: footer-rise 1s ease 0.5s both;
}
.footer-note { font-size: 0.8rem; opacity: 0.85; }

/* Play page */
.play-page { display: flex; flex-direction: column; min-height: 100vh; }
.play-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 23, 0.9);
}
.play-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.play-header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}
.play-header-nav {
  display: flex;
  flex-shrink: 0;
  align-items: center;
}
.play-header-nav-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  align-items: center;
  font-size: 0.85rem;
}

.play-header-nav-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.back-link { color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.play-title-wrap { flex: 1; min-width: 0; }
.play-title-wrap h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
.source-link { font-size: 0.9rem; }

.play-main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.play-frame-wrap {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: min(60vh, 60dvh);
}

#game-frame {
  width: 100%;
  height: min(78vh, 78dvh, 900px);
  border: 0;
  display: block;
  background: #000;
  touch-action: manipulation;
}

.play-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.5);
  color: var(--muted);
}

.play-aside {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  align-self: start;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.75rem 0; }
.tag {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--muted);
}

.play-meta { color: var(--muted); font-size: 0.9rem; }

.launch-pad {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  background: radial-gradient(circle at center, rgba(110, 231, 255, 0.08), transparent 70%), var(--bg-card);
}

.launch-btn {
  display: inline-block;
  padding: 0.9rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #081018;
  font-weight: 800;
  text-decoration: none;
  font-size: 1.05rem;
}

.launch-btn:hover { text-decoration: none; filter: brightness(1.05); }

.launch-note { color: var(--muted); font-size: 0.85rem; max-width: 360px; margin: 0 auto; }

#game-frame.hidden { display: none; }

/* Icon motion styles */
.anim-float { animation: icon-float 3.2s ease-in-out infinite; }
.anim-bounce { animation: icon-bounce 2.4s ease-in-out infinite; }
.anim-wiggle { animation: icon-wiggle 2.8s ease-in-out infinite; }
.anim-pulse { animation: icon-pulse 2.2s ease-in-out infinite; }
.anim-shake { animation: icon-shake 2.6s ease-in-out infinite; }
.anim-drive { animation: icon-drive 2.5s ease-in-out infinite; }
.anim-flip { animation: icon-flip 3s ease-in-out infinite; }
.anim-spin-slow { animation: icon-spin 8s linear infinite; }
.anim-swing { animation: icon-swing 3s ease-in-out infinite; }
.anim-jelly { animation: icon-jelly 2.8s ease-in-out infinite; }
.anim-orbit { animation: icon-orbit 4s ease-in-out infinite; }
.anim-tada { animation: icon-tada 2.5s ease-in-out infinite; }
.anim-sway { animation: icon-sway 3.5s ease-in-out infinite; }
.anim-pop { animation: icon-pop 2s ease-in-out infinite; }
.anim-rock { animation: icon-rock 2.2s ease-in-out infinite; }
.anim-swim { animation: icon-swim 3s ease-in-out infinite; }
.anim-heartbeat { animation: icon-heartbeat 1.8s ease-in-out infinite; }
.anim-glitch { animation: icon-glitch 2.4s steps(2) infinite; }
.anim-glow { animation: brand-glow 2.5s ease-in-out infinite; }

@keyframes bg-drift {
  0% { transform: translate(0, 0) scale(1); opacity: 0.9; }
  100% { transform: translate(2%, 1.5%) scale(1.03); opacity: 1; }
}

@keyframes orb-float-a {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(40px, 30px); }
  66% { transform: translate(20px, -20px); }
}
@keyframes orb-float-b {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-50px, -40px); }
}
@keyframes orb-float-c {
  0%, 100% { transform: translate(0, 0); }
  40% { transform: translate(30px, -25px); }
  80% { transform: translate(-20px, 15px); }
}
@keyframes orb-float-d {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-30px, 35px) scale(1.15); }
}

@keyframes brand-gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes brand-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(110, 231, 255, 0.35); transform: scale(1); }
  50% { box-shadow: 0 0 32px rgba(167, 139, 250, 0.55); transform: scale(1.06); }
}

@keyframes hero-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes hero-shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes section-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes footer-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-enter-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes card-enter-left {
  from { opacity: 0; transform: translateX(-28px) rotate(-2deg); }
  to { opacity: 1; transform: translateX(0) rotate(0); }
}
@keyframes card-enter-right {
  from { opacity: 0; transform: translateX(28px) rotate(2deg); }
  to { opacity: 1; transform: translateX(0) rotate(0); }
}
@keyframes card-enter-scale {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes card-enter-flip {
  from { opacity: 0; transform: perspective(600px) rotateY(-25deg); }
  to { opacity: 1; transform: perspective(600px) rotateY(0); }
}
@keyframes card-enter-zoom {
  from { opacity: 0; transform: scale(0.6) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes thumb-bg-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes thumb-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes icon-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.05); }
  60% { transform: translateY(-4px) scale(1.02); }
}

@keyframes icon-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

@keyframes icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes icon-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px) rotate(-2deg); }
  40% { transform: translateX(3px) rotate(2deg); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@keyframes icon-drive {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  50% { transform: translateX(6px) rotate(2deg); }
}

@keyframes icon-flip {
  0%, 100% { transform: rotateY(0deg); }
  50% { transform: rotateY(180deg); }
}

@keyframes icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes icon-swing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(12deg); }
  75% { transform: rotate(-12deg); }
}

@keyframes icon-jelly {
  0%, 100% { transform: scale(1, 1); }
  25% { transform: scale(1.08, 0.92); }
  50% { transform: scale(0.95, 1.05); }
  75% { transform: scale(1.03, 0.97); }
}

@keyframes icon-orbit {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(4px, -6px) rotate(5deg); }
  50% { transform: translate(0, -8px) rotate(0deg); }
  75% { transform: translate(-4px, -6px) rotate(-5deg); }
}

@keyframes icon-tada {
  0%, 100% { transform: scale(1) rotate(0deg); }
  10%, 20% { transform: scale(0.92) rotate(-4deg); }
  30%, 50%, 70%, 90% { transform: scale(1.08) rotate(4deg); }
  40%, 60%, 80% { transform: scale(1.08) rotate(-4deg); }
}

@keyframes icon-sway {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-6px); }
}

@keyframes icon-pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

@keyframes icon-rock {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

@keyframes icon-swim {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(5px) rotate(3deg); }
  75% { transform: translateX(-5px) rotate(-3deg); }
}

@keyframes icon-heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.15); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1); }
}

@keyframes icon-glitch {
  0%, 100% { transform: translate(0); filter: hue-rotate(0deg); }
  20% { transform: translate(-2px, 1px); filter: hue-rotate(20deg); }
  40% { transform: translate(2px, -1px); filter: hue-rotate(-15deg); }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); filter: hue-rotate(10deg); }
}

@keyframes thumb-shine {
  0%, 70% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

@keyframes badge-fire {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.15); filter: brightness(1.3); }
}

@keyframes badge-star-spin {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(180deg); }
}

@keyframes section-glow {
  from { text-shadow: 0 0 0 transparent; }
  to { text-shadow: 0 0 20px rgba(110, 231, 255, 0.15); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .game-card { opacity: 1; }
}

/* Touch phones & narrow viewports — stop overflow wobble and rotation burst */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  body::before,
  body::after {
    animation: none !important;
    transform: none !important;
  }

  .bg-orbs { display: none; }

  .header {
    backdrop-filter: none;
    background: rgba(11, 15, 23, 0.98);
  }

  .hero-lead {
    animation: none !important;
    background: none;
    -webkit-text-fill-color: var(--muted);
    color: var(--muted);
  }

  .brand-mark.anim-glow { animation: none !important; }

  .section,
  .footer,
  .section-head h2,
  .chip.active {
    animation: none !important;
  }

  .section-icon,
  .thumb-emoji,
  .badge-hot,
  .badge-star {
    animation: none !important;
    transform: none !important;
  }

  .thumb,
  .thumb-g1, .thumb-g2, .thumb-g3, .thumb-g4, .thumb-g5, .thumb-g6,
  .thumb-g7, .thumb-g8, .thumb-g9, .thumb-g10, .thumb-g11, .thumb-g12 {
    animation: none !important;
  }

  .thumb::before,
  .thumb::after {
    display: none !important;
    animation: none !important;
  }

  .game-card {
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
    min-height: 0;
  }

  .game-card:hover,
  .game-card:nth-child(even):hover {
    transform: none;
    box-shadow: var(--shadow);
  }

  .game-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* Multi — compact 2-column grid */
  body.layout-grid .game-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }
  body.layout-grid .game-card .thumb {
    aspect-ratio: 1 / 1;
  }
  body.layout-grid .game-card .card-body {
    padding: 0.45rem 0.5rem;
  }
  body.layout-grid .game-card .card-title {
    font-size: 0.82rem;
  }
  body.layout-grid .game-card .card-desc {
    display: none;
  }
  body.layout-grid .game-card .card-meta {
    font-size: 0.68rem;
    margin-top: 0.15rem;
  }
  body.layout-grid .thumb-emoji {
    font-size: 2rem;
  }

  /* One — full-width hero cards */
  body.layout-one .game-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  body.layout-one .game-card--one .thumb {
    aspect-ratio: 16 / 10;
  }
  body.layout-one .game-card--one .card-title {
    font-size: 1.15rem;
  }
  body.layout-one .game-card--one .card-desc {
    -webkit-line-clamp: 4;
    font-size: 0.88rem;
  }
  body.layout-one .game-card--one .card-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.35rem;
  }
  body.layout-one .play-btn-lg {
    justify-content: center;
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    box-sizing: border-box;
  }

  /* Story — horizontal list rows (not stacked cards) */
  body.layout-story .game-grid {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }
  body.layout-story .game-card--story {
    flex-direction: row;
    align-items: stretch;
  }
  body.layout-story .story-media {
    width: 5.25rem;
    min-width: 5.25rem;
    aspect-ratio: 3 / 4;
    border-radius: 10px 0 0 10px;
  }
  body.layout-story .story-body {
    padding: 0.55rem 0.65rem;
    justify-content: center;
  }
  body.layout-story .game-card--story .card-title {
    font-size: 0.95rem;
  }
  body.layout-story .game-card--story .card-desc {
    -webkit-line-clamp: 2;
    font-size: 0.78rem;
  }
  body.layout-story .game-card--story .card-meta {
    margin-top: 0.25rem;
  }

  body.layout-table .game-table-head,
  body.layout-table .game-card--table {
    grid-template-columns: 2rem 1fr 3.5rem 4rem;
  }
  body.layout-table .game-table-head .game-table-col:nth-child(3),
  body.layout-table .tbl-cat {
    display: none;
  }

  .layout-switcher {
    flex-direction: column;
    align-items: stretch;
  }
  .layout-switcher-btns {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }
  .layout-btn {
    min-width: 0;
    min-height: 2.75rem;
    padding: 0.4rem 0.35rem;
    text-align: center;
  }

  html {
    font-size: 17px;
  }

  .hero-lead {
    font-size: 1rem;
    line-height: 1.45;
    margin-bottom: 0.75rem;
  }

  .hero-actions .nav-btn {
    min-height: 44px;
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
  }

  .lang-btn {
    min-height: 36px;
    min-width: 2.1rem;
    font-size: 0.8rem;
  }

  .header-nav-sites .nav-link {
    font-size: 0.85rem;
    padding: 0.25rem 0;
  }

  .nav-auth .nav-btn {
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
  }

  .chip {
    font-size: 0.9rem;
    padding: 0.5rem 0.9rem;
    min-height: 44px;
  }

  .section-head h2 {
    font-size: 1.3rem;
  }

  .section-sub {
    font-size: 0.9rem;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .card-desc {
    font-size: 0.88rem;
    -webkit-line-clamp: 3;
  }

  .play-btn {
    font-size: 0.85rem;
  }

  .thumb-emoji {
    font-size: 3rem;
  }

  .container,
  .hero,
  .footer {
    padding-left: max(0.65rem, env(safe-area-inset-left));
    padding-right: max(0.65rem, env(safe-area-inset-right));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: max(0.65rem, env(safe-area-inset-top))
      max(0.65rem, env(safe-area-inset-right))
      0.65rem
      max(0.65rem, env(safe-area-inset-left));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .header-inner > .brand {
    width: 100%;
    max-width: 100%;
  }

  .brand h1 {
    font-size: clamp(1.25rem, 5.5vw, 1.65rem);
    line-height: 1.15;
    max-width: 100%;
  }

  .header {
    width: 100%;
    overflow-x: clip;
  }

  .brand .eyebrow {
    display: none;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 1rem;
    flex-shrink: 0;
  }

  .header-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    overflow: visible;
    flex-wrap: nowrap;
    padding-bottom: 0;
  }

  .header-nav-primary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
  }

  .header-nav-sites {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    width: 100%;
  }

  .header-nav-sites .nav-link {
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .nav-auth {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .nav-auth .nav-btn {
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
  }

  .hero-actions {
    justify-content: flex-start;
    align-items: flex-start;
    width: 100%;
  }

  .search-wrap,
  .search-wrap input {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
    min-height: 44px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .section-sub {
    width: 100%;
    font-size: 0.85rem;
  }

  .category-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0.35rem;
    width: 100%;
    max-width: 100%;
    border-top: 1px solid rgba(110, 231, 255, 0.35);
    box-shadow: inset 0 1px 0 rgba(110, 231, 255, 0.12);
  }

  .chip.active {
    box-shadow: none;
    border-width: 1px;
    border-color: var(--accent);
    background: rgba(110, 231, 255, 0.12);
  }

  .category-bar::-webkit-scrollbar { display: none; }

  .brand h1 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .hero-lead {
    overflow-wrap: anywhere;
    text-align: left;
  }

  .chip { flex: 0 0 auto; }

  body.is-filtering .section-all {
    scroll-margin-top: 0.5rem;
  }

  .card-title {
    font-size: 0.92rem;
    overflow-wrap: anywhere;
  }

  .card-desc { font-size: 0.78rem; }

  .play-header {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-top: max(0.75rem, env(safe-area-inset-top));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .play-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .play-header-nav {
    width: 100%;
  }

  .play-header-nav-primary {
    display: flex;
    justify-content: flex-start;
    width: 100%;
  }

  .play-header-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .play-title-wrap h1 {
    font-size: 1.15rem;
  }

  .play-main {
    padding-left: max(0.5rem, env(safe-area-inset-left));
    padding-right: max(0.5rem, env(safe-area-inset-right));
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .play-frame-wrap,
  #game-frame {
    max-width: 100%;
  }
}

/* Landscape phone — compact chrome, stable game frame */
@media (orientation: landscape) and (max-height: 520px) {
  .hero-lead { display: none; }

  .header-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .hero {
    padding-top: 0;
    padding-bottom: 0.65rem;
  }

  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .play-header h1 { font-size: 1.05rem; }

  .play-aside { display: none; }

  .play-frame-wrap {
    min-height: calc(100dvh - 72px);
  }

  #game-frame {
    height: calc(100dvh - 72px);
    min-height: 200px;
  }
}

/* Freeze all motion briefly on rotation (prevents burst) */
html.orientation-settling,
html.orientation-settling *,
html.orientation-settling *::before,
html.orientation-settling *::after {
  animation: none !important;
  transition: none !important;
}

html.orientation-settling .game-card {
  opacity: 1 !important;
  transform: none !important;
}

@media (max-width: 900px) {
  .play-main { grid-template-columns: 1fr; padding: 0.75rem; gap: 0.75rem; }
  .play-header { padding: 0.75rem 1rem; }
  .play-frame-wrap { min-height: calc(100dvh - 220px); border-radius: 10px; }
  #game-frame { height: calc(100dvh - 220px); min-height: 320px; }
  .play-aside { font-size: 0.95rem; }
  .back-link { min-height: 44px; display: inline-flex; align-items: center; }
}

@media (max-width: 600px) {
  .brand-mark { width: 42px; height: 42px; }
}

@media (max-width: 400px) {
  .nav-auth {
    width: auto;
    justify-content: flex-end;
  }
}

/* ===== Light Mode ===== */
html.light {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f5;
  --border: #e2e8f0;
  --text: #1a1a2e;
  --muted: #4a5568;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --gradient-card: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
}

html.light body {
  background: var(--bg);
}

html.light body::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 229, 255, 0.05), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(176, 106, 255, 0.04), transparent);
}

html.light .bg-orbs .orb { opacity: 0.05; }

html.light .header {
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
}

html.light .footer {
  background: #f0f2f5;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 10px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle-btn:hover {
  background: var(--bg-card);
  border-color: var(--muted);
}
