:root {
  --bg: #0d0f14;
  --bg-2: #141821;
  --panel: #191e29;
  --panel-2: #212736;
  --line: #2a3142;
  --text: #e8ebf2;
  --muted: #98a1b3;
  --faint: #5d6679;
  --accent: #7c5cff;
  --accent-2: #a48bff;
  --today: #ffb547;
  --ps: #2f7df6;
  --xbox: #19a33a;
  --nintendo: #e60012;
  --pc: #8b95a7;
  --steam: #1b2838;
  --epic: #313131;
  --gog: #86328a;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8; --bg-2: #ffffff; --panel: #ffffff; --panel-2: #eef0f5; --line: #dde1ea;
    --text: #151821; --muted: #5a6274; --faint: #9aa2b3; --shadow: 0 10px 30px rgba(20, 24, 33, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent-2); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { display: block; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 16px; align-items: center; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--text);
  font-weight: 800; letter-spacing: -.02em; font-size: 18px; white-space: nowrap; }
.views { display: flex; gap: 4px; background: var(--panel); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.views button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 14px; }
.views button[aria-selected="true"] { background: var(--accent); color: #fff; }
.count:not(:empty) { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: rgba(255,255,255,.18); font-size: 11px; }
.search { margin-left: auto; position: relative; display: flex; align-items: center; flex: 0 1 300px; }
.search svg { position: absolute; left: 10px; width: 16px; fill: var(--muted); pointer-events: none; }
.search input { width: 100%; padding: 8px 12px 8px 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }

/* ---------- toolbar ---------- */
.toolbar { max-width: 1400px; width: 100%; margin: 0 auto; padding: 16px 16px 8px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav h1 { margin: 0 4px; font-size: 24px; letter-spacing: -.02em; min-width: 200px; text-align: center; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 22px; line-height: 1; }
.ghost { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 14px; }
.ghost:hover, .icon-btn:hover { border-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { --c: var(--accent); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 700; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.plat-playstation { --c: var(--ps); } .plat-xbox { --c: var(--xbox); } .plat-nintendo { --c: var(--nintendo); } .plat-pc { --c: #4b5567; }
select { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; max-width: 170px; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); padding: 0 4px; }

main { flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; padding: 8px 16px 32px; }
.loading, .empty { padding: 60px 16px; text-align: center; color: var(--muted); }
.foot { max-width: 1400px; width: 100%; margin: 0 auto; padding: 16px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--faint); font-size: 13px; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
body.month-hidden .month-nav { visibility: hidden; height: 0; overflow: hidden; }

/* ---------- calendar grid ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 0 6px; font-weight: 700; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 150px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.day.other { opacity: .45; }
.day.past .dnum { color: var(--faint); }
.day.today { border-color: var(--today); box-shadow: inset 0 0 0 1px var(--today); }
.dnum { font-weight: 800; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; padding: 0 2px; }
.day.today .dnum b { background: var(--today); color: #000; border-radius: 6px; padding: 0 6px; }
.dnum .n { font-size: 11px; font-weight: 600; color: var(--faint); }
.ent { display: flex; gap: 6px; align-items: center; padding: 3px; border-radius: 8px; border: 0; background: transparent; text-align: left; width: 100%; min-width: 0; }
.ent:hover { background: var(--panel-2); }
.ent img, .ent .noimg { width: 30px; height: 40px; border-radius: 5px; object-fit: cover; flex: none; background: var(--panel-2); }
.ent .t { font-size: 12.5px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.ent .dots { display: flex; gap: 3px; margin-top: 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.playstation { background: var(--ps); } .dot.xbox { background: var(--xbox); } .dot.nintendo { background: var(--nintendo); } .dot.pc { background: var(--pc); }
.more { margin-top: auto; border: 0; background: var(--panel-2); border-radius: 8px; padding: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.more:hover { color: var(--text); }
.month-extra { margin-top: 20px; }

/* ---------- list / cards ---------- */
.group { scroll-margin-top: 130px; margin: 18px 0 8px; display: flex; align-items: baseline; gap: 10px; position: sticky; top: 57px; z-index: 5; background: var(--bg); padding: 8px 0; }
.group h2 { margin: 0; font-size: 18px; }
.group .sub { color: var(--faint); font-size: 13px; }
.group.today h2 { color: var(--today); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.card { display: flex; gap: 12px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; position: relative; min-width: 0; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card { transition: border-color .15s, transform .15s; }
.card img, .card .noimg { width: 72px; height: 96px; border-radius: 8px; object-fit: cover; flex: none; background: var(--panel-2); }
.card .body { min-width: 0; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .t { font-weight: 700; font-size: 15px; line-height: 1.25; padding-right: 28px; }
.card .meta { font-size: 12.5px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; color: #fff; background: var(--pc); }
.badge.playstation { background: var(--ps); } .badge.xbox { background: var(--xbox); } .badge.nintendo { background: var(--nintendo); } .badge.pc { background: #4b5567; }
.badge.soft { background: var(--panel-2); color: var(--muted); }
.badge.dlc { background: #a16207; }
.hype { color: var(--today); font-weight: 700; }
.star { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; font-size: 18px; color: var(--faint); }
.star[aria-pressed="true"] { color: var(--today); }
.star:hover { background: var(--panel-2); }

/* ---------- setup / notices ---------- */
.notice { max-width: 760px; margin: 30px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px 28px; }
.notice h2 { margin-top: 0; }
.notice code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; }
.notice ol li { margin: 6px 0; }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin: 14px 0; }
.progress > div { height: 100%; background: var(--accent); transition: width .4s; }
.err { color: #ff6b6b; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-weight: 700; text-decoration: none; font-size: 14px; }

/* ---------- modal ---------- */
dialog { padding: 0; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: 18px; box-shadow: var(--shadow); width: min(980px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto; overscroll-behavior: contain; }
dialog::backdrop { background: rgba(5, 7, 12, .72); backdrop-filter: blur(3px); }
.hero { position: relative; min-height: 220px; background: var(--panel-2) center/cover no-repeat; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13,15,20,.15), var(--bg-2) 96%); }
.close { position: absolute; z-index: 3; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 20px; }
.head { position: relative; z-index: 2; display: flex; gap: 20px; padding: 0 24px; margin-top: -120px; align-items: flex-end; }
.head .cover { width: 150px; height: 200px; border-radius: 12px; object-fit: cover; box-shadow: var(--shadow); flex: none; background: var(--panel-2); }
.head h2 { margin: 0 0 8px; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.head .by { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.section { padding: 0 24px; margin: 22px 0; }
.section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 0 0 10px; }
.stores { display: flex; flex-wrap: wrap; gap: 8px; }
.store { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; border: 1px solid transparent; }
.store small { font-weight: 500; opacity: .75; font-size: 11.5px; }
.store.playstation { background: var(--ps); } .store.xbox { background: var(--xbox); } .store.nintendo { background: var(--nintendo); }
.store.steam { background: var(--steam); border-color: #2a475e; } .store.epic { background: var(--epic); border-color: #555; } .store.gog { background: var(--gog); }
.store.is-search { filter: saturate(.55); }
.store:hover { filter: brightness(1.15); }
.dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.dates div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.dates b { display: block; }
.player { aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; position: relative; }
.player iframe { width: 100%; height: 100%; border: 0; }
.player .poster { all: unset; cursor: pointer; position: absolute; inset: 0; background: #000 center/cover no-repeat; display: grid; place-items: center; }
.player .poster span { width: 72px; height: 50px; border-radius: 14px; background: rgba(255,0,0,.9); display: grid; place-items: center; }
.player .poster span::before { content: ""; border-left: 20px solid #fff; border-top: 12px solid transparent; border-bottom: 12px solid transparent; margin-left: 4px; }
.vids { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: thin; }
.vid { flex: none; width: 160px; border: 2px solid transparent; border-radius: 10px; background: var(--panel); padding: 0; text-align: left; overflow: hidden; }
.vid[aria-current="true"] { border-color: var(--accent); }
.vid img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.vid span { display: block; padding: 5px 7px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.shots a img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--panel-2); }
.summary { white-space: pre-line; color: var(--text); max-width: 75ch; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; font-size: 14px; }
.kv dt { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kv dd { margin: 2px 0 0; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-body { padding: 24px; }
.sheet-body input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); margin: 6px 0 14px; font-family: ui-monospace, monospace; font-size: 13px; }
#sheet { width: min(560px, calc(100vw - 24px)); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .top-inner { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex: 1 1 100%; }
  .views { margin-left: auto; }
  .day { min-height: 92px; padding: 4px; }
  .ent { justify-content: center; padding: 1px; }
  .ent .info { display: none; }
  .ent img, .ent .noimg { width: 100%; height: auto; aspect-ratio: 3/4; max-width: 44px; }
  .group { top: 105px; }
}
@media (max-width: 600px) {
  body { font-size: 14px; }
  .brand span { display: none; }
  .views button { padding: 6px 8px; font-size: 13px; }
  .month-nav h1 { font-size: 19px; min-width: 150px; }
  .cal { gap: 3px; }
  .dow { font-size: 10px; padding: 0 2px; letter-spacing: 0; }
  .day { min-height: 70px; border-radius: 8px; }
  .day .ent:nth-of-type(n+2) { display: none; }
  .cards { grid-template-columns: 1fr; }
  .head { flex-direction: column; align-items: flex-start; margin-top: -90px; padding: 0 16px; }
  .head .cover { width: 110px; height: 147px; }
  .head h2 { font-size: 24px; }
  .section { padding: 0 16px; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
