@font-face { font-family: 'Lilita One'; src: url('/assets/fonts/LilitaOne-Regular.ttf') format('truetype'); font-display: swap; }

:root {
  --night: #141833;
  --panel: #1d2247;
  --panel-2: #262c5a;
  --line: #343c74;
  --ink: #eef1ff;
  --muted: #9aa3d0;
  --accent: #ffd23a;
  --accent-ink: #2a1c00;
  --blue: #3a7cf0;
  --red: #e53935;
  --green: #36c24a;
  --orange: #f4b400;
  --discord: #313338;
  --discord-2: #2b2d31;
  --display: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--night); color: var(--ink); font: 15px/1.5 var(--body); }
a { color: #8fb6ff; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0.3px; margin: 0 0 12px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- layout */
#app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
nav { background: var(--panel); border-right: 2px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4)); }
.brand b { font-family: var(--display); font-size: 18px; line-height: 1.05; font-weight: 400; }
.brand small { display: block; color: var(--accent); font-family: var(--display); font-size: 13px; }
nav button.tab { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; }
nav button.tab:hover { background: var(--panel-2); color: var(--ink); }
nav button.tab.on { background: var(--accent); color: var(--accent-ink); }
nav button.tab:focus-visible { outline: 3px solid var(--blue); }
nav .tab .badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 8px; }
nav .spacer { flex: 1; }
.botchip { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; background: var(--panel-2); font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.connecting { background: var(--orange); }
.dot.error { background: var(--red); }
main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; max-width: 1240px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }

/* ---------- cards */
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 18px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.stat b { display: block; font-family: var(--display); font-size: 32px; font-weight: 400; color: var(--accent); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

/* ---------- forms */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
label.field > small { display: block; color: var(--muted); margin-top: 4px; font-size: 12.5px; }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; background: var(--night); color: var(--ink); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }
input[type=color] { width: 54px; height: 42px; border: 2px solid var(--line); border-radius: 12px; background: var(--night); padding: 3px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }
.switch { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 3px solid var(--blue); }
.switch b { display: block; }
.switch small { color: var(--muted); }

