/* 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; }
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-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; }
.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; }
.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; }
.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 */
.games-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; }
.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; }
.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)); }
.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; }

/* 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; }
.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; }
.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; }
.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); }
.game-description { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; }
.game-description h2 { font-family:'Nunito',sans-serif; font-size:18px; line-height:1.25; margin-bottom:8px; }
.game-description p { color:var(--muted); font-size:14px; max-width:780px; }

/* 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-card img { width:56px; height:56px; aspect-ratio:1; object-fit:cover; border-radius:6px; flex-shrink:0; }
.related-card span { 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); padding:24px; margin-top:40px; }
.footer-inner { max-width:var(--content-max); margin:0 auto; display:flex; justify-content:space-between; align-items:center; font-size:13px; color:var(--muted); }
.footer-inner a:hover { color:var(--accent); }

/* 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; }
}
@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; }
  .hero { padding:40px 16px; }
  .main-content { padding:20px 16px 40px; }
  .game-controls { flex-direction:column; align-items:flex-start; }
  .footer-inner { flex-direction:column; gap:8px; text-align:center; }
}
