:root {
  --ink: #241912;
  --ink-soft: #5c4738;
  --parchment: #f3ead8;
  --parchment-2: #e6d8be;
  --parchment-hi: #fbf6ec;
  --timber: #473226;
  --timber-dark: #2c1e16;
  --red: #cc3b33;
  --red-dark: #7f1d18;
  --blue: #2b6cb0;
  --blue-dark: #163d66;
  --gold: #eab308;
  --forest: #3f7d3c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  user-select: none;
}

#board-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Tactile Physical Plaque */
.plaque {
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow:
    inset 0 2px 0 var(--parchment-hi),
    0 5px 0 var(--timber-dark),
    0 12px 24px rgba(24, 16, 10, 0.34);
}

/* Tactile Push Buttons */
.tactile-btn {
  font-family: inherit;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.84rem;
  border: 3px solid var(--ink);
  border-radius: 5px;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.tactile-btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.tactile-btn:active:not(:disabled) {
  transform: translateY(3px);
}

.tactile-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-crimson {
  background: var(--red);
  color: #fff8f0;
  box-shadow: inset 0 2px 0 #f27268, 0 4px 0 var(--red-dark);
}
.btn-crimson:active:not(:disabled) {
  box-shadow: inset 0 2px 0 #f27268, 0 1px 0 var(--red-dark);
}

.btn-cobalt {
  background: var(--blue);
  color: #f4f9ff;
  box-shadow: inset 0 2px 0 #63b3ed, 0 4px 0 var(--blue-dark);
}
.btn-cobalt:active:not(:disabled) {
  box-shadow: inset 0 2px 0 #63b3ed, 0 1px 0 var(--blue-dark);
}

.btn-bone {
  background: var(--parchment-2);
  color: var(--ink);
  box-shadow: inset 0 2px 0 var(--parchment-hi), 0 4px 0 #8a735c;
}
.btn-bone:active:not(:disabled) {
  box-shadow: inset 0 2px 0 var(--parchment-hi), 0 1px 0 #8a735c;
}

.btn-timber {
  background: var(--timber);
  color: #f8efe0;
  box-shadow: inset 0 2px 0 #6e4e3c, 0 4px 0 var(--timber-dark);
}
.btn-timber:active:not(:disabled) {
  box-shadow: inset 0 2px 0 #6e4e3c, 0 1px 0 var(--timber-dark);
}

.btn-victory-pulse {
  background: #d97706;
  color: #fffbeb;
  box-shadow: inset 0 2px 0 #fde047, 0 4px 0 #78350f;
  animation: victoryBob 1.1s infinite ease-in-out;
}

@keyframes victoryBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.76rem;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 0.68rem;
}

/* ==================== SCREEN 1: TITLE ==================== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.screen-title {
  pointer-events: none;
  display: flex;
  align-items: center;
  padding: 40px 52px;
}

.title-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(28, 22, 16, 0.56) 0%, rgba(28, 22, 16, 0.14) 50%, transparent 100%);
  pointer-events: none;
}

.title-column {
  position: relative;
  pointer-events: auto;
  width: min(390px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-crest {
  padding: 22px 24px;
}

.crest-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--red);
  margin-bottom: 6px;
}

.game-title {
  margin: 0 0 10px 0;
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: 0.03em;
  color: var(--ink);
  text-shadow: 0 2px 0 var(--parchment-hi);
}

.title-tagline {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-menu {
  width: 100%;
  justify-content: space-between;
  padding: 13px 18px;
  font-size: 0.96rem;
}

.btn-arrow {
  font-size: 1.05rem;
}

.title-subrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==================== SCREEN 2: PACK & ARENA DRAFT ==================== */
.screen-draft {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 22px;
}

.draft-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 18, 12, 0.52);
  backdrop-filter: blur(4px);
}

.draft-shell {
  position: relative;
  width: min(960px, 100%);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.draft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 12px;
}

.draft-title-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.draft-title-block h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.mode-toggle {
  display: inline-flex;
  border: 2px solid var(--ink);
  border-radius: 5px;
  overflow: hidden;
  background: var(--parchment-2);
}

.toggle-seg {
  border: none;
  background: transparent;
  padding: 5px 11px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  cursor: pointer;
}

