@font-face { font-family: Fredoka; src: url('/play/fonts/Fredoka.woff') format('woff'); font-weight: 400 700; font-display: swap; }
:root {
  --bg: #f5f3ee; --panel: #ffffff; --ink: #17213b; --soft: #55607d; --line: #e3ded2; --chip: #f1ece0;
  --accent: #c2341f; --accent-ink: #fff; --blue: #2f6fd1; --ok: #1f7a4d; --warn: #9a5b00; --err: #b3261e;
  --radius: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11172a; --panel: #19213a; --ink: #e9edf8; --soft: #a3aecb; --line: #2b3657; --chip: #222c4a; --accent: #ff7a63; --accent-ink: #1a0d0a; --blue: #7aa7ff; --ok: #57c48c; --warn: #f0b555; --err: #ff8a80; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { font-family: Fredoka, system-ui, sans-serif; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 17px; margin-bottom: 10px; } h3 { font-size: 16px; margin: 14px 0 8px; }
a { color: var(--blue); }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
.boot { padding: 40px; color: var(--soft); }
.muted { color: var(--soft); } .small { font-size: 13px; } .strong { font-weight: 650; text-decoration: none; color: var(--ink); }
p { margin: 6px 0; }

/* layout */
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side a { display: block; padding: 9px 12px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 550; }
.side a:hover { background: var(--chip); }
.side a.on { background: var(--accent); color: var(--accent-ink); }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand b { display: block; font-family: Fredoka, sans-serif; font-size: 18px; line-height: 1; }
.brand small { color: var(--soft); }
.logo { width: 36px; height: 36px; border-radius: 10px; background: #e5432e; color: #fff; display: grid; place-items: center; font: 700 15px Fredoka, sans-serif; }
.navfoot { margin-top: auto; display: grid; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.navfoot a { padding: 4px 0; }
.menu { display: none; }
.main { padding: 24px 28px 60px; min-width: 0; }
.page { max-width: 1400px; display: grid; gap: 16px; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; inset: 0 auto 0 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.navopen .side { transform: none; }
  .menu { display: block; position: fixed; z-index: 21; top: 10px; left: 10px; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 20px; }
  .main { padding: 64px 14px 40px; }
}

/* panels, grids */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2 > div { display: grid; gap: 16px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 120px; }
.row.wrap { align-items: center; margin-top: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; }
.stat span { color: var(--soft); font-size: 13px; } .stat b { font: 600 28px Fredoka, sans-serif; } .stat small { color: var(--soft); }
.bars { display: flex; gap: 6px; align-items: flex-end; height: 160px; }
.barcol { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.barcol i { display: block; width: 100%; min-height: 2px; background: #e5432e; border-radius: 4px 4px 0 0; }
.barcol span { font-size: 11px; color: var(--soft); }
.rank { margin: 0; padding-left: 20px; } .rank li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--line); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-bottom: 8px; }
.kv span { color: var(--soft); } .kv b { text-align: right; font-variant-numeric: tabular-nums; }

/* forms */
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-weight: 600; font-size: 13.5px; }
.field small { color: var(--soft); font-size: 12.5px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-height: 38px; width: 100%; }
input[type=color] { padding: 2px; width: 46px; height: 38px; }
input[type=checkbox] { width: auto; min-height: 0; }
input[type=range] { padding: 0; }
input[type=file] { width: auto; }
.filters input, .filters select { width: auto; }
textarea.json { font: 12.5px ui-monospace, Menlo, monospace; width: 100%; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 550; margin: 6px 14px 6px 0; cursor: pointer; }
.inline { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid #ffc83d; outline-offset: 2px; }
.colorlist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cl { position: relative; }
.cl .x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--ink); color: var(--panel); font-size: 12px; line-height: 18px; padding: 0; cursor: pointer; }

/* buttons */
.btn { appearance: none; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: 600 14.5px system-ui, sans-serif; padding: 9px 16px; border-radius: 10px; cursor: pointer; min-height: 40px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--chip); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13.5px; }
.btn.danger { background: var(--err); color: #fff; }
.btn.ghost.danger { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.icon { appearance: none; border: 0; background: var(--chip); color: var(--ink); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.link { appearance: none; border: 0; background: none; color: var(--blue); cursor: pointer; padding: 0; font: inherit; text-align: left; }
.x { appearance: none; border: 0; background: none; color: var(--soft); cursor: pointer; font-size: 18px; }
.seg { display: flex; gap: 4px; background: var(--chip); padding: 4px; border-radius: 11px; flex-wrap: wrap; }
.seg button { flex: 1; appearance: none; border: 0; background: transparent; color: var(--ink); font: 600 13.5px system-ui, sans-serif; padding: 8px 6px; border-radius: 8px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* tables */
.tblwrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); font-weight: 650; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.compact td, .tbl.compact th { padding: 5px 6px; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl td.actions .btn { margin-left: 4px; }
.tbl.tracks canvas { width: 72px; height: 48px; border-radius: 8px; display: block; }
.tbl select { width: auto; }
tr.banned td { opacity: .55; } tr.warnrow td { color: var(--warn); }
.filters { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.filters label { font-weight: 600; }
select.st-published { border-color: var(--ok); color: var(--ok); font-weight: 600; }
select.st-draft { border-color: #8f5de2; color: #8f5de2; font-weight: 600; }
select.st-disabled { color: var(--soft); }
.pill { display: inline-block; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; margin-left: 6px; background: var(--chip); }
.pill.st-published { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.st-draft { background: color-mix(in srgb, #8f5de2 18%, transparent); color: #8f5de2; }

/* themes */
.tcards { display: grid; gap: 10px; }
.tcard { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.swatch { width: 54px; height: 54px; border-radius: 12px; }
.tside { display: grid; gap: 8px; justify-items: end; }
.tside select { width: auto; }
canvas.preview { width: 100%; height: auto; border-radius: 10px; background: #ccc; display: block; }

/* validation */
.validation { display: grid; gap: 4px; }
.err { color: var(--err); font-weight: 600; } .warn { color: var(--warn); } .ok { color: var(--ok); font-weight: 600; }
p.err:empty { display: none; }
.report { display: grid; gap: 12px; margin-top: 10px; }

/* editor */
.editorpage { max-width: none; }
.edgrid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.canvaswrap { position: sticky; top: 12px; height: calc(100vh - 120px); min-height: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #9fc27a; }
canvas.editor { display: block; touch-action: none; cursor: crosshair; outline: none; }
.edside { display: grid; gap: 12px; }
.edside .panel { padding: 14px; }
.lmlist { list-style: none; margin: 8px 0; padding: 0; max-height: 160px; overflow: auto; }
.lmlist li { display: flex; justify-content: space-between; padding: 3px 4px; border-radius: 6px; }
.lmlist li.on { background: var(--chip); }
@media (max-width: 1000px) { .edgrid { grid-template-columns: 1fr; } .canvaswrap { position: relative; height: 62vh; } }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: grid; gap: 4px; }
.login h1 { margin: 8px 0 10px; }
.login .btn { margin-top: 8px; }

/* dialogs, toast, qr */
dialog.modal { border: 1px solid var(--line); border-radius: 16px; padding: 20px; background: var(--panel); color: var(--ink); width: min(440px, calc(100vw - 32px)); }
dialog.modal.wide { width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 16, 30, .45); }
.mhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.totp { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr svg { display: block; border-radius: 8px; }
.key { display: inline-block; font-size: 15px; padding: 6px 10px; margin-top: 6px; user-select: all; }
#toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(460px, calc(100vw - 40px)); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--panel); font-weight: 600; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
#toast.err { background: var(--err); color: #fff; }
@media (prefers-reduced-motion: reduce) { #toast, .side { transition: none; } }
