/* ============================================================
   BOARDGAME VAULT — Stylesheet
   Aesthetic: Gothic Tavern Library · Cinzel + Crimson Text
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cinzel+Decorative:wght@400;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #080604;
  --surface:      #110e0a;
  --card:         #1a1410;
  --card-hover:   #221b13;
  --border:       #3a2e20;
  --border-glow:  #6b4f2a;
  --gold:         #c9922a;
  --gold-light:   #e8b84b;
  --gold-dim:     #7a5818;
  --crimson:      #8b2020;
  --crimson-dark: #5a1010;
  --parchment:    #e8d5b0;
  --parchment-dim:#b8a880;
  --muted:        #8a7050;
  --success:      #2d6e3c;
  --danger:       #8b2020;
  --shadow:       0 4px 24px rgba(0,0,0,0.8);
  --glow-gold:    0 0 20px rgba(201,146,42,0.3);
  --radius:       6px;
  --radius-lg:    12px;
  --font-display: 'Cinzel', Georgia, serif;
  --font-deco:    'Cinzel Decorative', 'Cinzel', Georgia, serif;
  --font-body:    'Crimson Text', Georgia, serif;
  --transition:   0.25s ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  /* Subtle dark wood grain underlying everything */
  background-image: url('/images/oak_tree.png');
  background-size: 600px auto;
  background-repeat: repeat;
  background-attachment: fixed;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

/* Dark overlay so wood grain is very subtle — readable text always */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 2, 0.88);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: var(--gold-light);
}

p { margin-bottom: 1em; }
img { max-width: 100%; display: block; }

::selection { background: var(--gold-dim); color: var(--parchment); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-glow); }

/* ── Layout ────────────────────────────────────────────────── */
#app { position: relative; z-index: 1; }

.page { display: none; animation: pageIn 0.4s ease; }
.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 2rem; }
.container--narrow { max-width: 860px; }

/* ── Navigation ────────────────────────────────────────────── */
#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Wood texture with very heavy dark overlay — almost invisible but tactile */
  background-image: url('/images/oak_tree.png');
  background-size: 500px auto;
  background-color: rgba(6, 4, 2, 0.96);
  background-blend-mode: multiply;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 60px;
}

.nav-logo {
  font-family: var(--font-deco);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow: 0 0 20px rgba(201,146,42,0.6);
  flex-shrink: 0;
}
.nav-logo span { color: var(--crimson); }

.nav-links {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  flex: 1;
}

.nav-link {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  background: none;
}
.nav-link:hover, .nav-link.active {
  color: var(--gold-light);
  background: rgba(201,146,42,0.08);
}

/* Music player in nav */
.nav-music {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.music-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.85rem;
  flex-shrink: 0;
}
.music-btn:hover, .music-btn.playing {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: var(--glow-gold);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

/* ── Divider ornament ──────────────────────────────────────── */
.ornament {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  color: var(--gold-dim);
  font-size: 1rem;
}
.ornament::before, .ornament::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background-image: url('/images/oak_tree.png'), linear-gradient(135deg, #9c6e20, var(--gold));
  background-size: 300px auto, 100%;
  background-blend-mode: multiply;
  color: #f5e8c8;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
  border: 1px solid var(--gold-dim);
}
.btn-primary:hover {
  background-image: url('/images/oak_tree.png'), linear-gradient(135deg, var(--gold), var(--gold-light));
  background-size: 300px auto, 100%;
  box-shadow: var(--glow-gold), 0 0 0 1px var(--gold);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--parchment-dim);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(201,146,42,0.06);
}

.btn-danger {
  background: var(--crimson-dark);
  color: var(--parchment);
  border: 1px solid var(--crimson);
}
.btn-danger:hover { background: var(--crimson); }