.toggle-seg.active {
  background: var(--timber);
  color: #fff8f0;
}

.draft-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.draft-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fff8f0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
}

.draft-maps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.arena-card {
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  box-shadow: inset 0 2px 0 var(--parchment-hi), 0 4px 0 var(--timber-dark);
}

.arena-card.active {
  border-color: var(--red);
  background: #fff9ee;
  box-shadow: inset 0 2px 0 #ffffff, 0 4px 0 var(--red-dark);
}

.arena-mini-canvas {
  width: 96px;
  height: 58px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  flex-shrink: 0;
}

.arena-card h4 {
  margin: 0 0 3px 0;
  font-family: Georgia, serif;
  font-size: 0.88rem;
}

.arena-card p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--ink-soft);
}

.draft-packs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pack-stage {
  padding: 10px 12px;
}

.pack-stage.editing {
  outline: 3px solid #fde047;
}

.pack-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.faction-label {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.red-label { color: var(--red); }
.blue-label { color: var(--blue); }

.pack-pedestals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pedestal-slot {
  background: var(--parchment-2);
  border: 2px solid var(--ink);
  border-radius: 5px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--ink);
}

.pedestal-slot.active-slot {
  border-color: var(--red);
  background: #fff9ee;
  box-shadow: 0 0 0 2px rgba(204, 59, 51, 0.35);
}

.pedestal-slot canvas {
  width: 54px;
  height: 54px;
  border-radius: 4px;
}

.pedestal-slot span {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.draft-catalog {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.beast-card {
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 6px;
  padding: 9px 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  box-shadow: inset 0 2px 0 var(--parchment-hi), 0 4px 0 var(--timber-dark);
  transition: transform 0.08s ease;
}

.beast-card:hover {
  transform: translateY(-2px);
}

.beast-card canvas {
  width: 60px;
  height: 60px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  flex-shrink: 0;
}

.beast-card-info h4 {
  margin: 0 0 2px 0;
  font-family: Georgia, serif;
  font-size: 0.9rem;
}

.beast-role {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red);
  margin-bottom: 4px;
}

.beast-card-info p {
  margin: 2px 0;
  font-size: 0.71rem;
  line-height: 1.28;
  color: var(--ink-soft);
}

.draft-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-start {
  padding: 12px 26px;
  font-size: 0.96rem;
}

/* ==================== SCREEN 3: IN-GAME OVERLAY HUD ==================== */
.screen-game {
  pointer-events: none;
}

.screen-game .plaque,
.screen-game .tactile-btn,
.screen-game .hud-pack,
.screen-game .turn-controls {
  pointer-events: auto;
}

.hud-pack {
  position: fixed;
  top: 14px;
  display: flex;
  gap: 8px;
}

.hud-pack-left {
  left: 16px;
}

.hud-top-right {
  position: fixed;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}

.hud-top-right .hud-pack,
.hud-top-right .tactile-btn {
  position: static;
  pointer-events: auto;
}

.medallion {
  position: relative;
  width: 56px;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 6px;
  padding: 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 0 var(--timber-dark), 0 6px 12px rgba(20, 14, 8, 0.28);
  transition: transform 0.1s ease;
}

.medallion:hover {
  transform: translateY(-2px);
}

.medallion.selected {
  border-color: #eab308;
  box-shadow: 0 0 0 2px #fde047, 0 4px 0 var(--timber-dark);
}

.medallion.deploy-ready {
  border-color: var(--forest);
  box-shadow: 0 0 0 2px #84cc16, 0 4px 0 #1e3a1c;
}

.medallion.ko {
  opacity: 0.55;
}

.medallion canvas {
  width: 44px;
  height: 44px;
  border-radius: 3px;
}

.medallion-pips {
  display: flex;
  gap: 7px;
  margin-top: 4px;
  margin-bottom: 1px;
}

.m-pip {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  transform: rotate(45deg);
  border: 1.5px solid var(--ink);
  background: #bfa98e;
}

.m-pip.on {
  background: #f59e0b;
  box-shadow: inset 0 1px 0 #fef08a;
}

#hud-red-pack .m-pip {
  border-color: #7f1d1d;
  background: #d6b6ae;
}

