:root {
  --bg: #070b10;
  --card: #10161f;
  --line: rgba(94, 234, 212, 0.16);
  --cyan: #2ee6d6;
  --cyan-2: #14b8a6;
  --text: #f4f7fb;
  --muted: #9aa6b2;
  --font: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
html:has(body.is-player) { overflow: hidden; height: 100%; }

img, video { max-width: 100%; height: auto; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(46, 230, 214, 0.12), transparent 50%),
    radial-gradient(700px 380px at 0% 100%, rgba(20, 184, 166, 0.08), transparent 46%),
    var(--bg);
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #fff; }

.topbar {
  position: relative;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 8px;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}
.brand-mark {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(46, 230, 214, 0.35));
}
.brand-name {
  font-weight: 800;
  letter-spacing: 0.22em;
  font-size: 18px;
}

.nav { display: flex; align-items: center; gap: 22px; }
.nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav a.is-on, .nav a:hover { color: #fff; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}
.lang-switch a {
  display: inline-flex;
  min-width: 36px;
  justify-content: center;
  font-size: 12px !important;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.lang-switch a[aria-current="true"] {
  color: #06201d;
  background: var(--cyan);
  border-radius: 999px;
  padding: 6px 8px;
}

.nav-toggle {
  display: none;
  background: var(--card);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
}

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 18px 0 72px; }

body.is-player {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}
body.is-player .foot { display: none; }
body.is-player .topbar { flex: 0 0 auto; padding-top: 14px; padding-bottom: 8px; }
body.is-player main {
  width: min(1100px, calc(100% - 40px));
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 0 12px;
  overflow: hidden;
}

.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 280px;
  background: #0b1220;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.hero-media, .hero-media img:first-child {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 70%;
}

.hero-char {
  position: absolute !important;
  left: 46%;
  bottom: 0;
  width: auto !important;
  height: 92% !important;
  object-fit: contain !important;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 16, 24, 0.72) 0%, rgba(7, 16, 24, 0.18) 46%, rgba(6, 40, 42, 0.42) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 280px;
  padding: 36px 42px;
}

