:root {
  --bg: #0b0a08;
  --panel: #17110d;
  --panel-2: #241c12;
  --line: #3b2b15;
  --gold: #d9b735;
  --gold-2: #f2dc77;
  --text: #fff6df;
  --muted: #c2aa86;
  --danger: #9f2d25;
  --ok: #2d7a3e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::selection { background: var(--gold); color: #120e08; }

.app-shell { min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #0f0d0a;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: Georgia, serif;
  font-size: 28px;
  font-variant: small-caps;
  color: var(--gold);
  letter-spacing: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border: 2px solid var(--gold);
  display: grid;
  place-items: center;
  color: var(--gold);
}

.container { max-width: 1440px; margin: 0 auto; padding: 24px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.game-grid { grid-template-columns: 310px minmax(0, 1fr) 330px; align-items: start; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.card h2, .card h3 {
  margin: 0 0 14px;
  font-family: Georgia, serif;
  font-variant: small-caps;
  color: var(--text);
}
.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }

button, .button {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--gold); color: var(--gold-2); }
button.primary, .button.primary { background: var(--gold); color: #140e06; border-color: var(--gold); }
button.ghost { background: transparent; }
button.danger { background: var(--danger); border-color: var(--danger); }

input, textarea, select {
  width: 100%;
  border: 1px solid #352611;
  background: #130f0b;
  color: var(--text);
  border-radius: 7px;
  padding: 11px 12px;
  font: inherit;
}
textarea { min-height: 92px; resize: vertical; }
label { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.field { min-width: 0; }

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 430px;
}
.auth-art {
  background:
    linear-gradient(90deg, rgba(11,10,8,.9), rgba(11,10,8,.2)),
    radial-gradient(circle at 70% 25%, rgba(217,183,53,.25), transparent 35%),
    linear-gradient(135deg, #1b130b, #090807 70%);
  border-right: 1px solid var(--line);
  padding: 54px;
}
.auth-panel { display: grid; place-items: center; padding: 24px; }
.auth-box { width: 100%; max-width: 380px; }

.tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.tab.active { background: var(--gold); color: #140e06; }

.avatar-preview, .token {
  border-radius: 50%;
  overflow: hidden;
  background: var(--gold);
  display: grid;
  place-items: center;
  color: #140e06;
  font-weight: 900;
}
.avatar-preview { width: 116px; height: 116px; border: 4px solid var(--gold); }
.avatar-preview img, .token img { width: 100%; height: 100%; object-fit: cover; }

.sheet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(36,28,18,.55);
  padding: 14px;
}
.stat-card {
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
  padding: 12px;
  border-radius: 8px;
}
.stat-card strong { color: var(--gold); font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #130f0b;
  border-radius: 7px;
  padding: 7px 9px;
  font-size: 13px;
}
.chip.active { border-color: var(--gold); color: var(--gold); background: rgba(217,183,53,.12); }

.map {
  position: relative;
  height: calc(100vh - 150px);
  min-height: 540px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(rgba(217,183,53,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217,183,53,.08) 1px, transparent 1px),
    #11100d;
  background-size: 50px 50px;
  overflow: hidden;
}
.map img.map-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.token {
  position: absolute;
  width: 50px;
  height: 50px;
  border: 3px solid white;
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
  transform: translate(-50%, -50%);
  user-select: none;
}
.token.selected { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(217,183,53,.2), 0 10px 25px rgba(0,0,0,.4); }
.token-name {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(23,17,13,.96);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
  font-size: 12px;
}
.health {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 58px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.7);
  overflow: hidden;
}
.health span { display: block; height: 100%; background: var(--ok); }

.chat-list, .scroll-list { max-height: 360px; overflow: auto; padding-right: 6px; }
.chat-msg {
  border: 1px solid var(--line);
  background: rgba(36,28,18,.7);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.chat-msg.roll { border-color: rgba(217,183,53,.6); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #120f0a; }
::-webkit-scrollbar-thumb { background: #6f5520; border-radius: 999px; border: 2px solid #120f0a; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

@media (max-width: 1100px) {
  .game-grid, .grid-2, .grid-3, .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map { height: 560px; }
}

