:root {
  --ink: #0f2a4a; --muted: #5b6b82; --line: #dbe7f5; --card: #ffffff;
  --blue: #1e6fd9; --blue-2: #3aa0ff; --orange: #ff8a1f; --green: #3cc45a; --yellow: #ffc83d;
  --radius: 18px; --shadow: 0 6px 20px rgba(15, 42, 74, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink); background: #f3f8ff;
  background-image: radial-gradient(circle at 10% 0%, #e2f0ff 0, transparent 40%), radial-gradient(circle at 90% 10%, #fff2e2 0, transparent 35%);
  min-height: 100vh;
}
a { color: inherit; }
button, input { font: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  padding: .6rem clamp(.75rem, 3vw, 2rem); background: rgba(255,255,255,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand img { width: 52px; height: 52px; object-fit: contain; }
.brand span { font-weight: 900; font-size: 1.35rem; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--orange), var(--yellow) 30%, var(--blue-2) 60%, var(--green));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar .spacer { flex: 1; }
.search { position: relative; width: min(340px, 45vw); }
.search input { width: 100%; padding: .6rem 1rem .6rem 2.3rem; border: 2px solid var(--line); border-radius: 999px; background: #fff; outline: none; }
.search input:focus { border-color: var(--blue-2); }
.search::before { content: "🔍"; position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); font-size: .9rem; opacity: .7; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(1rem, 4vw, 3rem); align-items: center;
  max-width: 1200px; margin: 1.5rem auto 0; padding: 0 clamp(.75rem, 3vw, 2rem); }
.hero img { width: clamp(140px, 22vw, 260px); filter: drop-shadow(0 10px 24px rgba(30,111,217,.18)); }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 3rem); margin: 0 0 .4rem; line-height: 1.1; }
.hero p { margin: 0 0 1rem; color: var(--muted); font-size: 1.1rem; max-width: 46ch; }
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 0; cursor: pointer; text-decoration: none;
  padding: .7rem 1.2rem; border-radius: 12px; font-weight: 800; color: #fff; background: var(--blue);
  box-shadow: 0 4px 0 #154f9c; transition: transform .08s; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #154f9c; }
.btn.orange { background: var(--orange); box-shadow: 0 4px 0 #c96508; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--line) inset; }
.hero .stats { display: flex; gap: 1.2rem; margin-top: 1rem; color: var(--muted); font-weight: 700; flex-wrap: wrap; }
.hero .stats b { color: var(--ink); font-size: 1.2rem; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; text-align: center; } .hero img { margin: 0 auto; } .hero p { margin-inline: auto; } .hero .stats { justify-content: center; } .brand span { display: none; } }

/* ---------- filters ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 1rem clamp(.75rem, 3vw, 2rem) 3rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1.5rem 0 .5rem; }
.chip { border: 2px solid var(--line); background: #fff; padding: .45rem 1rem; border-radius: 999px; cursor: pointer; font-weight: 800; color: var(--muted); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.section-title { display: flex; align-items: baseline; gap: .6rem; margin: 2rem 0 .8rem; }
.section-title h2 { margin: 0; font-size: 1.4rem; letter-spacing: .5px; }
.section-title span { color: var(--muted); font-weight: 700; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-decoration: none;
  display: flex; flex-direction: column; border: 2px solid transparent; transition: transform .15s, border-color .15s; }
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: var(--blue-2); outline: none; }
.thumb { position: relative; aspect-ratio: 16/10; display: grid; place-items: center; font-size: 3.4rem; overflow: hidden; }
.thumb::after { content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 16px 16px; }
.thumb .emo { position: relative; z-index: 1; filter: drop-shadow(0 6px 8px rgba(0,0,0,.25)); transition: transform .2s; }
.card:hover .emo { transform: scale(1.15) rotate(-6deg); }
.thumb .tag { position: absolute; z-index: 1; top: .6rem; left: .6rem; background: rgba(255,255,255,.92); color: var(--ink);
  font-size: .72rem; font-weight: 900; padding: .2rem .55rem; border-radius: 999px; letter-spacing: .5px; text-transform: uppercase; }
.card .body { padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.card h3 { margin: 0; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.card .play { margin-top: .5rem; align-self: flex-start; font-weight: 900; color: var(--blue); }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

footer { text-align: center; color: var(--muted); padding: 2rem 1rem; border-top: 1px solid var(--line); font-size: .9rem; }

/* ---------- play page ---------- */
.play-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.play-page .topbar { position: static; }
.play-page .title { display: flex; flex-direction: column; min-width: 0; }
.play-page .title b { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-page .title small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-page .actions { display: flex; gap: .4rem; }
.play-page .actions .btn { padding: .5rem .8rem; }
.stage { flex: 1; min-height: 0; padding: .6rem; display: flex; }
.stage iframe { flex: 1; width: 100%; border: 0; border-radius: 14px; background: #000; box-shadow: var(--shadow); }
.more { padding: 0 .6rem .6rem; }
.more .row { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .2rem; }
.mini { flex: 0 0 auto; display: flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 999px; background: #fff;
  border: 2px solid var(--line); text-decoration: none; font-weight: 800; font-size: .88rem; }
.mini:hover { border-color: var(--blue-2); }
@media (max-width: 640px) { .play-page .actions .label { display: none; } .play-page .brand img { width: 40px; height: 40px; } }

/* ---------- ads (hidden until ads-config.js turns them on) ---------- */
.ad-slot { display: none; }
.ad-slot.on { display: block; margin: 1rem auto; text-align: center; min-height: 90px; }
.ad-slot.on::before { content: "Advertisement"; display: block; font-size: .7rem; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: .2rem; }

/* ---------- footer links + simple content pages ---------- */
footer nav { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; margin-bottom: .6rem; }
footer nav a { color: var(--blue); font-weight: 700; text-decoration: none; }
.page { max-width: 760px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem; line-height: 1.65; }
.page h1 { line-height: 1.2; }
.page h2 { margin-top: 2rem; }

/* ---------- play page: side ad on wide screens, focus (full screen) mode ---------- */
.play-main { flex: 1; min-height: 0; display: flex; }
.play-main .stage { flex: 1; }
.play-main .ad-slot.on { width: 300px; flex: 0 0 300px; margin: .6rem .6rem .6rem 0; }
@media (max-width: 1100px) { .play-main .ad-slot { display: none !important; } }
.play-page .ad-slot[data-slot="play_bottom"].on { margin: 0 auto .4rem; min-height: 50px; max-height: 120px; overflow: hidden; width: 100%; }
#exit-focus { display: none; position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 50; border: 0; border-radius: 999px; width: 34px; height: 34px; opacity: .8;
  background: rgba(15,42,74,.75); color: #fff; font-size: 1.2rem; cursor: pointer; }
body.focus .topbar, body.focus .more, body.focus .ad-slot { display: none !important; }
body.focus .stage { padding: 0; }
body.focus .stage iframe { border-radius: 0; }
body.focus #exit-focus { display: block; }
@media (max-width: 640px) { .stage { padding: .3rem; } .play-page .topbar { padding: .4rem .5rem; gap: .5rem; } .play-page .title small { display: none; } }
@media (max-width: 480px) { .play-page .topbar .brand { display: none; } }
