:root {
  --bg: #0b0708;
  --panel: #171012;
  --panel-2: #21171a;
  --line: #3a282c;
  --text: #f3ece6;
  --muted: #a8988f;
  --gold: #d9ad5b;
  --red: #c4222b;
  --green: #2e9e5b;
  --blue: #2f7fd0;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 80% -10%, #3a0b10 0, var(--bg) 45%) fixed;
  color: var(--text);
  font: 16px/1.6 "Segoe UI", Tahoma, Arial, sans-serif;
}

body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }

.brand { margin: 0; color: var(--gold); font-size: 22px; letter-spacing: 2px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px 6px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 16px;
  overflow-x: auto;
  background: var(--bg);
  scrollbar-width: none;
}

.tabs button { flex: none; background: var(--panel); color: var(--muted); }
.tabs button.on { background: var(--red); color: #fff; }

main#view { max-width: 960px; margin: 0 auto; padding: 8px 16px 48px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.narrow { max-width: 380px; text-align: center; }
.card h2 { margin: 0 0 10px; font-size: 17px; color: var(--gold); }
.muted { color: var(--muted); font-size: 14px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.stat b { display: block; font-size: 26px; color: var(--gold); line-height: 1.3; }
.stat span { color: var(--muted); font-size: 13px; }

button {
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--panel-2);
  cursor: pointer;
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--green); }
button.blue { background: var(--blue); }
button.danger { background: var(--red); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.wide { width: 100%; }

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
}

textarea { min-height: 110px; resize: vertical; }
label { display: block; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
label input, label textarea, label select { margin-top: 4px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > input { flex: 1; min-width: 140px; width: auto; }
.grow { flex: 1; min-width: 0; }

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.item:first-of-type { border-top: 0; }
.item .name { font-weight: 600; overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
}

.badge.red { background: #4a1216; color: #ffb4b4; }
.badge.green { background: #123a24; color: #9ee6bd; }

code { direction: ltr; unicode-bidi: embed; overflow-wrap: anywhere; color: var(--gold); }

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 16px;
  z-index: 10;
  max-width: 420px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  text-align: center;
}

.toast.bad { background: var(--red); }
