:root {
  color-scheme: dark;
  --background: #171525;
  --surface: #231f35;
  --line: #413855;
  --ink: #fff5e7;
  --muted: #c3b6d4;
  --action: #ffc37a;
  --violet: #bfa2ff;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button, select, input, textarea {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .54rem .8rem;
  min-height: 44px;
  color: inherit;
  background: var(--surface);
}
button:hover { border-color: var(--violet); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}
button:disabled { opacity: .6; cursor: wait; }
button.action { background: var(--action); border-color: var(--action); color: #261b2b; font-weight: 750; }
button.quiet { background: transparent; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.15rem, 7vw, 4.4rem); line-height: 1; letter-spacing: -.065em; }
h2 { font-size: 1.15rem; }
.page { max-width: 68rem; margin: auto; padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left)); }
.masthead, .section-heading, .admin-heading { display: flex; justify-content: space-between; align-items: center; gap: .85rem; flex-wrap: wrap; }
.masthead { padding-bottom: .85rem; border-bottom: 1px solid var(--line); }
.identity { display: flex; align-items: center; gap: .6rem; font-weight: 750; }
.mark { width: 1.25rem; height: .8rem; border: 2px solid var(--action); border-radius: 50%; transform: rotate(-35deg); position: relative; }
.mark::after { content: ''; position: absolute; width: .35rem; aspect-ratio: 1; border-radius: 50%; background: var(--violet); top: -.15rem; right: -.1rem; }
.library-heading, .admin-heading { margin: clamp(1.7rem, 6vw, 4rem) 0 1.7rem; }
.library-heading p { margin-top: .65rem; color: var(--muted); }
.note { color: var(--muted); margin: .8rem 0; overflow-wrap: anywhere; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.game { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.cover { aspect-ratio: 16/9; overflow: hidden; display: grid; place-items: center; position: relative; background: #342651; }
.cover > img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.cover-initial { font-size: 4rem; line-height: 1; font-weight: 800; color: var(--violet); }
.cover-orbit { background: radial-gradient(ellipse at 42% 44%, #503969, #1d1932 72%); }
.orbit-icon { width: 54%; height: 50%; position: relative; transform: rotate(-23deg); border: 1px solid #caadff; border-radius: 50%; box-shadow: 0 0 25px #ce8cee45; }
.orbit-icon::before { content: ''; position: absolute; inset: 50% auto auto 50%; width: 30%; aspect-ratio: 1; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe3a3, #e88955 71%); box-shadow: 0 0 25px #f2aa6270; }
.orbit-icon::after { content: ''; position: absolute; top: 5%; right: 17%; width: 8%; aspect-ratio: 1; background: #dac4ff; border-radius: 50%; box-shadow: 0 0 15px #dac4ff; }
.game-copy { display: flex; flex: 1; flex-direction: column; gap: .55rem; padding: 1rem; }
.game-copy h2 { font-size: 1.5rem; letter-spacing: -.035em; }
.game-copy p { color: var(--muted); }
.game-copy .genre { font-size: .82rem; color: var(--violet); }
.game-copy .action { align-self: flex-start; margin-top: auto; }
.tabs { display: flex; gap: .55rem; margin-bottom: 1rem; }
.tabs [aria-pressed="true"] { background: var(--violet); color: #1e1733; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .65rem; margin: .8rem 0 1.4rem; }
.totals div { padding: .65rem; border-top: 1px solid var(--line); }
.totals dt { color: var(--muted); font-size: .88rem; }
.totals dd { margin: 0; font-size: 1.5rem; font-weight: 700; }
.daily { display: grid; gap: .4rem; margin: .75rem 0 1.4rem; max-height: 18rem; overflow-y: auto; }
.day { display: grid; grid-template-columns: 3.3rem minmax(3rem, 1fr) minmax(6rem, auto); gap: .65rem; align-items: center; font-size: .86rem; }
progress { width: 100%; accent-color: var(--violet); }
.table-scroll { overflow-x: auto; margin: .6rem 0; }
table { border-collapse: collapse; min-width: 22rem; width: 100%; font-size: .92rem; }
td, th { text-align: right; padding: .6rem .4rem; border-bottom: 1px solid var(--line); }
td:first-child, th:first-child { text-align: left; }
.game-list { list-style: none; padding: 0; }
.game-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.game-tools { display: flex; gap: .5rem; flex-wrap: wrap; }
form { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .65rem; margin-top: .6rem; }
.form-grid label { display: flex; flex-direction: column; gap: .25rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .check { flex-direction: row; align-items: center; gap: .6rem; }
.check input { accent-color: var(--action); }
#player { height: var(--tg-viewport-height, 100dvh); display: flex; flex-direction: column; }
.player-bar { display: flex; align-items: center; gap: .75rem; padding: .4rem .65rem; border-bottom: 1px solid var(--line); }
.player-bar strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#player-note { margin-left: auto; font-size: .8rem; color: var(--muted); }
#player-status { margin: .4rem .7rem; }
#frame-slot { flex: 1; min-height: 0; }
#frame-slot iframe { display: block; width: 100%; height: 100%; border: 0; }