.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: var(--parchment); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background-image: url('/images/oak_tree.png');
  background-size: 400px auto;
  background-color: var(--card);
  background-blend-mode: multiply;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow), var(--glow-gold);
  transform: translateY(-2px);
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
}
.badge-gold    { border-color: var(--gold-dim);    color: var(--gold);    background: rgba(201,146,42,0.1); }
.badge-crimson { border-color: var(--crimson);      color: #e57373;        background: rgba(139,32,32,0.15); }
.badge-green   { border-color: #2d6e3c;             color: #6dba7f;        background: rgba(45,110,60,0.15); }
.badge-muted   { border-color: var(--border);       color: var(--muted);   background: rgba(255,255,255,0.03); }

/* ── Form Controls ──────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }

label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="text"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 0.9rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(201,146,42,0.12);
}

input::placeholder, textarea::placeholder { color: var(--muted); }
option { background: var(--surface); }

/* Range input */
input[type="range"] {
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border: none;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

/* ── Page sections ──────────────────────────────────────────── */
.page-header {
  padding: 4rem 0 3rem;
  text-align: center;
  position: relative;
  /* Subtle tavern image as a very dark banner behind the title */
  background-image: url('/images/background.png');
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
}

/* Deep overlay so the tavern image is just atmospheric, not distracting */
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 2, 0.82);
  z-index: 0;
}

.page-header > * { position: relative; z-index: 1; }

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  text-shadow: 0 0 40px rgba(201,146,42,0.4);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--muted);
  font-size: 1.1rem;
  font-style: italic;
}

/* ── Section titles ─────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Loading & states ───────────────────────────────────────── */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  color: var(--muted);
  font-style: italic;
  gap: 1rem;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  font-style: italic;
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }

/* ── Toast notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: 320px;
  box-shadow: var(--shadow);
}
.toast.success { border-color: var(--success); color: #6dba7f; }
.toast.error   { border-color: var(--crimson); color: #e57373; }
.toast.info    { border-color: var(--gold-dim); color: var(--gold-light); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════
   HOME PAGE
═══════════════════════════════════════════════════════════ */

/* Hero */
.hero {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('/images/background.png');
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
  /* Layered: darken image so text is readable, add warm vignette */
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.8) 60%, rgba(0,0,0,1) 100%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.8) 60%, rgba(0,0,0,1) 100%);
  pointer-events: none;
  filter: brightness(0.72) saturate(0.85);
}

/* Crimson/gold vignette on top of hero image */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 80%, rgba(139,32,32,0.25) 0%, transparent 70%),
    radial-gradient(ellipse 100% 40% at 50% 100%, rgba(8,6,4,0.9) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.hero > * { position: relative; z-index: 1; }

.hero-eyebrow {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
  opacity: 0.8;
}

.hero h1 {
  font-family: var(--font-deco);
  font-size: clamp(2.5rem, 8vw, 5.5rem);
  line-height: 1.05;
  text-shadow:
    0 0 60px rgba(201,146,42,0.5),
    0 2px 4px rgba(0,0,0,0.8);
  margin-bottom: 0.5rem;
}

.hero-sub {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--parchment-dim);
  max-width: 480px;
  margin: 0 auto 3rem;
}

/* ── 3D Die ─────────────────────────────────────────────────── */
.dice-section {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

.dice-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 2rem;
}

.dice-control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 100px;
}

.dice-control-group label {
  font-size: 0.62rem;
  text-align: center;
}

.dice-control-group select,
.dice-control-group input {
  width: 100px;
  text-align: center;
  padding: 0.4rem;
  font-size: 0.9rem;
}

.dice-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  perspective: 800px;
}

.die-wrapper {
  width: 140px;
  height: 140px;
  position: relative;
  transform-style: preserve-3d;
  cursor: pointer;
}

.die {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-20deg) rotateY(20deg);
  transition: transform 1.2s cubic-bezier(0.17, 0.67, 0.3, 1.2);
}

.die.rolling {
  animation: dieRoll 1.2s cubic-bezier(0.17, 0.67, 0.3, 1.2) forwards;
}

@keyframes dieRoll {
  0%   { transform: rotateX(0deg)   rotateY(0deg)   rotateZ(0deg); }
  30%  { transform: rotateX(360deg) rotateY(180deg) rotateZ(120deg); }
  60%  { transform: rotateX(540deg) rotateY(400deg) rotateZ(240deg); }
  80%  { transform: rotateX(640deg) rotateY(500deg) rotateZ(300deg); }
  100% { transform: rotateX(720deg) rotateY(540deg) rotateZ(360deg); }
}

