/* LLM Key Hub — arcade-dark design system */
:root {
  --bg: #0b0e17;
  --bg-2: #111627;
  --panel: rgba(255,255,255,0.04);
  --panel-2: rgba(255,255,255,0.07);
  --line: rgba(255,255,255,0.10);
  --text: #e8ecf7;
  --muted: #8b93ad;
  --acc: #7cf5c8;      /* mint */
  --acc-2: #ffb454;    /* amber */
  --acc-3: #8f8cff;    /* violet */
  --danger: #ff6b8a;
  --ok: #7cf5c8;
  --radius: 14px;
  --font: "IBM Plex Sans", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --c1: #7cf5c8; --c2: #ffb454; --c3: #8f8cff; --c4: #ff6b8a; --c5: #5ac8fa; --c6: #c3f56b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #1a2140 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #1f1633 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; }
pre {
  background: #070a12; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  overflow-x: auto; color: #d7ddf0; position: relative;
}
pre .copy { position: absolute; top: 8px; right: 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 14px 0;
  border-bottom: 1px solid var(--line); margin-bottom: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .3px; color: var(--text); }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--acc), var(--acc-3)); display: grid; place-items: center; color: #08111a; font-weight: 900; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: var(--muted); padding: 7px 12px; border-radius: 9px; font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--panel-2); text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: .15s;
}
.btn:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.btn.primary { background: var(--acc); color: #06151a; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0a0d18; color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(124,245,200,.35); border-color: var(--acc); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.acc { color: var(--acc); border-color: rgba(124,245,200,.3); }
.pill.amber { color: var(--acc-2); border-color: rgba(255,180,84,.3); }
.pill.violet { color: var(--acc-3); border-color: rgba(143,140,255,.35); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.bar { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc-3)); border-radius: 99px; transition: width .4s; }
.bar.warn > i { background: linear-gradient(90deg, var(--acc-2), var(--danger)); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #182038; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 99; }
.toast.show { opacity: 1; }
.toast.err { border-color: var(--danger); color: var(--danger); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--acc); }
.hero { padding: 26px 0 8px; }
.hero h1 { font-size: clamp(28px, 4vw, 44px); margin: 0 0 8px; line-height: 1.15; }
.hero h1 span { background: linear-gradient(90deg, var(--acc), var(--acc-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 640px; margin: 0; }
canvas.chart { width: 100%; height: 220px; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rank { width: 28px; height: 28px; border-radius: 8px; display: inline-grid; place-items: center; font-weight: 800; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.rank.r1 { background: linear-gradient(135deg, #ffd66b, #ff9f43); color: #2a1600; }
.rank.r2 { background: linear-gradient(135deg, #e8ecf7, #9aa3bd); color: #111; }
.rank.r3 { background: linear-gradient(135deg, #f0b48f, #b56d45); color: #2a1200; }
.footer { color: var(--muted); font-size: 12px; padding: 40px 0 30px; border-top: 1px solid var(--line); margin-top: 40px; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--panel-2); }
.empty { color: var(--muted); text-align: center; padding: 22px; }
.chat { display: flex; flex-direction: column; height: 520px; }
.chat .log { flex: 1; overflow-y: auto; padding: 4px 2px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: rgba(124,245,200,.14); border: 1px solid rgba(124,245,200,.25); }
.msg.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.msg .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.chat form { display: flex; gap: 8px; margin-top: 10px; }
.chat textarea { resize: none; height: 54px; }
.hl { color: var(--acc); }
h1.page { font-size: 26px; margin: 0 0 6px; }
.subtitle { color: var(--muted); margin: 0 0 22px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding-left: 40px; margin-bottom: 18px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 8px; background: var(--acc); color: #06151a; font-weight: 800; display: grid; place-items: center; }
.hidden { display: none !important; }
