/* ------------------------------------------------------------ tokens ---- */
:root {
  --brand: #fe2c55;
  --brand-2: #ff5c3a;
  --cyan: #25f4ee;
  --ok: #22c55e;
  --radius: 16px;
  --header-h: 68px;
  --max: 1240px;
  --font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0f;
  --bg-2: #101219;
  --surface: #151821;
  --surface-2: #1d212d;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f1f3f8;
  --muted: #9aa2b1;
  --header-bg: rgba(10, 11, 15, 0.78);
  --glow-alpha: 0.32;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fa;
  --bg-2: #eceef4;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --line: rgba(16, 20, 32, 0.09);
  --line-strong: rgba(16, 20, 32, 0.18);
  --text: #12151d;
  --muted: #5b6372;
  --header-bg: rgba(245, 246, 250, 0.82);
  --glow-alpha: 0.22;
  --shadow: 0 22px 50px rgba(20, 24, 40, 0.18);
}

/* -------------------------------------------------------------- base ---- */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s, color 0.25s;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 15px; white-space: nowrap; cursor: pointer;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 28px rgba(254, 44, 85, 0.35);
}
.btn-primary:hover { border-color: transparent; box-shadow: 0 12px 34px rgba(254, 44, 85, 0.5); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: transparent; }
.btn-small { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 56px; padding: 0 34px; font-size: 17px; }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color 0.15s;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { fill: currentColor !important; stroke: none !important; }
:root[data-theme="dark"] .i-moon, :root[data-theme="light"] .i-sun { display: none; }

/* ------------------------------------------------------------ header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max); height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 32px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: -2px -2px 0 var(--cyan) inset;
}
.logo-mark svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; }
.logo-mark svg path { fill: #fff; stroke: none; }
.main-nav { display: flex; gap: 4px; margin: 0 auto; }
.main-nav a {
  padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 15px;
  transition: color 0.15s, background-color 0.15s;
}
.main-nav a:hover { color: var(--text); }
.main-nav a.active { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* -------------------------------------------------------------- hero ---- */
.hero {
  --accent: var(--brand);
  position: relative; overflow: hidden;
  padding: 48px 24px 40px;
  border-bottom: 1px solid var(--line);
}
.hero-glow {
  position: absolute; inset: -20% -10% auto -10%; height: 140%;
  background:
    radial-gradient(40% 50% at 22% 30%, color-mix(in srgb, var(--accent) calc(var(--glow-alpha) * 100%), transparent), transparent 70%),
    radial-gradient(35% 45% at 80% 40%, color-mix(in srgb, var(--brand) calc(var(--glow-alpha) * 70%), transparent), transparent 70%);
  filter: blur(30px);
  transition: background 0.8s;
  pointer-events: none;
}
.hero-stage { position: relative; display: grid; max-width: var(--max); margin: 0 auto; }
.hero-slide {
  grid-area: 1 / 1;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: 40px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.6s, visibility 0.6s;
}
.hero-slide.active { opacity: 1; visibility: visible; }
.hero-text > * { transform: translateY(14px); opacity: 0; transition: transform 0.6s, opacity 0.6s; }
.hero-slide.active .hero-text > * { transform: none; opacity: 1; }
.hero-slide.active .hero-text > :nth-child(2) { transition-delay: 0.05s; }
.hero-slide.active .hero-text > :nth-child(3) { transition-delay: 0.1s; }
.hero-slide.active .hero-text > :nth-child(4) { transition-delay: 0.15s; }
.hero-slide.active .hero-text > :nth-child(5) { transition-delay: 0.2s; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px;
  color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: 0.14em;
}
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(254, 44, 85, 0.22); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(254, 44, 85, 0); } }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tag {
  padding: 6px 14px; border-radius: 10px; font-size: 14px; font-weight: 500;
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line-strong); color: var(--muted);
}
.hero h1 { font-size: clamp(40px, 6vw, 72px); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 18px; }
.hero-desc { margin: 0 0 32px; max-width: 520px; font-size: 18px; color: var(--muted); }
.hero-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-cta .btn-primary { height: 56px; padding: 0 30px; font-size: 17px; }