.die-face {
  position: absolute;
  width: 140px;
  height: 140px;
  background-color: #06040200;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  text-align: center;
  overflow: hidden;
  /* Remove CSS border — it's baked into each die image */
  border: none;
}

/* Each face gets its own dice image */
.die-face-front  { transform: translateZ(70px);              background-image: url('/images/dice/dice_6.png'); }
.die-face-back   { transform: rotateY(180deg) translateZ(70px); background-image: url('/images/dice/dice_1.png'); }
.die-face-right  { transform: rotateY(90deg)  translateZ(70px); background-image: url('/images/dice/dice_2.png'); }
.die-face-left   { transform: rotateY(-90deg) translateZ(70px); background-image: url('/images/dice/dice_3.png'); }
.die-face-top    { transform: rotateX(90deg)  translateZ(70px); background-image: url('/images/dice/dice_4.png'); }
.die-face-bottom { transform: rotateX(-90deg) translateZ(70px); background-image: url('/images/dice/dice_5.png'); }

/* Game art overlay — shown on the front (dice_6 celtic-frame) face when a game is rolled */
.die-game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 22px 18px 18px;
  z-index: 2;
}

.die-game-art {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.8);
  border: 1px solid var(--gold-dim);
}

.die-game-name-overlay {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: var(--gold-light);
  text-align: center;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0,0,0,1), 0 0 8px rgba(0,0,0,0.9);
  max-width: 110px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Section dividers (border images) ─────────────────── */
/* Black BG becomes transparent via screen blend mode     */
.section-divider {
  display: block;
  width: 100%;
  max-height: 70px;
  object-fit: contain;
  mix-blend-mode: screen;
  pointer-events: none;
  margin: 0.25rem auto;
  opacity: 0.9;
}
.section-divider-sm {
  max-height: 44px;
}
.section-divider-wrap {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  margin: 0.5rem 0;
}

/* ── Parchment content areas ───────────────────────────── */
.parchment-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.parchment-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/images/parchment_paper.png');
  background-size: cover;
  background-position: center;
  opacity: 0.92;
  z-index: 0;
}
/* Dark overlay so gold/dark text pops */
.parchment-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(12, 7, 2, 0.55);
  z-index: 1;
}
.parchment-card > * {
  position: relative;
  z-index: 2;
}

/* Parchment text style — warm ink on ancient paper */
.parchment-text {
  background-image: url('/images/parchment_paper.png');
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  padding: 1.8rem 2rem;
  position: relative;
}
.parchment-text::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 5, 0, 0.48);
  border-radius: var(--radius-lg);
  z-index: 0;
}
.parchment-text > * { position: relative; z-index: 1; }
.parchment-text, .parchment-text p {
  color: #e8d5a8;
  font-size: 1.05rem;
  line-height: 1.85;
}

/* Die result card — parchment style */
.die-result-card {
  background-image: url('/images/parchment_paper.png');
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease 0.8s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.die-result-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(8,4,0,0.58);
  z-index: 0;
}
.die-result-card > * { position: relative; z-index: 1; }

.die-result-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.die-result-card:hover {
  border-color: var(--gold);
  box-shadow: var(--glow-gold);
}

/* Old die dot styles removed — dice_N.png images used instead */

.die-result-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.die-result-name {
  font-family: var(--font-deco);
  font-size: 1.5rem;
  color: var(--gold-light);
  margin-bottom: 0.3rem;
  text-shadow: 0 0 20px rgba(232,184,75,0.4);
}

.die-result-meta {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

/* Stats strip */
.home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 3rem 0;
}

.stat-block {
  background-image: url('/images/oak_tree.png');
  background-size: 400px auto;
  background-color: var(--surface);
  background-blend-mode: multiply;
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  font-family: var(--font-deco);
  font-size: 2.5rem;
  color: var(--gold-light);
  line-height: 1;
  text-shadow: 0 0 20px rgba(232,184,75,0.3);
}

