:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #20233a;
  background: #f4f5fa;
  --ink: #20233a;
  --muted: #5c6179;
  --line: #e2e4ef;
  --accent: #5341b4;
  --tint: #ede9ff;
  --white: #fff;
  --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.65rem); line-height: 1.13; letter-spacing: -.045em; }
h2 { font-size: 1.22rem; letter-spacing: -.023em; }
h3 { font-size: 1.04rem; }
a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #7966db; outline-offset: 3px; }
button, .button, input, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px;
  padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 9px; color: var(--ink);
  background: var(--white); font-weight: 650; cursor: pointer; text-decoration: none;
}
button:hover, .button:hover { border-color: #a99ae8; background: #f8f6ff; }
button:disabled { cursor: default; opacity: .55; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover { color: #fff; background: #453399; }
input:not([type=checkbox]), select {
  min-height: 42px; padding: .5rem .7rem; border: 1px solid #d8dbea; border-radius: 9px;
  background: #fff; color: var(--ink);
}
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
label { display: grid; gap: .25rem; font-size: .85rem; font-weight: 650; color: #41465d; }
.muted, .note { color: var(--muted); }
.note { font-size: .84rem; }
.error { color: #aa263e; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.brand img { flex: none; object-fit: contain; }
.brand div { display: grid; }
.brand strong { font-size: 1.05rem; letter-spacing: -.03em; }
.brand span { font-size: .81rem; color: var(--muted); }
.login-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: radial-gradient(ellipse at top, #e8e2fb, #f4f5fa 70%); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: clamp(24px, 5vw, 44px); width: min(100%, 440px); box-shadow: 0 18px 70px #392c6618; }
.login-card h1 { margin: 24px 0 8px; }
.login-card form { display: grid; gap: 14px; margin-top: 24px; }
.login-card input { width: 100%; }
.login-card .primary { margin-top: 8px; }
.panel-page { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { min-height: 100dvh; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 24px 16px 18px; background: #fff; border-right: 1px solid var(--line); }
.sidebar .brand { padding-left: 1px; }
.sidebar nav { display: grid; gap: 5px; margin-top: 30px; }
.sidebar nav a { padding: 10px 12px; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 600; }
.sidebar nav a:hover { background: #f5f3fd; color: var(--accent); }
.sidebar nav a[aria-current=page] { background: var(--tint); color: var(--accent); }
.sidebar form { margin-top: auto; }
.logout { width: 100%; }
.workspace { width: 100%; max-width: 1600px; margin: 0 auto; padding: clamp(20px, 3vw, 44px); }
.page-header, .section-head, dialog header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.page-header .muted { margin-top: 6px; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.checkbox { display: flex; align-items: center; min-height: 42px; font-size: .86rem; gap: 6px; }
.section-head { margin-bottom: 14px; }
.section-head .note { text-align: right; }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.game-card, .panel, .stat { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.game-card { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.game-cover { display: block; width: 100%; aspect-ratio: 2.45; object-fit: cover; background-color: #dfdcf2; }
.game-card-body { display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; padding: 16px; }
.game-card-body h3 { font-size: clamp(1rem, 1.6vw, 1.25rem); letter-spacing: -.025em; }
.game-card-body .button { justify-self: start; }
.card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.card-stats div { display: grid; min-width: 0; border-radius: 10px; background: #f5f5fb; padding: 8px 10px; }
.card-stats dt { font-size: .78rem; color: var(--muted); }
.card-stats dd { order: -1; margin: 0; font-size: 1.42rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.play-line { border-top: 1px solid var(--line); padding-top: 12px; }
.play-line strong, .play-line span { display: block; }
.stack { display: grid; gap: 18px; }
.panel { min-width: 0; padding: 18px; }
.panel .note + .scroll { margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { display: grid; padding: 12px 14px; gap: 2px; }
.stat strong { font-size: clamp(1.25rem, 2vw, 1.75rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .82rem; }
.two-panels { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.inline-controls { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.inline-controls input { width: min(150px, 100%); }
.links { display: flex; flex-wrap: wrap; gap: 9px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th { font-size: .78rem; font-weight: 650; color: var(--muted); white-space: nowrap; }
td, th { padding: 8px 10px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
td { font-size: .9rem; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }
td button { min-height: 32px; padding: 2px 7px; font-size: .86rem; }
.nowrap { white-space: nowrap; }
.empty { padding: 14px 0; color: var(--muted); }
.pages { display: flex; gap: 10px; align-items: center; margin-top: 12px; justify-content: flex-end; }
.activity { display: grid; gap: 7px; padding: 0; margin: 0; list-style: none; }
.activity li { display: grid; grid-template-columns: 46px minmax(0, 1fr) 26px; gap: 8px; align-items: center; font-size: .82rem; }
.activity li span:last-child { text-align: right; }
progress { display: block; width: 100%; height: 10px; accent-color: var(--accent); border-radius: 5px; overflow: hidden; }
progress::-webkit-progress-bar { background: #eeedf8; }
progress::-webkit-progress-value { background: #6d5ac6; border-radius: 5px; }
progress::-moz-progress-bar { background: #6d5ac6; border-radius: 5px; }
dialog { max-height: 88dvh; width: min(910px, calc(100% - 28px)); padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
dialog::backdrop { background: #1b192a90; }
dialog header { margin-bottom: 12px; }
@media (max-width: 1000px) { .game-grid { gap: 10px; } .game-card-body { padding: 12px; } }
@media (max-width: 850px) { .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .two-panels { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .panel-page { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-height: 0; position: static; height: auto; display: grid; grid-template-columns: 1fr auto; padding: 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: 2px; margin: 0; }
  .sidebar nav a { padding: 7px 9px; font-size: .86rem; }
  .sidebar form { margin: 0; align-self: center; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) { .game-grid { grid-template-columns: 1fr; } .page-header .muted { font-size: .86rem; } }