.hero-visual { position: relative; height: 470px; }
.hero-cover {
  position: absolute; left: 0; top: 50%; width: 64%;
  aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px;
  box-shadow: var(--shadow); border: 1px solid var(--line-strong);
  transform: translate(-30px, -42%) rotate(-7deg) scale(0.94);
  opacity: 0; transition: transform 0.8s cubic-bezier(.2, .8, .2, 1), opacity 0.6s;
}
.hero-slide.active .hero-cover { transform: translate(0, -42%) rotate(-5deg); opacity: 1; transition-delay: 0.1s; }
.phone {
  position: absolute; right: 4%; top: 0; height: 100%; aspect-ratio: 9 / 18.5;
  padding: 9px; border-radius: 36px; background: #0c0d11;
  border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: var(--shadow);
  transform: translateY(26px); opacity: 0; transition: transform 0.8s cubic-bezier(.2, .8, .2, 1), opacity 0.6s;
}
.hero-slide.active .phone { transform: none; opacity: 1; }
.phone-screen { position: relative; height: 100%; border-radius: 28px; overflow: hidden; background: #000; color: #fff; }
.phone-screen > img { position: absolute; inset: 0 0 34% 0; width: 100%; height: 66%; object-fit: cover; }
.phone-screen::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.35), transparent 18%, transparent 40%, rgba(0,0,0,0.85) 56%, #000 65%);
}
.phone-ui { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.phone-top { display: flex; gap: 6px; font-size: 11px; font-weight: 700; }
.live-pill { padding: 2px 8px; border-radius: 6px; background: var(--brand); }
.viewers { padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); }
.phone-chat { margin: auto 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 11px; }
.phone-chat li {
  display: flex; flex-direction: column; width: fit-content; max-width: 100%;
  padding: 4px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.55); line-height: 1.35;
  opacity: 0; transform: translateY(8px);
}
.phone-chat b { color: #ffd4dd; font-weight: 700; }
.hero-slide.active .phone-chat li { animation: chat-in 0.4s forwards; animation-delay: var(--d); }
@keyframes chat-in { to { opacity: 1; transform: none; } }
.phone-rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.phone-rules span {
  display: flex; flex-direction: column; padding: 5px 8px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.1); font-size: 10px; line-height: 1.3; color: rgba(255,255,255,0.75);
}
.phone-rules b { font-size: 11px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone-note { margin: 0; font-size: 9.5px; text-align: center; color: rgba(255, 255, 255, 0.5); }

.hero-dots { position: relative; display: flex; gap: 10px; max-width: var(--max); margin: 36px auto 0; }
.hero-dot { width: 40px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; }
.hero-dot::before { content: ""; }
.hero-dot span {
  position: relative; display: block; width: 100%; height: 4px; border-radius: 4px;
  background: var(--line-strong); overflow: hidden;
}
.hero-dot span::after { content: ""; position: absolute; inset: 0; background: var(--brand); transform: scaleX(0); transform-origin: left; }
.hero-dot.active span::after { animation: dot-fill var(--slide-ms, 7000ms) linear forwards; }
.hero.paused .hero-dot.active span::after { animation-play-state: paused; }
@keyframes dot-fill { to { transform: scaleX(1); } }

/* ------------------------------------------------------------- games ---- */
.games { max-width: var(--max); margin: 0 auto; padding: 64px 24px 24px; }
.games-head { margin-bottom: 24px; }
.games-head h2 { font-size: 32px; font-weight: 800; }
.games-head p { margin: 8px 0 0; color: var(--muted); }
.filter-bar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 40px; padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; background: none; color: var(--muted); font-weight: 600; cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.games-count { flex: none; color: var(--muted); font-size: 15px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px 24px; }
.game-card { display: block; }
.card-media {
  position: relative; aspect-ratio: 16 / 9.5; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.game-card:hover .card-media { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.game-card:hover .card-media img { transform: scale(1.04); }
.badge-new {
  position: absolute; top: 14px; left: 14px; padding: 3px 11px; border-radius: 8px;
  background: rgba(10, 30, 16, 0.82); color: #6dffa0; font-size: 13px; font-weight: 700;
  border: 1px solid rgba(109, 255, 160, 0.3);
}
.card-play {
  position: absolute; inset: 0; margin: auto; width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 30px rgba(254, 44, 85, 0.5);
  opacity: 0; transform: scale(0.8); transition: opacity 0.2s, transform 0.2s;
}
.card-play svg { width: 26px; height: 26px; fill: #fff; margin-left: 3px; }
.game-card:hover .card-play, .game-card:focus-visible .card-play { opacity: 1; transform: none; }
.card-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 4px 0; }
.card-meta h3 { font-size: 18px; font-weight: 700; }
.card-cat { display: inline-flex; align-items: center; gap: 7px; flex: none; color: var(--muted); font-size: 14px; }
.card-cat i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* --------------------------------------------------------------- cta ---- */
.cta { max-width: 820px; margin: 0 auto; padding: 96px 24px 72px; text-align: center; }
.cta h2 { font-size: clamp(30px, 4.2vw, 44px); font-weight: 800; margin-bottom: 18px; }
.cta p { margin: 0 auto 12px; max-width: 720px; color: var(--muted); font-size: 18px; }
.cta .cta-sub { margin: 26px auto 34px; }
.cta-note { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 24px !important; font-size: 16px !important; }
.ok-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* ------------------------------------------------------------ footer ---- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); }
.footer-inner {
  max-width: var(--max); margin: 0 auto; padding: 28px 24px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px 32px;
}
.logo-small { font-size: 17px; }
.logo-small .logo-mark { width: 28px; height: 28px; border-radius: 8px; }
.logo-small .logo-mark svg { width: 18px; height: 18px; }
.footer-nav { display: flex; gap: 22px; }
.footer-nav a { color: var(--muted); font-size: 14px; }
.footer-nav a:hover { color: var(--text); }
.footer-copy { margin: 0 0 0 auto; color: var(--muted); font-size: 14px; }

/* -------------------------------------------------------------- play ---- */
body.is-playing { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.is-playing .site-footer { display: none; }
body.is-playing #view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.play { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.play-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.back-link { color: var(--muted); font-weight: 600; font-size: 14px; }
.back-link:hover { color: var(--text); }
.play-title { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.play-title h1 { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.play-frame { flex: 1; min-height: 0; background: #000; }
.play-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

.empty-state { max-width: 560px; margin: 0 auto; padding: 96px 24px; text-align: center; }
.empty-state h1, .empty-state h2 { font-size: 32px; margin-bottom: 12px; }
.empty-state p { color: var(--muted); margin: 0 0 28px; }

/* ------------------------------------------------------ rules dialog ---- */
.rules-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--line-strong); border-radius: 22px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.rules-dialog::backdrop { background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); }
.dialog-body { position: relative; padding: 0 0 26px; }
.dialog-body > :not(.dialog-cover):not(.dialog-close) { margin-left: 26px; margin-right: 26px; }
.dialog-cover { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; margin-bottom: 22px; }
.dialog-close { position: absolute; top: 14px; right: 14px; background: rgba(0, 0, 0, 0.5); color: #fff; border-color: transparent; }
.dialog-body h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.dialog-body p { color: var(--muted); margin-top: 0; }
.rules-table { width: calc(100% - 52px); border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.rules-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0 8px; }
.rules-table td { padding: 9px 0; border-top: 1px solid var(--line); }
.rules-table td:first-child { font-weight: 600; padding-right: 16px; }
.dialog-note { font-size: 14px; }
.dialog-body .btn { width: calc(100% - 52px); }

/* -------------------------------------------------------- responsive ---- */
@media (max-width: 960px) {
  .hero-slide { grid-template-columns: 1fr; gap: 28px; }
  .hero-visual { height: 380px; }
  .hero-cover { width: 62%; }
  .phone { right: 2%; }
}
@media (max-width: 640px) {
  :root { --header-h: 60px; }
  .header-inner { padding: 0 16px; gap: 12px; }
  .main-nav { margin: 0 0 0 auto; }
  .main-nav a { padding: 8px 10px; font-size: 14px; }
  .logo { font-size: 18px; }
  .hero { padding: 32px 16px 28px; }
  .hero-desc { font-size: 16px; margin-bottom: 24px; }
  .hero-visual { height: 300px; }
  .hero-cover { width: 70%; }
  .phone { border-radius: 26px; padding: 6px; }
  .phone-screen { border-radius: 21px; }
  .phone-ui { padding: 8px; gap: 5px; }
  .phone-chat { font-size: 9px; gap: 4px; }
  .phone-chat li:first-child { display: none; }
  .phone-rules { gap: 3px; }
  .phone-rules span { font-size: 8px; padding: 3px 5px; }
  .phone-rules b { font-size: 9px; }
  .games { padding: 44px 16px 16px; }
  .games-head h2 { font-size: 26px; }
  .game-grid { grid-template-columns: 1fr; }
  .cta { padding: 64px 16px 52px; }
  .cta p { font-size: 16px; }
  .footer-inner { padding: 24px 16px; }
  .footer-copy { margin-left: 0; }
  .play-bar { padding: 8px 16px; gap: 10px; }
  .play-title h1 { font-size: 17px; }
  .play-actions { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .play-actions .btn { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
