/* MadKid Games — Public Site */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:#0d0f1a; --surface:#151828; --surface2:#1e2135;
  --accent:#ff6b35; --accent2:#ffd166; --blue:#4ecdc4;
  --text:#f0f0f8; --muted:#8888aa; --border:#252840;
  --radius:12px; --header-h:64px; --content-max:1360px;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family:'Inter',sans-serif; font-size:15px; line-height:1.5; min-height:100vh; }
body.theme-light { --bg:#f6f7fb; --surface:#ffffff; --surface2:#eef1f7; --text:#111827; --muted:#5f6678; --border:#d8deea; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Header */
.site-header { position:sticky; top:0; z-index:100; background:rgba(13,15,26,.92); backdrop-filter:blur(12px); border-bottom:1px solid var(--border); height:var(--header-h); }
.header-inner { max-width:var(--content-max); margin:0 auto; padding:0 24px; height:100%; display:flex; align-items:center; gap:24px; }
.logo { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.logo-icon { font-size:24px; }
.logo-img { width:30px; height:30px; object-fit:contain; flex-shrink:0; }
.logo-text { font-family:'Nunito',sans-serif; font-weight:900; font-size:20px; background:linear-gradient(135deg,var(--accent),var(--accent2)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.search-form { flex:1; max-width:480px; display:flex; background:var(--surface2); border:1px solid var(--border); border-radius:10px; overflow:hidden; transition:border-color .2s; }
.search-form:focus-within { border-color: var(--accent); }
.search-form input { flex:1; background:transparent; border:none; outline:none; color:var(--text); padding:0 16px; font-size:14px; height:42px; font-family:'Inter',sans-serif; }
.search-form input::placeholder { color:var(--muted); }
.search-form button { background:transparent; border:none; padding:0 16px; color:var(--muted); cursor:pointer; display:flex; align-items:center; transition:color .2s; }
.search-form button:hover { color:var(--accent); }
.header-nav { margin-left:auto; display:flex; align-items:center; gap:12px; }
.stat-badge { background:var(--surface2); border:1px solid var(--border); border-radius:20px; padding:4px 14px; font-size:13px; color:var(--muted); }
.breadcrumb { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--muted); }
.breadcrumb a:hover { color:var(--accent); }
.breadcrumb span:last-child { color:var(--text); font-weight:600; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Hero */
.hero { background:linear-gradient(135deg,#1a0a3e 0%,#0d1a3a 50%,#0d0f1a 100%); padding:60px 24px; text-align:center; position:relative; overflow:hidden; }
.theme-light .site-header { background:rgba(255,255,255,.94); }
.theme-light .hero { background:linear-gradient(135deg,#fff3eb 0%,#eef4ff 55%,#ffffff 100%); }
.hero::before { content:''; position:absolute; inset:0; background:radial-gradient(ellipse 80% 60% at 50% 0%,rgba(255,107,53,.15) 0%,transparent 70%); pointer-events:none; }
.theme-light .hero::before { background:radial-gradient(ellipse 80% 60% at 50% 0%,rgba(255,107,53,.12) 0%,transparent 70%); }
.hero-content { position:relative; z-index:1; width:min(calc(100% - 96px),1120px); margin:0 auto; padding:0; }
.hero h1 { font-family:'Nunito',sans-serif; font-weight:900; font-size:clamp(32px,5vw,56px); line-height:1.1; margin-bottom:12px; }
.hero-accent { background:linear-gradient(135deg,var(--accent),var(--accent2)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.hero p { color:var(--muted); font-size:16px; width:min(100%,920px); margin:0 auto; text-align:center; text-wrap:balance; overflow-wrap:break-word; }
.hero-inline { border:1px solid var(--border); border-radius:var(--radius); padding:42px 24px; margin:0 auto 32px; }

/* Main */
.main-content { max-width:var(--content-max); margin:0 auto; padding:28px 24px 60px; }
.section-header { display:flex; align-items:center; gap:16px; margin-bottom:24px; }
.section-header h2 { font-family:'Nunito',sans-serif; font-weight:800; font-size:22px; }
.btn-clear { margin-left:auto; color:var(--muted); font-size:13px; padding:5px 12px; border:1px solid var(--border); border-radius:20px; transition:all .2s; background:transparent; font-family:'Inter',sans-serif; cursor:pointer; }
.btn-clear:hover { color:var(--text); border-color:var(--muted); }
.home-feature { width:min(var(--feature-width,1320px),100%); margin:0 auto 32px; display:flex; flex-direction:column; align-items:center; gap:18px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; text-align:center; }
.home-feature-frame { width:100%; background:#000; border-radius:10px; overflow:hidden; aspect-ratio:16/9; min-height:520px; }
.home-feature-frame iframe { width:100%; height:100%; border:0; display:block; }
.home-feature-info { width:100%; max-width:920px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:12px; padding:4px; text-align:center; }
.feature-label { color:var(--accent2); font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.home-feature-info h2 { font-family:'Nunito',sans-serif; font-size:26px; line-height:1.15; }
.home-feature-info p { color:var(--muted); font-size:14px; max-width:860px; }

/* Game Grid */
.game-row-section { margin-bottom:36px; }
.section-footer { display:flex; justify-content:center; margin-top:20px; }
.games-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; }
.games-grid.games-grid-seven { grid-template-columns:repeat(7,minmax(0,1fr)); gap:14px; }
.game-card { border-radius:var(--radius); overflow:hidden; display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--border); transition:transform .22s ease,box-shadow .22s ease,border-color .22s; }
.game-card:hover { transform:translateY(-5px) scale(1.02); box-shadow:0 12px 40px rgba(0,0,0,.5); border-color:var(--accent); }
.game-card.is-starred { border-color:rgba(255,209,102,.3); }
.card-thumb { position:relative; width:100%; aspect-ratio:1; overflow:hidden; background:var(--surface2); display:block; flex-shrink:0; }
.card-thumb img { width:100%; height:100%; aspect-ratio:1; object-fit:cover; object-position:center; display:block; transition:transform .3s ease; }
.card-video { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition:opacity .18s ease; background:transparent; pointer-events:none; }
.game-card.is-video-playing .card-video, .related-card.is-video-playing .card-video { opacity:1; }
.game-card:hover .card-thumb img { transform:scale(1.08); }
.star-badge { position:absolute; top:8px; right:8px; font-size:16px; filter:drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.grand-badge { background:linear-gradient(135deg,var(--accent),var(--accent2)); color:#15100a; border-radius:999px; padding:3px 8px; font-size:10px; font-weight:900; text-transform:uppercase; letter-spacing:0; }
.card-info { padding:9px 11px 11px; background:var(--surface); }
.card-info h3 { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--text); margin:0; line-height:1.4; }
.latest-card.is-hidden, .continue-section[hidden] { display:none; }

/* Empty state */
.empty-state { text-align:center; padding:80px 24px; }
.empty-icon { font-size:60px; margin-bottom:20px; }
.empty-state h3 { font-size:22px; margin-bottom:10px; }
.empty-state p { color:var(--muted); margin-bottom:24px; }
.btn-primary { display:inline-block; background:var(--accent); color:#fff; font-weight:700; padding:12px 28px; border-radius:8px; transition:background .2s; }
.btn-primary:hover { background:#e55a25; }

/* Game page */
body.game-page { background:#080a12; }
.theme-light.game-page { background:#f6f7fb; }
.game-layout { max-width:1400px; margin:0 auto; padding:24px; display:grid; grid-template-columns:1fr 260px; gap:24px; align-items:start; }
.game-section { display:flex; flex-direction:column; gap:16px; }
.game-frame-wrapper { background:#000; border-radius:var(--radius); overflow:hidden; aspect-ratio:16/9; position:relative; }
.game-frame-wrapper iframe { width:100%; height:100%; border:none; display:block; }
.game-controls { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 20px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.game-title-row { display:flex; align-items:center; gap:12px; }
.game-title-row h1 { font-family:'Nunito',sans-serif; font-weight:800; font-size:20px; }
.star-label { background:rgba(255,209,102,.15); color:var(--accent2); font-size:12px; padding:3px 10px; border-radius:20px; font-weight:600; }
.play-count { background:var(--surface2); border:1px solid var(--border); color:var(--muted); font-size:12px; padding:3px 10px; border-radius:20px; font-weight:700; white-space:nowrap; }
.game-actions { display:flex; gap:10px; }
.btn-action { display:inline-flex; align-items:center; gap:6px; background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:8px 16px; font-size:13px; font-weight:600; color:var(--text); cursor:pointer; transition:all .2s; font-family:'Inter',sans-serif; text-decoration:none; }
.btn-action:hover { background:var(--accent); border-color:var(--accent); }
.btn-secondary:hover { background:var(--surface2); border-color:var(--border); color:var(--muted); }
.rating-panel { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.vote-form { display:flex; gap:10px; flex-wrap:wrap; }
.vote-btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-width:76px; background:var(--surface2); border:1px solid var(--border); border-radius:8px; padding:9px 14px; color:var(--text); font-family:'Inter',sans-serif; font-size:13px; font-weight:600; cursor:pointer; transition:all .2s; }
.vote-btn:hover, .vote-btn.is-active { border-color:var(--accent); background:rgba(255,107,53,.14); }
.vote-icon { font-size:18px; line-height:1; }
.vote-btn strong { color:var(--accent2); font-weight:800; }
.report-vote-btn { min-width:auto; }
.rating-side { margin-left:auto; display:flex; align-items:center; justify-content:flex-end; gap:12px; flex-wrap:wrap; }
.report-side-btn { white-space:nowrap; }
.rating-summary { display:flex; align-items:baseline; gap:8px; color:var(--muted); font-size:13px; }
.rating-summary.is-hidden { display:none; }
.rating-summary strong { color:var(--accent2); font-size:18px; font-family:'Nunito',sans-serif; }
.rating-summary small { color:var(--muted); }
.ad-slot { width:100%; margin:18px 0; display:flex; justify-content:center; align-items:center; overflow:hidden; }
.ad-slot iframe, .ad-slot ins, .ad-slot img { max-width:100%; }
.game-description { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:22px 24px; }
.game-description h2 { font-family:'Nunito',sans-serif; font-size:22px; line-height:1.25; margin-bottom:14px; }
.game-instructions { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:22px 24px; }
.game-instructions h2 { font-family:'Nunito',sans-serif; font-size:22px; line-height:1.25; margin-bottom:14px; }
.game-backlink { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px 20px; }
.game-backlink a { color:var(--accent2); font-weight:800; }
.game-backlink a:hover { color:var(--accent); }
.description-prose { color:var(--muted); font-size:15px; line-height:1.75; max-width:1000px; }
.description-prose p + p { margin-top:16px; }
.description-prose p { overflow-wrap:break-word; }
.instruction-prose { color:var(--text); }
.report-modal { position:fixed; inset:0; background:rgba(0,0,0,.68); z-index:400; display:none; align-items:center; justify-content:center; padding:20px; }
.report-modal.open { display:flex; }
.report-modal-content { width:min(420px,100%); background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:24px; position:relative; box-shadow:0 20px 70px rgba(0,0,0,.5); }
.report-modal-content h2 { font-family:'Nunito',sans-serif; font-size:22px; margin-bottom:14px; }
.report-close { position:absolute; top:12px; right:14px; width:28px; height:28px; border:0; border-radius:50%; background:var(--surface2); color:var(--text); cursor:pointer; }
.report-options { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.report-options label { background:var(--surface2); border:1px solid var(--border); border-radius:999px; padding:7px 12px; font-size:13px; cursor:pointer; }
.report-modal textarea, .report-modal input[type=email], .report-modal input[type=text] { width:100%; background:var(--surface2); border:1px solid var(--border); border-radius:8px; color:var(--text); padding:10px 12px; margin-bottom:10px; font-family:'Inter',sans-serif; }
.report-modal textarea { min-height:96px; resize:vertical; }

/* Policy pages */
.policy-page { max-width:900px; margin:0 auto; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:34px; }
.policy-page h1 { font-family:'Nunito',sans-serif; font-size:36px; line-height:1.1; margin-bottom:12px; }
.policy-intro { color:var(--muted); font-size:16px; margin-bottom:28px; }
.policy-page section { border-top:1px solid var(--border); padding-top:20px; margin-top:20px; }
.policy-page h2 { font-family:'Nunito',sans-serif; font-size:20px; margin-bottom:8px; }
.policy-page p { color:var(--muted); }

/* Related */
.related-section { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; position:sticky; top:calc(var(--header-h) + 16px); }
.related-section h2 { font-family:'Nunito',sans-serif; font-weight:800; font-size:16px; margin-bottom:16px; }
.related-grid { display:flex; flex-direction:column; gap:10px; }
.related-card { display:flex; align-items:center; gap:10px; border-radius:8px; padding:6px 8px; transition:background .2s; position:relative; }
.related-card:hover { background:var(--surface2); }
.related-thumb { position:relative; width:56px; height:56px; border-radius:6px; overflow:hidden; flex-shrink:0; background:var(--surface2); }
.related-card img { width:56px; height:56px; aspect-ratio:1; object-fit:cover; border-radius:6px; flex-shrink:0; }
.related-title { font-size:13px; font-weight:500; line-height:1.3; flex:1; }
.mini-star { font-size:12px; }

/* Footer */
.site-footer { border-top:1px solid var(--border); background:#0b1222; padding:46px 24px 24px; margin-top:40px; }
.theme-light .site-footer { background:#eef1f7; }
.footer-inner { max-width:var(--content-max); margin:0 auto; font-size:14px; color:var(--muted); }
.footer-grid { display:grid; grid-template-columns:1.3fr 1fr 1fr 1fr; gap:36px; align-items:start; }
.footer-about strong, .footer-contact strong { color:var(--text); }
.footer-about p { max-width:320px; }
.footer-links { display:flex; flex-direction:column; gap:8px; }
.footer-contact { display:flex; flex-direction:column; gap:8px; }
.footer-inner a:hover, .footer-bottom a:hover { color:var(--accent); }
.footer-bottom { max-width:var(--content-max); margin:32px auto 0; padding-top:24px; border-top:1px solid var(--border); text-align:center; color:var(--muted); font-size:13px; }

/* Responsive */
@media (max-width:900px) {
  .hero-content { width:min(calc(100% - 32px),1120px); }
  .home-feature-frame { min-height:0; }
  .game-layout { grid-template-columns:1fr; }
  .related-section { position:static; }
  .game-frame-wrapper { aspect-ratio:4/3; }
  .games-grid.games-grid-seven { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .footer-grid { grid-template-columns:1fr 1fr; }
}
@media (max-width:600px) {
  .header-inner { gap:12px; }
  .logo-text { font-size:16px; }
  .stat-badge { display:none; }
  .games-grid { grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:12px; }
  .games-grid.games-grid-seven { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .hero { padding:40px 16px; }
  .main-content { padding:20px 16px 40px; }
  .game-controls { flex-direction:column; align-items:flex-start; }
  .footer-grid { grid-template-columns:1fr; gap:22px; }
  .policy-page { padding:24px 18px; }
  .policy-page h1 { font-size:30px; }
}
