/* Manual: oxblood/charcoal, parchment panels, sticky nav, accordions, timeline */

.manual-section {
  display: none;
  flex-direction: column;
  background: #140b0d;
  color: #efe6d8;
  min-height: 100vh;
  overflow: hidden;
}
.manual-section.active {
  display: flex !important;
}

/* Subtle repeating pattern (gears/crowns) */
.manual-section::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' opacity='0.03'%3E%3Cpath fill='%23c79a3a' d='M20 4l2 6 6 2-6 2-2 6-2-6-6-2 6-2 2-6z'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.manual-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
}

/* Sticky left nav - desktop */
.manual-nav {
  flex-shrink: 0;
  width: 200px;
  padding-right: 24px;
  position: sticky;
  top: 20px;
  height: fit-content;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.manual-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.manual-nav a {
  display: block;
  padding: 8px 12px;
  color: #cdbfae;
  text-decoration: none;
  font-size: 13px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.manual-nav a:hover,
.manual-nav a.active {
  background: rgba(255,255,255,0.06);
  color: #efe6d8;
}
.manual-nav-toggle {
  display: none;
  margin-bottom: 12px;
  padding: 10px 14px;
  width: 100%;
}

/* Mobile: collapsible nav */
@media (max-width: 768px) {
  .manual-layout {
    flex-direction: column;
    gap: 0;
    min-height: 0;
  }
  .manual-nav {
    width: 100%;
    position: relative;
    max-height: none;
    flex-shrink: 0;
    background: #140b0d;
    border-bottom: 1px solid #3a2328;
    padding-bottom: 12px;
    margin-bottom: 0;
  }
  .manual-nav.collapsed ul {
    display: none;
  }
  .manual-nav-toggle {
    display: block;
  }
  .manual-content {
    flex: 1;
    min-height: 0;
    padding-top: 40px;
  }
}

/* Parchment panels */
.manual-content {
  flex: 1;
  min-height: 0; /* allow flex shrink so nav + content don't overlap on mobile */
  padding-bottom: 60px;
  overflow-y: auto;
  max-height: calc(100vh - 56px);
}
.manual-panel {
  background: linear-gradient(180deg, rgba(239,230,216,0.08), rgba(239,230,216,0.04));
  border: 1px solid #3a2328;
  border-radius: 18px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.manual-panel h2 {
  margin: 0 0 14px 0;
  font-size: 18px;
  letter-spacing: 0.06em;
  color: #c79a3a;
  border-bottom: 1px solid #3a2328;
  padding-bottom: 10px;
}
.manual-panel h3 {
  margin: 16px 0 8px 0;
  font-size: 15px;
  color: #efe6d8;
}
.manual-panel p {
  margin: 0 0 10px 0;
  line-height: 1.55;
  font-size: 14px;
}
.manual-panel ul {
  margin: 0 0 12px 0;
  padding-left: 20px;
}

/* Rule chips */
.manual-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}
.manual-chip.damage { background: rgba(177,18,38,0.3); border: 1px solid #b11226; color: #ffb4bf; }
.manual-chip.resource { background: rgba(199,154,58,0.2); border: 1px solid #c79a3a; color: #e8d4a0; }
.manual-chip.health { background: rgba(31,107,58,0.25); border: 1px solid #1f6b3a; color: #8fdc9e; }

/* Glossary tooltip */
.manual-glossary {
  cursor: help;
  border-bottom: 1px dotted #c79a3a;
  text-decoration: none;
  color: inherit;
}

/* Accordion */
.manual-accordion {
  border: 1px solid #3a2328;
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}
.manual-accordion summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  background: rgba(0,0,0,0.2);
  list-style: none;
}
.manual-accordion summary::-webkit-details-marker { display: none; }
.manual-accordion summary::after { content: " +"; float: right; }
.manual-accordion[open] summary::after { content: " −"; }
.manual-accordion .accordion-body {
  padding: 12px 16px;
  border-top: 1px solid #3a2328;
  font-size: 14px;
  line-height: 1.5;
}

/* Timeline */
.manual-timeline {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid #3a2328;
  margin: 16px 0;
}
.manual-timeline .timeline-step {
  position: relative;
  margin-bottom: 20px;
}
.manual-timeline .timeline-step::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c79a3a;
}
.manual-timeline .timeline-step h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: #c79a3a;
}
.manual-timeline .timeline-step p {
  margin: 0;
  font-size: 13px;
}

/* Rules Court panel */
.manual-rules-court {
  background: rgba(177,18,38,0.08);
  border: 1px solid rgba(177,18,38,0.4);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 16px 0;
}

/* Coin legend */
.manual-board-img {
  display: block;
  width: 100%;
  max-width: 400px;
  height: auto;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid #3a2328;
}

.manual-coin-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.manual-coin-legend .coin {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.manual-coin-legend .coin-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Top bar: progress, print, go to scanner */
.manual-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid #3a2328;
  position: sticky;
  top: 0;
  z-index: 10;
}
.manual-progress {
  font-size: 13px;
  color: #cdbfae;
}
.manual-topbar .row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Section anchor for copy link */
.manual-panel h2 .copy-link {
  font-size: 12px;
  margin-left: 8px;
  opacity: 0.7;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

@media (prefers-reduced-motion: no-preference) {
  .manual-nav a { transition: background 0.2s, color 0.2s; }
  .manual-panel { transition: opacity 0.2s; }
}
@media (prefers-reduced-motion: reduce) {
  .manual-nav a,
  .manual-panel { transition: none; }
}

/* Print */
@media print {
  body * { visibility: hidden; }
  .manual-section.active,
  .manual-section.active * { visibility: visible; }
  .manual-section.active {
    position: absolute;
    inset: 0;
    background: #fff;
    color: #111;
  }
  .manual-section.active .manual-topbar,
  .manual-section.active .manual-nav,
  .manual-section.active .btn { display: none !important; }
  .manual-section.active .manual-panel {
    background: #f8f6f0;
    border-color: #ccc;
    break-inside: avoid;
  }
  .manual-section.active .manual-chip.damage { background: #fdd; border-color: #b11226; color: #600; }
  .manual-section.active .manual-chip.resource { background: #ffc; border-color: #c79a3a; color: #630; }
  .manual-section.active .manual-chip.health { background: #dfd; border-color: #1f6b3a; color: #063; }
}