.stat-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* Recent plays */
.recent-plays {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-play-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.recent-play-item:hover {
  border-color: var(--border-glow);
  background: var(--card);
}

.recent-play-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.recent-play-info { flex: 1; min-width: 0; }
.recent-play-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-play-meta { font-size: 0.82rem; color: var(--muted); font-style: italic; }
.recent-play-date { font-family: var(--font-display); font-size: 0.68rem; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════
   COLLECTION PAGE
═══════════════════════════════════════════════════════════ */

.collection-filters {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 2rem;
  padding: 1.2rem;
  background-image: url('/images/oak_tree.png');
  background-size: 500px auto;
  background-color: var(--surface);
  background-blend-mode: multiply;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 140px;
}

.filter-group label { font-size: 0.62rem; }

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
}

.game-card {
  background-image: url('/images/oak_tree.png');
  background-size: 400px auto;
  background-color: var(--card);
  background-blend-mode: multiply;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.game-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow), 0 0 30px rgba(201,146,42,0.15);
  transform: translateY(-3px);
}

.game-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--surface);
  display: block;
}

.game-card-body { padding: 1rem; }

.game-card-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--parchment);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.game-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.game-card-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.game-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.complexity-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.4rem;
}
.complexity-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #2d6e3c, #c9922a, #8b2020);
  transition: width 0.5s ease;
}

/* ═══════════════════════════════════════════════════════════
   GAME DETAIL PAGE
═══════════════════════════════════════════════════════════ */

.game-hero {
  position: relative;
  height: 360px;
  overflow: hidden;
}

.game-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  filter: brightness(0.35) saturate(0.8);
}

.game-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 30%, var(--bg) 100%);
}

.game-hero-content {
  position: absolute;
  bottom: 2rem;
  left: 2rem;
  right: 2rem;
  max-width: 1280px;
  margin: 0 auto;
}

.game-hero-title {
  font-family: var(--font-deco);
  font-size: clamp(1.8rem, 5vw, 3.5rem);
  color: var(--parchment);
  text-shadow: 0 2px 20px rgba(0,0,0,0.8), 0 0 40px rgba(201,146,42,0.3);
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.game-info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.game-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.game-info-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-info-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-light);
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  padding-bottom: 4rem;
}

.game-description {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #e8d5a8;
  background-image: url('/images/parchment_paper.png');
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  padding: 1.8rem 2rem;
  position: relative;
  margin-bottom: 1.5rem;
}
.game-description::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 5, 0, 0.50);
  border-radius: var(--radius-lg);
  z-index: 0;
}
.game-description > * { position: relative; z-index: 1; }

.game-sidebar { display: flex; flex-direction: column; gap: 1.2rem; }

.sidebar-card {
  background-image: url('/images/oak_tree.png');
  background-size: 350px auto;
  background-color: var(--card);
  background-blend-mode: multiply;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
}

.sidebar-card-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.8rem;
}

/* Player win stats */
.win-bar-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.win-bar-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--parchment-dim);
  width: 80px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.win-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.win-bar-count {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 32px;
  text-align: right;
}

/* YouTube embed */
.youtube-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.youtube-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Tags */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  background: rgba(201,146,42,0.08);
  border: 1px solid var(--border);
  color: var(--muted);
}

/* Session history */
.session-item {
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.session-date {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  margin-bottom: 0.4rem;
}
.session-players {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.session-player {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--parchment-dim);
}
.session-player.winner {
  color: var(--gold-light);
  font-weight: 600;
}
.winner-crown { font-size: 0.8rem; }

/* ═══════════════════════════════════════════════════════════
   ADD GAME PAGE
═══════════════════════════════════════════════════════════ */

.add-game-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
}

.bgg-search-box {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.bgg-search-box input { flex: 1; }

.bgg-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.bgg-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.bgg-result-item:hover, .bgg-result-item.selected {
  border-color: var(--gold);
  background: rgba(201,146,42,0.06);
}

.bgg-result-item.selected { border-color: var(--gold); }

.bgg-result-name {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--parchment);
}
.bgg-result-year { font-size: 0.82rem; color: var(--muted); font-style: italic; }

/* Preview card */
.game-preview {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: none;
}
.game-preview.visible { display: block; }

.game-preview-header {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
}

