:root {
  --bg-primary: #0f2419;
  --bg-surface: #183626;
  --bg-wood: #3d2619;
  --text-primary: #f6f8f4;
  --text-secondary: #c9ddd1;
  --accent-primary: #f2c44e;
  --accent-ruby: #8f1d28;
  --accent-crimson-hi: #cf3445;
  --border-wood: #5c3d28;
  --font-craft-head: 'Constantia', 'Palatino', serif;
  --font-craft-body: 'Candara', 'Segoe UI', sans-serif;
  --font-craft-mono: 'Cascadia Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg-primary);
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(92, 61, 40, 0.16) 0 3px,
      transparent 3px 38px
    ),
    radial-gradient(circle at 18% 12%, rgba(242, 196, 78, 0.12), transparent 36%),
    linear-gradient(180deg, #0f2419 0%, #091710 100%);
  color: var(--text-primary);
  font-family: var(--font-craft-body);
  line-height: 1.55;
  overflow-x: clip;
}

.ambient-lights {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.skip-craft {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-primary);
  color: #0f2419;
  padding: 0.6rem 1rem;
  font-weight: 700;
  z-index: 200;
}

.skip-craft:focus {
  left: 1rem;
  top: 1rem;
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Barra superior de madera tallada */
.timber-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #4b2f1f 0%, #362115 100%);
  border-bottom: 3px solid var(--accent-primary);
  box-shadow: 0 8px 22px rgba(4, 12, 8, 0.45);
}

.timber-inner {
  width: min(1240px, 94vw);
  margin: 0 auto;
  padding: 0.7rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.craft-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brass-emblem {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
}

.craft-brand {
  display: block;
  font-family: var(--font-craft-head);
  font-size: 1.18rem;
  color: var(--accent-primary);
}

.craft-tag {
  display: block;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.wood-pins-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pin-link {
  text-decoration: none;
  color: var(--text-primary);
  background: rgba(15, 36, 25, 0.72);
  border: 1px solid var(--border-wood);
  border-radius: 999px;
  padding: 0.36rem 0.8rem;
  font-size: 0.86rem;
  font-weight: 700;
  transition: border-color 0.2s, background-color 0.2s;
}

.pin-link:hover {
  border-color: var(--accent-primary);
  background: var(--bg-surface);
}

.timber-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.craft-meter {
  font-family: var(--font-craft-mono);
  font-size: 0.82rem;
  background: #132c1f;
  border: 1px solid var(--accent-primary);
  padding: 0.34rem 0.7rem;
  border-radius: 8px;
}

/* Botones artesanales */
.craft-btn-gold,
.craft-btn-ruby,
.craft-btn-forest,
.craft-btn-outline,
.craft-chip,
.wood-tab,
.station-note {
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  transition: transform 0.15s, background-color 0.18s, border-color 0.18s;
}

.craft-btn-gold {
  background: var(--accent-primary);
  color: #132219;
  border: 2px solid #fae096;
  padding: 0.56rem 1.05rem;
}

.craft-btn-gold:hover { transform: translateY(-2px); }

.craft-btn-ruby {
  background: var(--accent-ruby);
  color: #f6f8f4;
  border: 2px solid var(--accent-crimson-hi);
  padding: 0.54rem 1rem;
}

.craft-btn-forest {
  background: #235238;
  color: var(--text-primary);
  border: 2px solid #4d8a67;
  padding: 0.56rem 1.05rem;
}

.craft-btn-outline {
  background: rgba(15, 36, 25, 0.75);
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  padding: 0.54rem 1rem;
}

.craft-chip {
  background: #142d20;
  color: var(--text-primary);
  border: 1px solid #457057;
  padding: 0.45rem 0.82rem;
}

.craft-chip.is-on {
  background: var(--accent-primary);
  color: #132219;
  border-color: #fae096;
}

/* Tablero creativo principal */
.pegboard-main {
  position: relative;
  z-index: 2;
  width: min(1220px, 94vw);
  margin: 1.7rem auto 3rem;
  display: flex;
  flex-direction: column;
  gap: 2.1rem;
}

.wood-board-card {
  position: relative;
  background:
    linear-gradient(150deg, rgba(24, 54, 38, 0.96) 0%, rgba(16, 38, 26, 0.98) 100%);
  border: 3px solid var(--border-wood);
  box-shadow:
    0 20px 44px rgba(3, 10, 6, 0.55),
    inset 0 0 0 1px rgba(242, 196, 78, 0.22);
  border-radius: 18px;
  padding: 2rem 1.75rem 1.75rem;
}

.brass-pin {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff0ba, #b8841e);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
}

.wood-label {
  display: inline-block;
  font-family: var(--font-craft-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--accent-primary);
  background: var(--bg-wood);
  border: 1px solid var(--border-wood);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.55rem;
}

h1, h2, h3, h4 {
  font-family: var(--font-craft-head);
  margin: 0 0 0.6rem;
  line-height: 1.2;
}

h1 { font-size: clamp(1.95rem, 3.6vw, 2.9rem); }
h2 { font-size: clamp(1.42rem, 2.5vw, 2rem); }

.hero-board-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.8rem;
  align-items: center;
}

.hero-craft-lead {
  color: var(--text-secondary);
  font-size: 1.02rem;
  margin-bottom: 1.2rem;
}

.craft-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.center-craft-row {
  justify-content: center;
}

.craft-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.15rem;
}

.craft-badges span {
  background: var(--bg-wood);
  border: 1px dashed var(--accent-primary);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.84rem;
}

