/* App Store Hall of Records - one stylesheet. Consumer entertainment look. */
:root {
  --bg: #0b1020;
  --bg2: #121a31;
  --card: #18213d;
  --card2: #1f294a;
  --ink: #eef2ff;
  --muted: #9aa6c7;
  --accent: #ffd24a;
  --accent2: #6ea8ff;
  --line: #283357;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
/* The hidden attribute must win over any display rule (e.g. the consent modal's
   display:flex), otherwise hide() cannot close the banner or preferences modal. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, #1a2647 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
img { max-width: 100%; }

/* Header */
.site-header { background: rgba(10,15,32,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.brand-mark { font-size: 24px; }
.brand-name b { color: var(--accent); }
.search { margin-left: auto; display: flex; gap: 8px; }
.search input { background: var(--card); border: 1px solid var(--line); color: var(--ink); padding: 9px 12px; border-radius: 10px; min-width: 220px; }
.search button { background: var(--accent); color: #1a1300; border: 0; padding: 9px 14px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.subnav { border-bottom: 1px solid var(--line); background: rgba(18,26,49,.5); }
.subnav .wrap { display: flex; gap: 18px; padding: 10px 20px; font-size: 14px; color: var(--muted); }
.subnav a:hover { color: var(--accent); }

/* Hero */
.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 { font-size: clamp(28px, 5vw, 46px); margin: 0 0 10px; letter-spacing: -.5px; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 18px; }

/* Sections */
.home-section { margin: 40px 0; }
.home-section h2 { font-size: 22px; margin: 0 0 16px; }
.section-lead { color: var(--muted); margin: -8px 0 16px; }

/* Champion cards */
.champion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.champion { background: linear-gradient(160deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: block; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease; }
.champion:hover { transform: translateY(-3px); border-color: var(--accent2); }
.champion-label { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.champion-body { display: flex; gap: 14px; align-items: center; }
.champion-meta { display: flex; flex-direction: column; min-width: 0; }
.champion-name { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.champion-sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.champion-value { color: var(--accent2); font-weight: 700; margin-top: 4px; }

/* Record cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; transition: transform .12s ease, border-color .12s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card-title { font-weight: 700; font-size: 16px; }
.card-winner { display: flex; gap: 12px; align-items: center; }
.card-winner-meta { min-width: 0; }
.card-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-value { color: var(--accent2); font-weight: 700; font-size: 14px; }
.card-cta { color: var(--muted); font-size: 13px; margin-top: auto; }

/* Icons */
.icon { border-radius: 22%; background: var(--card2); object-fit: cover; flex: none; }
.icon-empty { display: inline-flex; align-items: center; justify-content: center; font-size: 22px; }
.icon-sm { width: 36px; height: 36px; }
.icon-md { width: 56px; height: 56px; }
.icon-lg { width: 76px; height: 76px; }
.icon-xl { width: 110px; height: 110px; }

/* Category grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cat-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cat-card:hover { border-color: var(--accent2); }
.cat-name { font-weight: 700; }
.cat-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.cat-top-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Crowned + discovery + rabbit */
.crowned-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.crowned-list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.crowned-list a { color: var(--accent2); }
.crowned-when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.discovery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.disco-card { background: linear-gradient(160deg, #25305a, var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.disco-card:hover { border-color: var(--accent); }
.disco-emoji { font-size: 30px; display: block; }
.disco-title { font-weight: 700; font-size: 18px; display: block; margin-top: 6px; }
.disco-sub { color: var(--muted); font-size: 14px; }
.rabbit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.rabbit-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-align: center; }
.rabbit-card:hover { border-color: var(--accent2); }
.rabbit-name { display: block; font-weight: 600; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rabbit-count { color: var(--muted); font-size: 12px; }

/* Breadcrumbs + headings */
.crumbs { color: var(--muted); font-size: 13px; margin: 18px 0; }
.crumbs a:hover { color: var(--accent); }
h1 { font-size: clamp(24px, 4vw, 34px); }

/* Record page */
.record-head { margin-bottom: 20px; }
.explain { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0; }
.explain p { margin: 6px 0; }
.explain b { color: var(--accent); }
.record-stats { color: var(--muted); font-size: 14px; }
.leaderboard { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lb-row { display: grid; grid-template-columns: 34px 56px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.lb-leader { border-color: var(--accent); background: linear-gradient(120deg, #2a2a10, var(--card)); }
.lb-rank { font-weight: 700; color: var(--muted); text-align: center; }
.lb-leader .lb-rank { color: var(--accent); }
.lb-main { min-width: 0; }
.lb-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name:hover { color: var(--accent2); }
.lb-dev { color: var(--muted); font-size: 13px; }
.lb-bar { display: block; height: 5px; background: var(--card2); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.lb-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); }
.lb-value { font-weight: 700; color: var(--accent2); white-space: nowrap; }

/* App page */
.app-head { display: flex; gap: 18px; align-items: center; margin: 10px 0 20px; }
.app-id h1 { margin: 0 0 6px; }
.app-dev a { color: var(--accent2); }
.app-cat { color: var(--muted); margin: 4px 0; }
.store-link { display: inline-block; background: var(--accent); color: #1a1300; padding: 8px 14px; border-radius: 10px; font-weight: 700; margin-top: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 20px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat-k { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat-v { font-weight: 700; font-size: 17px; }
.shots { margin: 24px 0; }
.shot-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.shot { height: 320px; border-radius: 14px; border: 1px solid var(--line); flex: none; }
.records-in { margin: 28px 0; }
.pos-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.pos-list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
.pos-list a:hover { color: var(--accent2); }
.pos-rank { color: var(--accent); font-weight: 700; }

/* Developer + search lists */
.dev-apps, .search-results { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.dev-app a, .search-results a { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.dev-app a:hover, .search-results a:hover { border-color: var(--accent2); }
.dev-app-name, .sr-name { font-weight: 600; display: block; }
.dev-app-sub, .sr-dev { color: var(--muted); font-size: 13px; }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 24px 0; color: var(--muted); }
.pager a { color: var(--accent2); }

/* Records index */
.record-index { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px; }
.record-index li { display: flex; justify-content: space-between; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.record-index a:hover { color: var(--accent); }
.ri-count { color: var(--muted); font-size: 12px; }
.cat-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cat-block { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.cat-block h2 { font-size: 18px; margin: 0 0 8px; }
.cat-block ul { list-style: none; padding: 0; margin: 0; }
.cat-block li { padding: 4px 0; }
.cat-block a:hover { color: var(--accent2); }

/* Status table */
.status-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.status-table th, .status-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.status-table th { color: var(--muted); font-weight: 600; width: 240px; }

/* Misc */
.empty { color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.board { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin: 24px 0; }
.search-page { margin: 16px 0; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0; color: var(--muted); font-size: 14px; }
.fineprint { font-size: 12px; opacity: .8; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* Legal pages */
.legal { max-width: 820px; margin: 8px auto 40px; }
.legal h1 { margin-bottom: 6px; }
.legal h2 { font-size: 20px; margin: 28px 0 8px; color: var(--accent); }
.legal p, .legal li { color: #d7def5; }
.legal a { color: var(--accent2); text-decoration: underline; }
.legal ul { padding-left: 20px; }
.legal li { margin: 6px 0; }
.legal code { background: var(--card2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.legal-dates { color: var(--muted); font-size: 14px; }
.cookie-cats li, .consent-cats li { margin-bottom: 10px; }

/* Cookie consent banner */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: rgba(13,19,40,.98); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.4); }
.consent-inner { max-width: 1120px; margin: 0 auto; padding: 16px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.consent-text { margin: 0; flex: 1 1 360px; color: var(--ink); font-size: 14px; }
.consent-text a { color: var(--accent); text-decoration: underline; }
.consent-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.consent button, .consent-modal button { background: var(--card2); color: var(--ink); border: 1px solid var(--line); padding: 9px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; font-size: 14px; }
.consent button:hover, .consent-modal button:hover { border-color: var(--accent2); }
.consent button.primary, .consent-modal button.primary { background: var(--accent); color: #1a1300; border-color: var(--accent); }

/* Cookie preferences modal */
.consent-modal { position: fixed; inset: 0; z-index: 1001; background: rgba(4,7,16,.7); display: flex; align-items: center; justify-content: center; padding: 20px; }
.consent-modal-card { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow); }
.consent-modal-card h2 { margin: 0 0 8px; }
.consent-cats { list-style: none; padding: 0; margin: 16px 0; }
.consent-cats label { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.consent-cats span { display: block; color: var(--muted); font-size: 13px; margin: 4px 0 0 26px; }
.consent-cats input { width: 18px; height: 18px; accent-color: var(--accent); }
.consent-close { position: absolute; top: 12px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 8px; }
.consent-modal .consent-actions { justify-content: flex-end; margin-top: 16px; }

@media (max-width: 600px) {
  .consent-inner { flex-direction: column; align-items: stretch; }
  .consent-actions { justify-content: stretch; }
  .consent-actions button { flex: 1; }
}

@media (max-width: 600px) {
  .search input { min-width: 0; width: 130px; }
  .app-head { flex-direction: column; text-align: center; align-items: center; }
  .lb-row { grid-template-columns: 28px 44px 1fr auto; }
}