.game-preview-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.game-preview-info h2 {
  font-size: 1.3rem;
  color: var(--gold-light);
  margin-bottom: 0.3rem;
}

.game-preview-body { padding: 1.5rem; }
.game-preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.preview-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}
.preview-stat-label {
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}
.preview-stat-value {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-light);
  margin-top: 0.1rem;
}

/* Confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background-image: url('/images/oak_tree.png');
  background-size: 400px auto;
  background-color: var(--card);
  background-blend-mode: multiply;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow), var(--glow-gold);
  transform: scale(0.95);
  transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal h3 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

.modal p {
  color: var(--parchment-dim);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   LOG PAGE
═══════════════════════════════════════════════════════════ */

.log-form {
  background-image: url('/images/oak_tree.png');
  background-size: 500px auto;
  background-color: var(--card);
  background-blend-mode: multiply;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.participants-section { margin: 1rem 0; }

.participant-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.participant-row:last-child { border-bottom: none; }

.participant-check {
  accent-color: var(--gold);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.participant-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--parchment-dim);
  flex: 1;
}

.winner-toggle {
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  transition: all var(--transition);
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}
.winner-toggle.active {
  background: rgba(201,146,42,0.15);
  border-color: var(--gold);
  color: var(--gold-light);
}

.log-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.log-entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1rem;
  align-items: start;
}

.log-date-col {
  text-align: right;
  padding-top: 0.8rem;
}
.log-date-day {
  font-family: var(--font-deco);
  font-size: 2rem;
  color: var(--gold);
  line-height: 1;
}
.log-date-mon {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.log-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.log-card:hover { border-color: var(--border-glow); }

.log-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: rgba(0,0,0,0.3);
  cursor: pointer;
}

.log-card-thumb {
  width: 36px; height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.log-card-game {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--parchment);
}

.log-card-body { padding: 0.8rem 1rem; }

/* ═══════════════════════════════════════════════════════════
   STATS PAGE
═══════════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.leaderboard { display: flex; flex-direction: column; gap: 0.5rem; }

.leader-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.leader-row:first-child {
  background: linear-gradient(135deg, rgba(201,146,42,0.12), transparent);
  border-color: var(--gold-dim);
}

.leader-rank {
  font-family: var(--font-deco);
  font-size: 1.3rem;
  color: var(--gold-dim);
  min-width: 28px;
  text-align: center;
}
.leader-row:first-child .leader-rank { color: var(--gold-light); }

.leader-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.leader-name {
  flex: 1;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--parchment);
}

.leader-wins {
  font-family: var(--font-deco);
  font-size: 1.3rem;
  color: var(--gold);
}

.leader-rate {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════ */

footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .nav-inner { padding: 0 1rem; }
  .container { padding: 0 1rem; }

  .game-layout { grid-template-columns: 1fr; }
  .game-hero { height: 240px; }
  .game-hero-title { font-size: 1.8rem; }

  .log-entry { grid-template-columns: 1fr; }
  .log-date-col { display: none; }

  .hero h1 { font-size: 2.2rem; }
  .dice-controls { gap: 0.6rem; }
  .dice-control-group { min-width: 80px; }
  .die-wrapper { width: 110px; height: 110px; }
  .die-face { width: 110px; height: 110px; }
  .die-face-front  { transform: translateZ(55px); background-image: url('/images/dice/dice_6.png'); }
  .die-face-back   { transform: rotateY(180deg) translateZ(55px); background-image: url('/images/dice/dice_1.png'); }
  .die-face-right  { transform: rotateY(90deg)  translateZ(55px); background-image: url('/images/dice/dice_2.png'); }
  .die-face-left   { transform: rotateY(-90deg) translateZ(55px); background-image: url('/images/dice/dice_3.png'); }
  .die-face-top    { transform: rotateX(90deg)  translateZ(55px); background-image: url('/images/dice/dice_4.png'); }
  .die-face-bottom { transform: rotateX(-90deg) translateZ(55px); background-image: url('/images/dice/dice_5.png'); }

  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: 1fr; }
  .nav-links { gap: 0; }
  .nav-link { padding: 0.4rem 0.5rem; font-size: 0.68rem; }
}