.hero-left, .hero-right { max-width: 420px; }
.hero-right { text-align: right; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-left h1, .hero-right h2 {
  margin: 0 0 12px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.lead { margin: 0 0 20px; color: #d5dee6; font-size: 16px; max-width: 36ch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  min-height: 44px;
  font: 700 13px/1 var(--font);
  letter-spacing: 0.04em;
  cursor: pointer;
  text-transform: uppercase;
}

.btn-cyan {
  background: linear-gradient(180deg, #5ff5e7, var(--cyan));
  color: #06201d;
  box-shadow: 0 8px 24px rgba(46, 230, 214, 0.25);
}
.btn-cyan:hover { color: #06201d; filter: brightness(1.06); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn-mini { padding: 9px 14px; font-size: 12px; }
.btn.danger { color: #ffb4c6; }

.block { padding: 56px 0 8px; }
.block-head { text-align: center; margin-bottom: 28px; }
.block-head h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.game-grid, .studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 22px;
}

.game-card, .mini-card, .studio-card, .empty-card, .auth-card, .admin-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.game-cover {
  display: block;
  aspect-ratio: 16 / 10;
  background: #0b1018;
  overflow: hidden;
}
.game-cover img, .cover-fallback, .mini-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}
.cover-fallback {
  display: grid;
  place-items: center;
  min-height: 160px;
  background: linear-gradient(160deg, hsl(var(--h), 55%, 24%), #10161f);
  font-size: 42px;
  font-weight: 800;
  color: var(--cyan);
}

.game-body, .mini-card, .empty-card, .studio-card, .auth-form, .pad { padding: 18px 18px 20px; }
.game-body h3, .mini-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.game-body p, .mini-card p, .studio-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tags span {
  color: var(--cyan);
  border: 1px solid rgba(46, 230, 214, 0.28);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mini-card img { height: 120px; display: block; }
.mini-card .mini-icon {
  height: 88px;
  width: auto;
  margin: 18px auto 0;
  object-fit: contain;
}
.mini-card h3, .mini-card p { padding: 0 4px; }

.upload-split {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 20px;
  align-items: center;
}
.upload-split ol { margin: 0; padding-left: 18px; color: #d5dee6; }
.upload-cta { text-align: center; }

.player-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}
.player-banner {
  flex: 0 0 auto;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(46, 230, 214, 0.08), rgba(255,255,255,0.02));
}
.player-banner h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.player-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.player-window {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #05080d;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.player-stage {
  position: relative;
  height: 100%;
  min-height: 0;
  background: #000;
}
.player-stage iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #000;
  overflow: hidden;
}
.player-window:fullscreen,
.player-window:-webkit-full-screen { width: 100%; height: 100%; border: 0; border-radius: 0; }
.player-window:fullscreen .player-stage,
.player-window:-webkit-full-screen .player-stage {
  aspect-ratio: auto;
  height: 100vh;
}
.player-window:fullscreen iframe,
.player-window:-webkit-full-screen iframe { height: 100%; }
.player-desc { color: var(--muted); margin: 0; }

.auth-wrap { display: grid; place-items: center; min-height: 58vh; }
.auth-card { width: min(440px, 100%); }
.auth-form { display: grid; gap: 14px; }
.auth-form h1 { margin: 0; font-size: 28px; letter-spacing: 0.08em; text-transform: uppercase; }

label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1118;
  color: var(--text);
  padding: 12px;
  font: 16px/1.4 var(--font);
}
input:focus, textarea:focus { outline: 2px solid rgba(46, 230, 214, 0.45); }

.alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #3a1524;
  color: #ffd0e0;
}
.alert.ok { background: #0d2a24; color: #c9fff6; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.admin-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.row-actions, .row-actions form { display: flex; gap: 8px; margin: 0; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
code { color: var(--cyan); }

.foot {
  padding: 28px 20px 40px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.foot-brand {
  margin: 0 0 6px;
  color: #fff;
  letter-spacing: 0.2em;
  font-weight: 800;
}
.foot p { margin: 6px 0; }
.foot-links { display: flex; justify-content: center; gap: 18px; }

@media (max-width: 1100px) {
  .hero-inner { padding: 28px 28px; gap: 18px; }
  .hero-char { left: 52%; }
}

@media (max-width: 860px) {
  .topbar, main, body.is-player main {
    width: calc(100% - 20px);
  }
  .topbar { padding-top: 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 15px; letter-spacing: 0.14em; }

  .nav-toggle { display: block; min-width: 44px; min-height: 44px; }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 50;
    flex-direction: column;
    gap: 4px;
    background: #10161f;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }
  .nav.is-open { display: flex; }
  .nav a {
    padding: 12px 12px;
    border-radius: 10px;
    font-size: 16px;
  }
  .nav a.is-on { background: rgba(46, 230, 214, 0.1); }
  .lang-switch {
    margin: 8px 0 0;
    padding: 10px 4px 4px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .lang-switch a { padding: 10px 12px; font-size: 14px !important; }

  .hero-banner { border-radius: 16px; }
  .hero-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 22px 18px 22px;
    min-height: 300px;
    gap: 16px;
  }
  .hero-left, .hero-right {
    max-width: none;
    width: 100%;
    text-align: left;
  }
  .hero-char {
    left: auto !important;
    right: 2%;
    height: 48% !important;
    opacity: 0.9;
  }
  .hero-left h1, .hero-right h2 {
    font-size: clamp(26px, 8vw, 36px);
  }
  .lead { font-size: 15px; max-width: none; }
  .hero-char { max-width: 42%; }
  .player-top { flex-wrap: wrap; }

  .block { padding: 36px 0 8px; }
  .block-head { margin-bottom: 18px; }
  .block-head h2 { font-size: 20px; letter-spacing: 0.1em; }

  .hero-inner, .game-grid, .studio-grid, .admin-grid, .upload-split {
    grid-template-columns: 1fr;
  }
  .game-grid, .studio-grid { gap: 16px; }

  .game-actions { display: flex; }
  .game-actions .btn { flex: 1; }

  .upload-cta { text-align: left; }
  .upload-cta .btn { width: 100%; }

  .admin-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-wrap { padding: 12px 0 32px; }
  .auth-card { width: 100%; }
  .auth-form h1 { font-size: 22px; }

  .foot { padding: 24px 16px 32px; }
  .foot-links { flex-wrap: wrap; gap: 12px 16px; }

  body.is-player .topbar,
  body.is-player .foot {
    display: none;
  }
  body.is-player main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  body.is-player .player-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    flex: 1;
  }
  body.is-player .player-top {
    flex: 0 0 auto;
    padding: 10px 12px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: #070b10;
  }
  body.is-player .player-banner {
    flex: 0 0 auto;
    margin: 0 12px 8px;
    padding: 10px 12px;
    border-radius: 12px;
  }
  body.is-player .player-banner h1 { font-size: 15px; margin: 0 0 4px; }
  body.is-player .player-banner p { font-size: 12px; }
  body.is-player .player-window {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    margin: 0 8px 8px;
    margin-bottom: calc(8px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 12px;
  }
  body.is-player .player-stage,
  body.is-player .player-stage iframe {
    min-height: 0;
    height: 100%;
    aspect-ratio: auto;
    border: 0;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .hero-inner { min-height: 280px; padding: 18px 14px; }
  .hero-char { height: 40% !important; }
  .game-body, .mini-card, .empty-card, .studio-card, .auth-form, .pad { padding: 14px; }
}