.pinned-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: start;
}

.pinned-photo {
  margin: 0;
  background: var(--bg-wood);
  border: 2px solid #755035;
  border-radius: 12px;
  padding: 0.45rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.pinned-photo.is-offset {
  margin-top: 1.2rem;
}

.pinned-photo img {
  width: 100%;
  height: 185px;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.pinned-photo figcaption {
  margin-top: 0.45rem;
  font-size: 0.82rem;
  color: #f3dfbb;
  text-align: center;
}

/* Cabecera de tablero */
.board-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

/* Cámara habitación real */
.room-cam-badge {
  font-family: var(--font-craft-mono);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-wood);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
}

.room-cam-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.4rem;
  align-items: start;
}

.room-viewport {
  position: relative;
  border: 3px solid var(--accent-primary);
  border-radius: 14px;
  overflow: hidden;
  background: #0a1811;
}

#roomCanvas {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 3;
}

.room-veil {
  position: absolute;
  inset: 0;
  background: rgba(10, 24, 17, 0.84);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
}

.room-veil[hidden] {
  display: none;
}

.craft-opt {
  margin-bottom: 0.95rem;
}

.craft-opt-label {
  display: block;
  font-family: var(--font-craft-mono);
  font-size: 0.76rem;
  color: var(--accent-primary);
  margin-bottom: 0.38rem;
}

.craft-feedback {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.9rem;
  background: #0f2419;
  border-left: 4px solid var(--accent-primary);
  border-radius: 8px;
  font-size: 0.9rem;
}

/* 9 Estaciones artesanales */
.station-spotlight-bar {
  background: var(--bg-wood);
  border: 2px solid #755035;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.1rem;
}

.station-spotlight-bar strong {
  display: block;
  font-family: var(--font-craft-head);
  font-size: 1.15rem;
  color: var(--accent-primary);
  margin-bottom: 0.25rem;
}

.station-spotlight-bar p {
  margin: 0;
  color: #f6ede0;
}

.nine-stations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.station-note {
  background: #122b1e;
  color: var(--text-primary);
  border: 2px solid #355d47;
  padding: 0.8rem 0.85rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.station-note span {
  font-family: var(--font-craft-mono);
  font-size: 0.76rem;
  color: var(--accent-primary);
}

.station-note small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.station-note.is-active {
  background: var(--accent-ruby);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

/* 4 Juegos artesanales */
.workbench-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.wood-tab {
  background: var(--bg-wood);
  color: var(--text-primary);
  border: 2px solid #6b472f;
  padding: 0.52rem 0.88rem;
}

.wood-tab.is-active {
  background: var(--accent-primary);
  color: #132219;
  border-color: #fae096;
}

.wood-tab.is-done {
  border-color: #63c78d;
}

.workbench-panel {
  background: #12291c;
  border: 2px solid #355e47;
  border-radius: 14px;
  padding: 1.3rem;
}

.bench-split {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 1.4rem;
  align-items: start;
}

.craft-canvas-holder {
  background: #0b1c13;
  border: 2px solid var(--border-wood);
  border-radius: 12px;
  padding: 0.8rem;
  text-align: center;
}

#treeCanvas,
#baubleCanvas,
#wreathCanvas {
  width: 100%;
  max-width: 380px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
  background: #10261b;
}

.canvas-tip {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.wreath-parts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-bottom: 0.95rem;
}

.order-ticket-box {
  background: var(--bg-wood);
  border: 2px dashed var(--accent-primary);
  border-radius: 14px;
  padding: 1.2rem;
}

.selected-recipe-pill {
  margin-top: 0.85rem;
  background: #13291d;
  border: 1px solid var(--accent-primary);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-craft-mono);
  font-size: 0.84rem;
  color: var(--accent-primary);
}

/* Placa final */
.trophy-board {
  text-align: center;
  border-color: var(--accent-primary);
  background: linear-gradient(165deg, #271a12 0%, #153122 100%);
}

.trophy-star {
  width: 60px;
  height: 60px;
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #132219;
  font-size: 1.9rem;
  display: grid;
  place-items: center;
}

.craft-checklist {
  list-style: none;
  padding: 0;
  margin: 1.15rem auto;
  max-width: 560px;
  text-align: left;
  display: grid;
  gap: 0.45rem;
}

.craft-checklist li {
  background: rgba(15, 36, 25, 0.85);
  border: 1px solid #3b694f;
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.craft-checklist li.is-complete {
  border-color: var(--accent-primary);
  color: #f9e8b2;
}

.craft-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1.4rem 1rem 2.4rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  border-top: 1px solid var(--border-wood);
}

/* Modal */
.craft-modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 12, 0.82);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 120;
}

.craft-modal-mask[hidden] {
  display: none;
}

.craft-modal-box {
  width: min(560px, 94vw);
  background: var(--bg-surface);
  border: 3px solid var(--accent-primary);
  border-radius: 16px;
  padding: 1.4rem;
}

.craft-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.craft-guide-ol {
  padding-left: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 1.15rem;
}

.craft-guide-ol li {
  margin-bottom: 0.55rem;
}

@media (max-width: 940px) {
  .hero-board-grid,
  .room-cam-grid,
  .bench-split {
    grid-template-columns: 1fr;
  }

  .nine-stations-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .pinned-gallery,
  .nine-stations-grid,
  .wreath-parts-grid {
    grid-template-columns: 1fr;
  }

  .pinned-photo.is-offset {
    margin-top: 0;
  }

  .wood-board-card {
    padding: 1.5rem 1.05rem 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
