:root {
  color-scheme: dark;
  --bg: #101311;
  --surface: #181c19;
  --surface-raised: #1d231e;
  --surface-soft: #141815;
  --border: #30382f;
  --text: #f1f1e8;
  --muted: #9ba398;
  --gold: #e5c77b;
  --gold-soft: #a88a48;
  --green: #9ed287;
  --red: #e58177;
  --blue: #91b8df;
  --radius: 15px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -24rem, #57613a66, transparent 52rem),
    linear-gradient(180deg, #121611 0, var(--bg) 34rem);
}
a { color: inherit; }
button, input, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 max(28px, calc((100vw - 1320px) / 2));
  background: #101411eF;
  border-bottom: 1px solid #30382f;
  backdrop-filter: blur(18px);
}
.brand {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: .16em;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #8f7948;
  border-radius: 11px;
  color: var(--gold);
  background: linear-gradient(145deg, #33301f, #1c211a);
  font-size: 17px;
  box-shadow: inset 0 0 18px #e5c77b12;
}
.brand-name { display: grid; gap: 3px; }
.brand-name small { color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .21em; }
.topbar nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #30382f;
  border-radius: 999px;
  background: #171b17;
}
.topbar nav a {
  padding: 9px 15px;
  border-radius: 999px;
  color: #bdc2b7;
  text-decoration: none;
  font-size: 12px;
  font-weight: 650;
  transition: color .15s, background .15s;
}
.topbar nav a:hover { color: var(--gold); background: #252a22; }
#account { justify-self: end; display: flex; align-items: center; gap: 12px; }

main { width: min(1320px, calc(100% - 48px)); margin: 0 auto; padding: 50px 0 84px; }
.hero {
  position: relative;
  display: flex;
  min-height: 250px;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  overflow: hidden;
  padding: 36px 42px;
  border: 1px solid #544a31;
  border-radius: 21px;
  background:
    radial-gradient(ellipse at 87% 45%, #86955335, transparent 27rem),
    linear-gradient(115deg, #24271e 0%, #1a201a 58%, #20241b 100%);
  box-shadow: 0 20px 65px #00000020, inset 0 1px #ffffff08;
}
.hero::after {
  content: "✦";
  position: absolute;
  right: 10%;
  top: 50%;
  transform: translateY(-50%);
  color: #e5c77b18;
  font-size: 210px;
  line-height: 1;
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; max-width: 730px; }
.eyebrow { margin: 0 0 11px; color: var(--gold); font-size: 10px; font-weight: 750; letter-spacing: .2em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(38px, 5.4vw, 64px); line-height: 1.04; font-weight: 800; letter-spacing: -.055em; }
.hero h1 em { color: var(--gold); font-style: normal; }
.hero .muted { max-width: 610px; margin: 17px 0 0; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.7; }
.live-pill {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border: 1px solid #4e5946;
  border-radius: 999px;
  background: #151a16cc;
  color: #d1d6cc;
  font-size: 11px;
  font-weight: 650;
  box-shadow: 0 8px 24px #0002;
}
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px #9ed287aa; }
.live-pill.offline { border-color: #704843; color: #f0b3a8; }
.live-pill.offline i { background: var(--red); box-shadow: 0 0 12px #e58177aa; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.stat-card, .panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #1b201b, #171b18);
  box-shadow: 0 10px 30px #00000013, inset 0 1px #ffffff05;
}
.stat-card { position: relative; min-height: 140px; padding: 21px 22px; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; left: 22px; right: 22px; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--gold-soft), transparent 80%); opacity: .7; }
.stat-card span { display: block; color: #aeb5a8; font-size: 9px; font-weight: 750; letter-spacing: .15em; }
.stat-card strong { display: block; margin: 14px 0 2px; color: var(--text); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.stat-card small { color: var(--muted); font-size: 11px; }

.section-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, .8fr); gap: 14px; align-items: start; }
.panel { min-width: 0; padding: 23px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head .eyebrow { margin-bottom: 6px; }
.panel h2 { margin: 0; font-size: 21px; letter-spacing: -.035em; }
.panel h3 { margin: 0 0 15px; font-size: 15px; letter-spacing: -.02em; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th { padding: 12px 10px; color: #a9b0a5; border-bottom: 1px solid #343b32; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
td { padding: 14px 10px; border-bottom: 1px solid #2a3029; color: #d9ded4; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #ffffff05; }
.player-name { color: var(--text); font-weight: 720; }
.online { color: var(--green); }
.offline { color: #838b81; }
.heart { color: #e98579; letter-spacing: 2px; }
.kingdom-list { display: grid; gap: 9px; }
.kingdom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid #333a31; border-radius: 11px; background: #151a16; font-size: 12px; }
.kingdom b { font-size: 12px; }
.kingdom span { color: var(--muted); font-size: 10px; }
.empty { padding: 16px 10px; color: var(--muted); font-size: 12px; }

.team-panel { margin-top: 14px; }
.badge { display: inline-flex; align-items: center; padding: 8px 11px; border: 1px solid #3a4238; border-radius: 999px; background: #141914; color: #c0c7bc; font-size: 10px; font-weight: 650; white-space: nowrap; }
.link-box { padding: 19px; border: 1px dashed #756744; border-radius: 12px; background: #1c2019; }
.link-box p { margin: 0 0 15px; color: #b4baae; font-size: 13px; line-height: 1.6; }
.link-box code { color: var(--gold); font-weight: 750; }
.team-grid, .admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.team-grid > article, .admin-grid > form { min-width: 0; padding: 18px; border: 1px solid #333a31; border-radius: 12px; background: #151a16; }
.team-grid .panel-head { margin-bottom: 13px; }
.item-list { display: grid; gap: 9px; margin-top: 13px; }
.item { padding: 13px 14px; border: 1px solid #333a31; border-radius: 10px; background: #1a1f1a; }
.item strong { color: #e9ebdf; font-size: 12px; }
.item p { margin: 7px 0; color: #b1b8ac; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.item small { color: #919a8e; font-size: 10px; }
.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border: 1px solid #414a3e; border-radius: 9px; background: #252c24; color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .15s, filter .15s, border-color .15s; }
.button:hover { transform: translateY(-1px); filter: brightness(1.12); border-color: #68725f; }
.button.primary { border-color: #c4a85f; background: linear-gradient(135deg, #e7cf8a, #cfb46d); color: #211f16; }
.button.danger { border-color: #784740; background: #492b28; color: #ffd7d1; }
.button.discord { border-color: #727bf0; background: #535dcc; color: #fff; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
input, textarea { display: block; width: 100%; margin: 0 0 10px; padding: 11px 12px; border: 1px solid #384036; border-radius: 9px; outline: none; background: #101511; color: var(--text); font-size: 12px; }
input::placeholder, textarea::placeholder { color: #747e72; }
input:focus, textarea:focus { border-color: #b79d5d; box-shadow: 0 0 0 3px #d2b5651b; }
textarea { resize: vertical; line-height: 1.55; }
#playerSearch { max-width: 220px; margin: 0; }
.delete { float: right; padding: 3px 0 3px 8px; border: 0; background: transparent; color: #d78c80; font-size: 10px; cursor: pointer; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 20px max(28px, calc((100vw - 1320px) / 2)); border-top: 1px solid #30382f; color: #889185; font-size: 11px; }
#toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); padding: 13px 16px; border: 1px solid #6b6247; border-radius: 10px; background: #25281f; color: var(--text); font-size: 13px; box-shadow: 0 12px 36px #0008; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; gap: 12px; padding-inline: 20px; }
  .topbar nav { grid-column: 1 / -1; grid-row: 2; width: 100%; overflow-x: auto; justify-content: flex-start; margin: 0 0 10px; }
  .topbar nav a { white-space: nowrap; }
  .topbar { padding-top: 10px; }
  .section-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { width: min(100% - 28px, 540px); padding: 25px 0 56px; }
  .topbar { min-height: auto; padding: 10px 14px 0; }
  .hero { min-height: 0; align-items: flex-start; flex-direction: column; gap: 22px; padding: 25px 21px; border-radius: 16px; }
  .hero::after { right: -22px; top: 24px; transform: none; font-size: 130px; }
  .hero h1 { font-size: clamp(37px, 11vw, 52px); }
  .hero .muted { font-size: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 12px 0; }
  .stat-card { min-height: 122px; padding: 16px; }
  .stat-card::after { left: 16px; right: 16px; }
  .stat-card span { font-size: 8px; letter-spacing: .09em; }
  .stat-card strong { margin-top: 12px; font-size: 29px; }
  .panel { padding: 16px; border-radius: 13px; }
  .panel-head { align-items: flex-start; }
  .team-grid, .admin-grid { grid-template-columns: 1fr; }
  #account .button { padding: 8px 10px; font-size: 10px; }
  .brand { font-size: 12px; }
  footer { flex-direction: column; padding: 18px 15px; }
}