.btn { font: inherit; font-family: var(--display); font-size: 16px; letter-spacing: 0.3px; cursor: pointer; border: none; border-radius: 12px; padding: 10px 18px; background: var(--panel-2); color: var(--ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.25); display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { font-size: 14px; padding: 6px 12px; }
a.btn { text-decoration: none; }

.seg { display: inline-flex; background: var(--night); border: 2px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { all: unset; cursor: pointer; padding: 7px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg button:focus-visible { outline: 3px solid var(--blue); }

/* ---------- status / notes */
.note { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; background: var(--panel-2); border-left: 5px solid var(--blue); }
.note.warn { border-color: var(--orange); }
.note.err { border-color: var(--red); }
.note.ok { border-color: var(--green); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 700; background: var(--panel-2); white-space: nowrap; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--ink); color: var(--night); font-weight: 700; padding: 12px 20px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); transition: transform 0.25s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); color: #fff; }

/* ---------- steps */
ol.steps { counter-reset: s; list-style: none; padding: 0; margin: 0 0 16px; }
ol.steps li { counter-increment: s; position: relative; padding: 4px 0 14px 46px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-family: var(--display); display: grid; place-items: center; font-size: 17px; }
ol.steps li.done::before { content: '✓'; background: var(--green); color: #fff; }

/* ---------- welcome */
.preview-img { width: 100%; border-radius: 14px; display: block; background: var(--night); aspect-ratio: 1200 / 525; object-fit: cover; border: 2px solid var(--line); }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.char { position: relative; background: var(--night); border: 2px solid var(--line); border-radius: 14px; padding: 8px 6px 6px; text-align: center; cursor: pointer; font-size: 12px; font-weight: 700; line-height: 1.2; }
.char img { width: 100%; height: 74px; object-fit: contain; display: block; margin-bottom: 4px; }
.char input { position: absolute; opacity: 0; pointer-events: none; }
.char.on { border-color: var(--accent); background: #2b2a3a; }
.char.on::after { content: '✓'; position: absolute; top: 4px; right: 6px; background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 20px; height: 20px; font-size: 13px; display: grid; place-items: center; }
.char:focus-within { outline: 3px solid var(--blue); }
.char .try { position: absolute; top: 4px; left: 6px; font-size: 13px; opacity: 0; transition: opacity 0.1s; background: var(--panel-2); border-radius: 8px; padding: 0 5px; border: none; color: var(--ink); cursor: pointer; }
.char:hover .try { opacity: 1; }
.arenas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.arena { border: 3px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; background: none; padding: 0; color: #fff; }
.arena img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; display: block; }
.arena span { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,0.75)); font-size: 12px; font-weight: 700; padding: 10px 6px 4px; text-align: left; }
.arena.on { border-color: var(--accent); }
.arena:focus-visible { outline: 3px solid var(--blue); }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tokens button { all: unset; cursor: pointer; font-size: 12px; font-family: ui-monospace, monospace; background: var(--panel-2); border-radius: 8px; padding: 2px 8px; }
.tokens button:hover { background: var(--line); }

/* ---------- discord preview */
.discord { background: var(--discord); border-radius: 12px; padding: 16px; color: #dbdee1; font-size: 15px; }
.dmsg { display: flex; gap: 14px; }
.dmsg .av { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--blue); object-fit: cover; }
.dmsg .who { font-weight: 600; color: #fff; }
.dmsg .who .tag { background: #5865f2; color: #fff; font-size: 10px; border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: 2px; font-weight: 700; }
.dmsg .who time { color: #949ba4; font-size: 12px; font-weight: 400; margin-left: 6px; }
.mention { background: rgba(88,101,242,0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.embed { margin-top: 6px; background: var(--discord-2); border-left: 4px solid var(--accent); border-radius: 4px; padding: 10px 14px 14px; max-width: 520px; display: grid; grid-template-columns: 1fr auto; gap: 0 14px; }
.embed .e-author { font-size: 13px; font-weight: 600; color: #fff; margin-top: 4px; }
.embed .e-title { font-weight: 700; color: #fff; margin-top: 6px; font-size: 16px; }
.embed .e-desc { font-size: 14px; margin-top: 6px; white-space: normal; overflow-wrap: anywhere; }
.embed .e-desc h1, .embed .e-desc h2, .embed .e-desc h3 { font-family: var(--body); font-weight: 700; margin: 8px 0 4px; color: #fff; }
.embed .e-desc h1 { font-size: 20px; } .embed .e-desc h2 { font-size: 17px; } .embed .e-desc h3 { font-size: 15px; }
.embed .e-desc ul { margin: 4px 0; padding-left: 20px; }
.embed .e-desc code { background: #1e1f22; }
.embed .e-thumb { grid-column: 2; grid-row: 1 / span 4; width: 80px; height: 80px; object-fit: contain; margin-top: 8px; }
.embed .e-field { margin-top: 8px; font-size: 14px; }
.embed .e-field b { display: block; color: #fff; font-size: 13px; }
.embed .e-img { grid-column: 1 / -1; margin-top: 12px; max-width: 100%; border-radius: 4px; }
.embed .e-foot { grid-column: 1 / -1; font-size: 12px; color: #949ba4; margin-top: 8px; }
.embed > * { grid-column: 1; }

/* ---------- lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
.item-head h3 { margin: 0; flex: 1; min-width: 160px; font-size: 16px; overflow-wrap: anywhere; }
.item-body { margin-top: 12px; border-top: 2px solid var(--line); padding-top: 12px; }
.item-body .text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--night); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 150px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty img { width: 110px; display: block; margin: 0 auto 10px; opacity: 0.9; }
.log { list-style: none; padding: 0; margin: 0; font-size: 13.5px; max-height: 360px; overflow: auto; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.log li time { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.log li.error { color: #ff9a8f; }

/* ---------- login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 20%, #283070, var(--night) 70%); }
.login .card { width: min(420px, 100%); text-align: center; }
.login img.hero { width: 140px; margin: -80px auto 6px; display: block; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.45)); }
.login form { text-align: left; margin-top: 16px; }
.login button { width: 100%; justify-content: center; }
.err-text { color: #ff9a8f; min-height: 22px; font-weight: 700; margin-bottom: 8px; }

/* ---------- mobile */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  nav { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: none; border-bottom: 2px solid var(--line); gap: 4px; }
  nav .brand, nav .spacer, nav .botchip { display: none; }
  nav button.tab { white-space: nowrap; padding: 8px 12px; }
  main { padding-top: 18px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .arenas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
