:root {
  color-scheme: dark;
  --ink: #d9cfb5;
  --muted: #a99d81;
  --gold: #d6a94f;
  --gold-bright: #f3cf72;
  --green: #87a95f;
  --blood: #7e3028;
  --night: #0b0d0d;
  --panel: #171817;
  --panel-deep: #111211;
  --stone: #33342f;
  --stone-dark: #23241f;
  --line: #575343;
  --shadow: #050606;
  font-family: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--night);
}

button { font: inherit; }

.page-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.game-header {
  min-height: 92px;
  padding: 20px clamp(18px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #3e3a2f;
  background: #111311;
  box-shadow: 0 8px 22px rgba(0,0,0,.42);
}

.brand-mark { width: min(265px, 54vw); height: auto; }

.account-stub {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font: 700 .78rem/1.2 Arial, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.status-rune {
  width: 9px;
  height: 9px;
  border: 1px solid #b8d38a;
  background: #657f43;
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(135,169,95,.55);
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  padding: 24px clamp(16px, 3vw, 44px) 30px;
}

.party-panel, .roster-panel {
  border: 1px solid var(--line);
  outline: 1px solid #090a09;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(0,0,0,.44), inset 0 0 0 3px #24251f;
}

.party-panel { padding: clamp(18px, 3vw, 34px); }
.roster-panel { padding: 22px 18px; }

.section-heading, .roster-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  border-bottom: 1px solid #484536;
  padding-bottom: 13px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font: 700 .72rem/1.2 Arial, sans-serif;
  letter-spacing: .17em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; color: #f0e4c8; text-shadow: 2px 2px 0 #000; }
h1 { font-size: clamp(1.8rem, 3vw, 2.65rem); }
h2 { font-size: 1.35rem; }

.lead, .roster-help {
  color: var(--muted);
  line-height: 1.55;
}

.lead { margin: 15px 0 22px; }
.roster-help { margin: 14px 2px; font-size: .93rem; }
.party-progress, .roster-count { color: var(--muted); white-space: nowrap; font: 700 .8rem Arial, sans-serif; }

.pedestal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: clamp(10px, 1.3vw, 20px);
  align-items: stretch;
}

.pedestal-card {
  position: relative;
  min-height: 388px;
  padding: 15px 11px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #555448;
  background: #20211e;
  box-shadow: inset 0 0 24px rgba(0,0,0,.55), 0 5px 0 #090a09;
}

.pedestal-card.is-target { cursor: pointer; border-color: var(--gold); box-shadow: inset 0 0 28px rgba(214,169,79,.13), 0 5px 0 #090a09; }
.pedestal-card.is-leader { border-color: #9f7c37; }

.slot-number {
  position: absolute;
  top: 9px;
  left: 10px;
  color: #817a66;
  font: 700 .72rem Arial, sans-serif;
}

.leader-crown {
  min-height: 24px;
  color: var(--gold-bright);
  font: 700 .72rem Arial, sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.character-figure {
  width: 100%;
  height: 148px;
  display: grid;
  place-items: end center;
  position: relative;
}

.character-token {
  width: 82px;
  height: 112px;
  display: grid;
  place-items: center;
  color: #eee4cb;
  font: 800 1.65rem Arial, sans-serif;
  border: 2px solid #83785f;
  border-radius: 48% 48% 32% 32%;
  background: var(--vocation-color, #4d4c45);
  box-shadow: inset 0 -18px 0 rgba(0,0,0,.22), 0 8px 12px rgba(0,0,0,.55);
  text-shadow: 2px 2px 0 #000;
}

.character-token::before {
  content: "";
  position: absolute;
  bottom: 4px;
  width: 118px;
  height: 21px;
  border-radius: 50%;
  background: rgba(0,0,0,.38);
  z-index: -1;
}

.character-token span, .mini-token span { display: block; }
.character-token.has-outfit, .mini-token.has-outfit { background: transparent; border-color: transparent; box-shadow: none; }
.character-token.has-outfit span, .mini-token.has-outfit span { display: none; }
.character-token.has-outfit::before { display: none; }
.character-token img {
  width: 112px;
  max-height: 132px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 7px 3px rgba(0,0,0,.72));
}
.mini-token img {
  width: 54px;
  max-height: 58px;
  object-fit: contain;
  image-rendering: pixelated;
}

.pedestal-art { width: 138px; height: 57px; margin-top: -5px; }

.character-info { width: 100%; min-height: 76px; text-align: center; }
.character-info h3 { margin: 9px 0 5px; font-size: 1rem; color: #f1e5c7; }
.character-info p { margin: 3px 0; color: var(--muted); font: .79rem/1.35 Arial, sans-serif; }

.empty-copy { min-height: 76px; display: grid; place-items: center; color: #8d8878; text-align: center; font-style: italic; }

.play-button, .secondary-button, .place-button {
  border: 1px solid #17130b;
  color: #f8eac8;
  background: #715126;
  box-shadow: inset 0 0 0 1px #aa8244, 0 2px 0 #080806;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: .08em;
  font: 800 .78rem/1 Arial, sans-serif;
}

.play-button { width: 100%; min-height: 40px; margin-top: auto; }
.play-button:hover, .play-button:focus-visible, .place-button:hover, .place-button:focus-visible { background: #8b652f; outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.slot-actions { width: 100%; margin-top: 9px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.secondary-button { min-height: 33px; color: #c8bea6; background: #31322d; box-shadow: inset 0 0 0 1px #545246; font-size: .68rem; }
.secondary-button:hover, .secondary-button:focus-visible { color: #fff0c9; border-color: #9b804c; outline: none; }

.character-list { display: grid; gap: 9px; }

.roster-card {
  padding: 12px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 11px;
  align-items: center;
  border: 1px solid #44443b;
  background: var(--panel-deep);
}

.roster-card.is-selected { border-color: var(--gold); background: #242116; }
.roster-card.is-in-party { opacity: .58; }

.mini-token {
  width: 40px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #fff2d6;
  border: 1px solid #81775f;
  background: var(--vocation-color, #4d4c45);
  font: 800 .85rem Arial, sans-serif;
}

.roster-data strong { display: block; color: #e8dcc0; font-size: .93rem; }
.roster-data span { display: block; margin-top: 4px; color: var(--muted); font: .73rem Arial, sans-serif; }
.place-button { width: 35px; height: 35px; font-size: 1.1rem; padding: 0; }
.place-button:disabled { cursor: default; filter: grayscale(1); opacity: .5; }

footer {
  padding: 16px 24px;
  display: flex;
  justify-content: center;
  gap: 12px;
  color: #716c5c;
  border-top: 1px solid #302e27;
  font: .72rem Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 11px 15px;
  color: #efe3c7;
  border: 1px solid #8d7444;
  background: #1d1c18;
  box-shadow: 0 8px 22px rgba(0,0,0,.7);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  font: .86rem Arial, sans-serif;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  main { grid-template-columns: 1fr; }
  .roster-panel { order: 2; }
  .character-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .game-header { min-height: 74px; padding: 15px 17px; }
  .account-stub span:last-child { display: none; }
  main { padding: 14px 12px 24px; }
  .party-panel { padding: 18px 12px; }
  .pedestal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pedestal-card { min-height: 355px; }
  .character-list { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .pedestal-grid { gap: 8px; }
  .pedestal-card { min-height: 342px; padding-inline: 8px; }
  .character-token { width: 68px; height: 100px; }
  .pedestal-art { width: 112px; }
  .slot-actions { grid-template-columns: 1fr; }
  .character-info h3 { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
