:root {
  --bg: #1a1b17;
  --panel: #24251f;
  --panel2: #2c2d26;
  --input: #141511;
  --line: rgba(255, 236, 214, 0.08);
  --line2: rgba(255, 236, 214, 0.15);
  --text: #e6e0d2;
  --muted: #a29e8f;
  --dim: #74705f;
  --accent: #8fb339;
  --accent-2: #b9d86a;
  --green: #8bc34a;
  --red: #ef4444;
  --display: 'Rubik Dirt', sans-serif;
  --sans: 'Roboto Condensed', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 3px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-weight: 600; font-size: 14px; transition: background .2s, border-color .2s, opacity .2s, transform .1s; white-space: nowrap; }
.btn:hover { background: #26221e; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1b17; }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); }
kbd { font: 500 11px var(--mono); opacity: .7; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(60% 50% at 50% 0%, rgba(143,179,57,.22), transparent 70%), linear-gradient(rgba(12,11,10,.7), var(--bg)), url('https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/252490/library_hero.jpg') center/cover; }
.login-card { width: min(380px, 100%); padding: 32px; border-radius: 4px; background: rgba(22,20,18,.86); border: 1px solid var(--line2); backdrop-filter: blur(16px); display: grid; gap: 12px; text-align: center; }
.login-mark { width: 56px; height: 56px; margin: 0 auto 6px; border-radius: 3px; background: var(--accent); display: grid; place-items: center; font: 700 30px var(--display); color: #fff; box-shadow: 0 10px 40px rgba(143,179,57,.35); }
.login-card h1 { margin: 0; font: 400 34px/1.05 var(--display); }
.login-card p { margin: 0 0 8px; color: var(--muted); }
.login-err { color: #fca5a5; min-height: 20px; font-size: 13px; }
.login-card.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 50% { transform: translateX(8px); } 75% { transform: translateX(-4px); } }

/* shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; border-right: 1px solid var(--line); background: #161713; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font: 400 24px var(--display); }
.side-brand small { font: 500 11px var(--mono); color: var(--muted); letter-spacing: .1em; }
.side-brand .mark { width: 10px; height: 10px; background: var(--accent); transform: rotate(45deg); box-shadow: 0 0 12px var(--accent); }
#tabs { display: grid; gap: 2px; overflow-y: auto; }
#tabs button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 2px; border: 0; background: transparent; text-align: left; color: var(--muted); cursor: pointer; font-weight: 500; }
#tabs button:hover { background: rgba(255,255,255,.04); color: var(--text); }
#tabs button.on { background: rgba(143,179,57,.16); color: var(--text); }
#tabs button .em { width: 20px; text-align: center; }
#tabs button .cnt { margin-left: auto; font: 500 11px var(--mono); color: var(--dim); }
.side-foot { margin-top: auto; display: grid; gap: 8px; }

.main { min-width: 0; }
.bar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 32px; background: rgba(12,11,10,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar h1 { margin: 0; font: 400 34px/1 var(--display); }
.bar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.bar-actions { display: flex; align-items: center; gap: 14px; }
.dirty { font-size: 12px; color: var(--accent-2); opacity: 0; transition: opacity .2s; }
.dirty.on { opacity: 1; }
.content { padding: 28px 32px 80px; max-width: 980px; display: grid; gap: 16px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 20px; }
.panel > h2 { margin: 0 0 4px; font: 700 19px/1.2 var(--sans); }
.panel > .hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field > .help { font-size: 12px; color: var(--dim); }
input[type=text], input[type=url], input[type=password], input[type=number], input[type=email], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 2px; border: 1px solid var(--line2); background: var(--input); outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(143,179,57,.22); }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a39a90' stroke-width='2'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
input[type=color] { width: 52px; height: 40px; padding: 3px; border-radius: 2px; border: 1px solid var(--line2); background: var(--input); cursor: pointer; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { font: 600 14px var(--mono); color: var(--accent-2); min-width: 40px; text-align: right; }
.row { display: flex; gap: 8px; align-items: center; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 3px; background: var(--panel2); cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 99px; background: #3a342e; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.switches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

/* lists */
.list { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); background: var(--panel2); border-radius: 3px; padding: 14px; display: grid; gap: 12px; }
.item-head { display: flex; align-items: center; gap: 8px; }
.item-head .num { font: 600 12px var(--mono); color: var(--dim); }
.item-head .ttl { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-head .btns { display: flex; gap: 4px; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }
.icon-btn.del:hover { color: #fca5a5; border-color: rgba(239,68,68,.4); }
.empty { padding: 26px; text-align: center; color: var(--dim); border: 1px dashed var(--line2); border-radius: 3px; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-chips button { padding: 6px 10px; border-radius: 99px; border: 1px dashed var(--line2); background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.preset-chips button:hover { color: var(--text); border-color: var(--accent); }

.thumb { width: 100%; aspect-ratio: 16/9; border-radius: 3px; background: var(--input) center/cover; border: 1px solid var(--line); }
.img-field { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; }
.img-field .thumb { aspect-ratio: 16/10; display: grid; place-items: center; color: var(--dim); font-size: 12px; }
.video-item { display: grid; grid-template-columns: 200px 1fr; gap: 14px; }

/* steam preview */
.steam-card { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.steam-card img { width: 64px; height: 64px; border-radius: 3px; }
.steam-card .sc-main { flex: 1; min-width: 200px; }
.steam-card b { font-size: 18px; }
.steam-card .sc-sub { color: var(--muted); font-size: 13px; }
.stat-mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 14px; }
.stat-mini div { padding: 10px 12px; border-radius: 2px; background: var(--panel2); }
.stat-mini b { display: block; font: 600 18px var(--display); }
.stat-mini span { font-size: 11px; color: var(--muted); }
.ok { color: var(--green); }
.warn { color: #fca5a5; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; padding: 12px 18px; border-radius: 3px; background: var(--text); color: var(--bg); font-weight: 600; transition: all .3s; z-index: 100; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #ef4444; color: #fff; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  #tabs { display: flex; overflow-x: auto; }
  #tabs button { white-space: nowrap; }
  #tabs button .cnt { display: none; }
  .side-foot { flex-direction: row; display: flex; }
  .bar, .content { padding-left: 16px; padding-right: 16px; }
  .fields, .switches { grid-template-columns: 1fr; }
  .img-field, .video-item { grid-template-columns: 1fr; }
}