#hud-red-pack .m-pip.on {
  background: #dc2626;
  border-color: var(--ink);
  box-shadow: inset 0 1px 0 #fca5a5;
}

#hud-blue-pack .m-pip {
  border-color: #1e3a8a;
  background: #b8c8dc;
}

#hud-blue-pack .m-pip.on {
  background: #2563eb;
  border-color: var(--ink);
  box-shadow: inset 0 1px 0 #93c5fd;
}

.medallion-tag {
  position: absolute;
  bottom: -8px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1.5px solid var(--ink);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: var(--timber);
  color: #fff8f0;
}

.medallion-tag.deploy {
  background: var(--forest);
}

.medallion-tag.pinned {
  background: var(--red);
}

/* Top-Center Turn & AP Crest */
.turn-crest {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.turn-crest.red-crest {
  border-top: 5px solid var(--red);
}

.turn-crest.blue-crest {
  border-top: 5px solid var(--blue);
}

.crest-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.crest-faction {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.red-crest .crest-faction { color: var(--red); }
.blue-crest .crest-faction { color: var(--blue); }

.crest-turn {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.crest-ap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  border-left: 2px solid #c7b69b;
}

.ap-word {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.ap-gems {
  display: flex;
  gap: 7px;
}

.ap-gem {
  width: 15px;
  height: 15px;
  transform: rotate(45deg);
  border: 2px solid var(--ink);
  background: #bfa98e;
  transition: background 0.15s ease, transform 0.15s ease;
}

.ap-gem.lit {
  background: #f59e0b;
  box-shadow: inset 0 2px 0 #fef08a, 0 0 8px rgba(245, 158, 11, 0.55);
  transform: rotate(45deg) scale(1.06);
}

.red-crest .ap-gem.lit {
  background: #dc2626;
  box-shadow: inset 0 2px 0 #fca5a5, 0 0 8px rgba(220, 38, 38, 0.45);
}

.blue-crest .ap-gem.lit {
  background: #2563eb;
  box-shadow: inset 0 2px 0 #93c5fd, 0 0 8px rgba(37, 99, 235, 0.45);
}

/* Floating Battle Banner */
.battle-banner {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--timber);
  color: #fff8f0;
  border: 3px solid var(--ink);
  border-radius: 5px;
  padding: 6px 16px;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 0 var(--timber-dark);
}

.ai-thinking-tag {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blue);
  color: #f4f9ff;
  border: 2.5px solid var(--ink);
  border-radius: 5px;
  padding: 5px 14px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

/* Bottom Dock (Camera + Unit Bar + Turn Controls) */
.hud-bottom-dock {
  position: fixed;
  bottom: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.camera-controls {
  flex-shrink: 0;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cam-btn {
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--parchment-2);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 var(--parchment-hi), 0 2px 0 #8a735c;
}

.cam-btn:hover {
  background: #fff9ee;
}

.cam-btn:active {
  transform: translateY(1px);
}

.cam-btn-wide {
  width: auto;
  padding: 0 7px;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

.cam-sep {
  width: 2px;
  height: 20px;
  background: #c7b69b;
  margin: 0 2px;
}

.unit-bar {
  flex: 1 1 auto;
  max-width: 630px;
  min-width: 0;
  margin: 0 auto;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit-portrait-frame {
  width: 68px;
  height: 68px;
  border: 3px solid var(--ink);
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
}

.unit-portrait-frame canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.unit-info {
  width: 205px;
  flex-shrink: 0;
}

.unit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.unit-head h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 0.96rem;
}

.unit-ap-pip {
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--timber);
  color: #fff8f0;
  padding: 2px 6px;
  border-radius: 3px;
}

.unit-passive {
  margin: 0;
  font-size: 0.71rem;
  line-height: 1.3;
  color: var(--ink-soft);
}

.unit-note {
  margin-top: 4px;
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--red-dark);
}

.unit-actions {
  flex: 1;
  display: flex;
  gap: 8px;
}

.action-tile {
  flex: 1;
  background: var(--parchment-2);
  border: 2.5px solid var(--ink);
  border-radius: 5px;
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  box-shadow: inset 0 2px 0 var(--parchment-hi), 0 3px 0 #8a735c;
}

.action-tile.active {
  background: #fff9ee;
  border-color: var(--blue);
  box-shadow: inset 0 2px 0 #ffffff, 0 3px 0 var(--blue-dark);
}

.action-tile#btn-act-ability.active {
  border-color: var(--red);
  box-shadow: inset 0 2px 0 #ffffff, 0 3px 0 var(--red-dark);
}

.action-tile:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.tile-cost {
  font-size: 0.68rem;
  color: var(--red);
}

.action-tile-desc {
  margin: 0;
  font-size: 0.69rem;
  line-height: 1.28;
  color: var(--ink-soft);
}

.redeploy-tile.active {
  border-color: var(--forest);
  box-shadow: inset 0 2px 0 #ffffff, 0 3px 0 #1e3a1c;
}

/* Bottom-Right Turn Controls */
.turn-controls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==================== DIALOGS & MODALS ==================== */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 14, 10, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dialog-box {
  width: min(440px, 100%);
  padding: 20px;
}

.dialog-head h3 {
  margin: 0 0 14px 0;
  font-family: Georgia, serif;
  font-size: 1.2rem;
  text-align: center;
}

.option-block {
  margin-bottom: 14px;
}

.option-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.segmented-bar {
  display: flex;
  border: 2.5px solid var(--ink);
  border-radius: 5px;
  overflow: hidden;
  background: var(--parchment-2);
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 6px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.74rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--timber);
  color: #fff8f0;
}

