@font-face {
  font-family: 'Morgath';
  src: url('/assets/fonts/Morgath-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lenia Sans';
  src: url('/assets/fonts/LeniaSans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lenia Sans';
  src: url('/assets/fonts/LeniaSans-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lenia Sans';
  src: url('/assets/fonts/LeniaSans-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lenia Sans';
  src: url('/assets/fonts/LeniaSans-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #f4efe4;
  --ink-soft: rgba(244, 239, 228, 0.72);
  --ink-mute: rgba(244, 239, 228, 0.44);
  --gold: #d6ae63;
  --gold-bright: #f2cf82;
  --line: rgba(244, 239, 228, 0.14);
  --bar-bg: rgba(7, 9, 13, 0.80);
  --panel-bg: rgba(9, 11, 16, 0.88);
  --font-display: 'Morgath', Georgia, serif;
  --font-ui: 'Lenia Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #06070a; color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#bfCanvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block;
  z-index: 0;
}

button {
  font-family: var(--font-ui);
  background: none; border: none; color: inherit; cursor: pointer;
  padding: 0; border-radius: 0;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

/* TOP BAR: Ultra-clean single-line AAA header */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px;
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: linear-gradient(180deg, rgba(6, 8, 12, 0.88) 0%, rgba(6, 8, 12, 0.56) 76%, rgba(6, 8, 12, 0) 100%);
  z-index: 20;
}
.top-left, .top-center, .top-right {
  display: flex; align-items: center; gap: 16px; min-width: 0;
}
.top-divider { width: 1px; height: 16px; background: var(--line); flex: none; }
.nav-link {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.nav-link:hover { color: var(--ink); }
.screen-heading {
  font-family: var(--font-display); font-size: 16px; letter-spacing: 0.14em;
  color: var(--ink); white-space: nowrap;
}

.map-tabs {
  display: flex; align-items: center; gap: 14px;
}
.map-tab {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-mute); padding: 8px 2px; border-bottom: 1.5px solid transparent;
  white-space: nowrap;
}
.map-tab:hover { color: var(--ink-soft); }
.map-tab.is-active { color: var(--gold-bright); border-bottom-color: var(--gold); }

.mode-btn {
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-soft); padding: 7px 14px;
  border: 1px solid var(--line); background: rgba(10, 12, 18, 0.72);
  white-space: nowrap;
}
.mode-btn.is-active {
  color: var(--gold-bright); border-color: rgba(214, 174, 99, 0.65);
  background: rgba(214, 174, 99, 0.12);
}
.mode-btn:hover { color: var(--ink); border-color: rgba(244, 239, 228, 0.42); }

/* SUBTLE MAP MATERIAL CAPTION (top-left below bar, readable on bright & dark maps) */
.map-caption {
  position: fixed; top: 64px; left: 28px; z-index: 15;
  max-width: 460px; pointer-events: none;
  background: rgba(7, 9, 13, 0.76);
  border-left: 2px solid var(--gold);
  padding: 9px 14px;
  backdrop-filter: blur(8px);
}
.cap-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold-bright); margin-bottom: 3px;
}
.cap-note {
  font-size: 12px; line-height: 1.45; color: var(--ink-soft);
}

/* LAYERS DRAWER (right side, collapsible so battlefield stays open) */
.layers-panel {
  position: fixed; top: 68px; right: 28px; width: 274px; z-index: 25;
  background: var(--panel-bg); border: 1px solid var(--line);
  padding: 16px 18px;
  display: none; flex-direction: column; gap: 11px;
  backdrop-filter: blur(12px);
}
.layers-panel.is-open { display: flex; }
.layers-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
}
.layers-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.18em; color: var(--gold-bright);
}
.layer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12px; color: var(--ink-soft); cursor: pointer;
}
.layer-row input { accent-color: var(--gold); cursor: pointer; }
.layer-hint {
  font-size: 11px; color: var(--ink-mute); line-height: 1.4;
  border-top: 1px solid var(--line); padding-top: 8px;
}

/* READABLE FULL-CARD HOVER PREVIEW (XT1: shows crisp full Magic card on hover) */
.card-zoom {
  position: fixed; right: 28px; bottom: 82px; width: 230px; z-index: 22;
  pointer-events: none; opacity: 0; transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.card-zoom.is-show { opacity: 1; transform: translateY(0); }
.card-zoom img {
  width: 100%; display: block; border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.85);
}
.card-zoom-meta {
  margin-top: 6px; padding: 6px 10px; background: rgba(7, 9, 13, 0.86);
  border: 1px solid var(--line); font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink-soft);
}

/* CLEAN BOTTOM ACTION DOCK */
.action-dock {
  position: fixed; left: 0; right: 0; bottom: 0; height: 62px;
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(0deg, rgba(6, 8, 12, 0.90) 0%, rgba(6, 8, 12, 0.62) 72%, rgba(6, 8, 12, 0) 100%);
  z-index: 20;
}
.dock-group {
  display: flex; align-items: center; gap: 10px;
}
.dock-btn {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); padding: 9px 13px;
  border: 1px solid rgba(244, 239, 228, 0.18);
  background: rgba(10, 12, 18, 0.72);
  white-space: nowrap;
}
.dock-btn:hover {
  border-color: rgba(214, 174, 99, 0.68);
  color: var(--gold-bright);
  background: rgba(214, 174, 99, 0.10);
}
.dock-btn.is-gold {
  border-color: rgba(214, 174, 99, 0.65);
  color: var(--gold-bright);
  background: rgba(214, 174, 99, 0.12);
}
.dock-btn.is-gold:hover {
  background: rgba(214, 174, 99, 0.22);
}
.dock-hint {
  font-size: 11px; letter-spacing: 0.10em; color: var(--ink-mute); white-space: nowrap;
}