.option-hint {
  margin: 6px 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.dialog-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.compendium-box {
  width: min(880px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

.compendium-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.compendium-head h3 {
  margin: 0 0 4px 0;
  font-family: Georgia, serif;
  font-size: 1.2rem;
}

.compendium-sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.turntable-stage {
  display: flex;
  gap: 14px;
  background: var(--parchment-2);
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.turntable-canvas-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.turntable-canvas-wrap canvas {
  width: 170px;
  height: 170px;
  border: 3px solid var(--ink);
  border-radius: 5px;
}

.turntable-hint {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.turntable-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.turntable-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.turntable-tab {
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--parchment);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  cursor: pointer;
}

.turntable-tab.active {
  background: var(--red);
  color: #fff8f0;
}

.turntable-details h4 {
  margin: 0 0 4px 0;
  font-family: Georgia, serif;
  font-size: 1.05rem;
}

.turntable-details p {
  margin: 3px 0;
  font-size: 0.78rem;
  line-height: 1.38;
  color: var(--ink-soft);
}

.guide-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.guide-entry {
  background: var(--parchment-2);
  border: 2.5px solid var(--ink);
  border-radius: 5px;
  padding: 10px;
  display: flex;
  gap: 10px;
}

.guide-entry canvas {
  width: 60px;
  height: 60px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  flex-shrink: 0;
}

.guide-entry h4 {
  margin: 0 0 3px 0;
  font-family: Georgia, serif;
  font-size: 0.94rem;
}

.guide-entry p {
  margin: 2px 0;
  font-size: 0.73rem;
  line-height: 1.32;
  color: var(--ink-soft);
}

.victory-box {
  width: min(460px, 100%);
  padding: 24px;
  text-align: center;
}

.victory-crest {
  display: inline-block;
  padding: 4px 12px;
  background: var(--timber);
  color: #fde68a;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.victory-box h2 {
  margin: 0 0 6px 0;
  font-family: Georgia, serif;
  font-size: 1.6rem;
}

.victory-sub {
  margin: 0 0 14px 0;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.victory-portraits {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.victory-portraits canvas {
  width: 64px;
  height: 64px;
  border: 3px solid var(--ink);
  border-radius: 5px;
}

.victory-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ==================== ONLINE LOBBY & 4-MODE DRAFT ==================== */
.lobby-shell {
  position: relative;
  width: min(1040px, 100%);
  max-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.lobby-header {
  gap: 12px;
}

.lobby-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.lobby-identity h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.25rem;
}

.lobby-handle-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lobby-status-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lobby-badge {
  background: var(--timber);
  color: #fde68a;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.lobby-online {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--forest);
  letter-spacing: 0.06em;
}

.parchment-input,
.parchment-select {
  background: var(--parchment-2);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

.parchment-select {
  width: 100%;
  margin-bottom: 8px;
}

.code-input {
  width: 110px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: center;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 12px;
  align-items: start;
}

.lobby-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lobby-card {
  padding: 12px 14px;
}

.lobby-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.lobby-card-head h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 0.98rem;
}

.queue-tag {
  background: var(--parchment-2);
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 0.62rem;
  font-weight: 800;
}

.ranked-tag {
  background: var(--red);
  color: #fff8f0;
}

.lobby-card-desc {
  margin: 0 0 8px 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.mini-field-label {
  display: block;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.lobby-full-btn {
  width: 100%;
  justify-content: center;
}

.invite-join-row {
  display: flex;
  gap: 8px;
}

.queue-waiting {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fef3c7;
  border-color: var(--red);
  font-size: 0.78rem;
}

.queue-waiting-sub {
  font-size: 0.68rem;
  color: var(--ink-soft);
}

.lobby-right {
  padding: 12px 14px;
  min-height: 410px;
  display: flex;
  flex-direction: column;
}

.lobby-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2.5px solid var(--ink);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.lobby-tab {
  background: var(--parchment-2);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}

.lobby-tab.active {
  background: var(--timber);
  color: #fff8f0;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-row {
  background: var(--parchment-2);
  border: 2px solid var(--ink);
  border-radius: 5px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-row-title {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 0.9rem;
}

.room-row-sub {
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row {
  margin-bottom: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 6px 0 12px;
  cursor: pointer;
}

.leaderboard-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.leaderboard-wrap th,
.leaderboard-wrap td {
  padding: 5px 8px;
  border-bottom: 1px solid #cdbca3;
  text-align: left;
}

.leaderboard-wrap th {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.recent-title {
  margin: 14px 0 6px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.recent-match-row {
  font-size: 0.72rem;
  padding: 4px 0;
  border-bottom: 1px dashed #d3c2aa;
  display: flex;
  justify-content: space-between;
}

/* Online Draft Screen */
.od-header {
  gap: 12px;
}

.od-meta-center {
  text-align: center;
}

.od-meta-center h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.15rem;
}

.od-sub {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.od-right-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.od-opp-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.od-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.od-waiting-box {
  padding: 28px 20px;
  text-align: center;
}

.od-waiting-code {
  display: inline-block;
  margin: 10px 0;
  padding: 8px 18px;
  background: var(--timber);
  color: #fde68a;
  border: 3px solid var(--ink);
  border-radius: 6px;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  letter-spacing: 0.16em;
}

.od-turn-banner {
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.od-turn-banner.your-turn {
  background: #fef3c7;
  border-color: var(--red);
}

.od-ban-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 800;
}

.ban-pill {
  background: #dc2626;
  color: #fff8f0;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
}

.beast-card.is-banned {
  opacity: 0.42;
  filter: grayscale(0.75);
  cursor: not-allowed;
}

/* Sealed Foil Booster Packets */
.boosters-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.foil-pack-btn {
  background: linear-gradient(135deg, #5d402a 0%, #8a5e3b 50%, #442c1a 100%);
  color: #fde68a;
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255, 240, 190, 0.35), 0 5px 0 var(--timber-dark);
  transition: transform 0.1s ease;
}

.foil-pack-btn:hover {
  transform: translateY(-2px);
}

.foil-pack-title {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.foil-pack-sub {
  margin-top: 6px;
  font-size: 0.7rem;
  color: #f5e6cf;
}

.booster-opened-group {
  padding: 10px;
}

.booster-opened-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.booster-cards-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sealed-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--parchment-2);
  border: 2px solid var(--ink);
  border-radius: 5px;
  padding: 5px 8px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

.sealed-card.selected {
  background: #fef3c7;
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(204, 59, 51, 0.35);
}

.sealed-card canvas {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  flex-shrink: 0;
}

.turn-clock {
  padding: 3px 8px;
  background: var(--parchment-2);
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink);
}

.turn-clock.low {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #b91c1c;
}

.victory-elo {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--timber);
}

@media (max-width: 820px) {
  .lobby-grid,
  .boosters-row {
    grid-template-columns: 1fr;
  }
}
