/* ==========================================================================
   SAND HORDE: SURVIVOR — OFFICIAL ONE-PAGE GAME MANUAL STYLESHEET
   Aesthetics: Clean Tactical Documentation, Cyberpunk Amber & Slate
   ========================================================================== */

:root {
  --man-bg: #090d16;
  --man-sidebar-bg: #0f172a;
  --man-card-bg: rgba(15, 23, 42, 0.7);
  --man-border: rgba(217, 119, 6, 0.25);
  --man-amber: #f59e0b;
  --man-amber-dark: #d97706;
  --man-cyan: #06b6d4;
  --man-emerald: #10b981;
  --man-crimson: #ef4444;
  --man-text: #f8fafc;
  --man-text-muted: #94a3b8;
  --man-text-dim: #64748b;
  --man-key-bg: #1e293b;
  --man-key-border: #475569;
  --man-font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --man-font-display: 'Rajdhani', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --man-font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.manual-page {
  background-color: var(--man-bg);
  color: var(--man-text);
  font-family: var(--man-font-body);
  line-height: 1.65;
  padding-top: 72px; /* space for fixed top bar */
}

/* Fixed Header / Action Bar */
.manual-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: rgba(11, 16, 26, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--man-border);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--man-font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  color: var(--man-text-muted);
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.back-btn:hover {
  color: var(--man-amber);
  border-color: var(--man-amber);
  background: rgba(30, 41, 59, 0.9);
}

.manual-title-badge {
  font-family: var(--man-font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.manual-title-badge span {
  color: var(--man-amber);
  font-size: 0.8rem;
  font-family: var(--man-font-mono);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* Search Bar */
.search-container {
  position: relative;
  width: 380px;
}

.search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--man-border);
  border-radius: 20px;
  padding: 0.5rem 1.2rem 0.5rem 2.4rem;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.25s ease;
}

.search-input:focus {
  border-color: var(--man-amber);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.35);
  background: rgba(15, 23, 42, 1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--man-text-dim);
  font-size: 0.9rem;
  pointer-events: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.action-btn {
  font-family: var(--man-font-display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  padding: 0.45rem 1.1rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

.btn-pdf {
  background: rgba(217, 119, 6, 0.15);
  border: 1px solid var(--man-amber-dark);
  color: var(--man-amber);
}

.btn-pdf:hover {
  background: var(--man-amber);
  color: #000;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.btn-print {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-print:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: #94a3b8;
}

/* Manual Layout Grid */
.manual-wrapper {
  display: grid;
  grid-template-columns: 290px 1fr;
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
}

/* Sidebar Navigation */
.manual-sidebar {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 2rem 1.2rem;
  background: rgba(15, 23, 42, 0.6);
  border-right: 1px solid rgba(217, 119, 6, 0.15);
}

.manual-sidebar::-webkit-scrollbar {
  width: 5px;
}
.manual-sidebar::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 6, 0.3);
  border-radius: 3px;
}

.sidebar-heading {
  font-family: var(--man-font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--man-amber);
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-left: 0.6rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toc-link {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--man-text-muted);
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: #ffffff;
  background: rgba(30, 41, 59, 0.7);
  padding-left: 0.95rem;
}

.toc-link.active {
  color: var(--man-amber);
  background: rgba(245, 158, 11, 0.12);
  border-left-color: var(--man-amber);
  font-weight: 700;
}

/* Manual Content */
.manual-content {
  padding: 3rem 4rem 8rem;
  max-width: 1050px;
}

.manual-hero {
  border-bottom: 1px solid var(--man-border);
  padding-bottom: 2.5rem;
  margin-bottom: 3.5rem;
}

.manual-hero h1 {
  font-size: 3rem;
  color: #fff;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff, var(--man-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.manual-hero-sub {
  font-family: var(--man-font-mono);
  font-size: 0.92rem;
  color: var(--man-amber);
  margin-bottom: 1.2rem;
}

.manual-hero-desc {
  color: var(--man-text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Section Formatting */
.man-section {
  margin-bottom: 4rem;
  scroll-margin-top: 90px;
}

.man-section-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  border-bottom: 2px solid rgba(217, 119, 6, 0.25);
  padding-bottom: 0.6rem;
  margin-bottom: 1.8rem;
}

.man-sec-num {
  font-family: var(--man-font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--man-amber);
}

.man-sec-title {
  font-size: 1.85rem;
  color: #fff;
}

.man-subheading {
  font-size: 1.25rem;
  color: #e2e8f0;
  margin: 1.8rem 0 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.man-subheading::before {
  content: '▸';
  color: var(--man-amber);
}

.man-paragraph {
  color: #cbd5e1;
  font-size: 0.98rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.man-list {
  list-style: none;
  margin: 1rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.man-list li {
  position: relative;
  padding-left: 1.4rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.6;
}

.man-list li::before {
  content: '•';
  position: absolute;
  left: 0.3rem;
  color: var(--man-amber);
  font-weight: bold;
}

/* Key Badges */
.key-badge {
  display: inline-block;
  font-family: var(--man-font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #fbbf24;
  background: #1e293b;
  border: 1px solid #475569;
  border-bottom-width: 2px;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  vertical-align: baseline;
}

/* Clean Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border-radius: 8px;
  border: 1px solid rgba(217, 119, 6, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.man-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  text-align: left;
  background: var(--man-card-bg);
}

.man-table th {
  background: #0f172a;
  color: #f8fafc;
  font-family: var(--man-font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(217, 119, 6, 0.3);
  text-transform: uppercase;
}

.man-table td {
  padding: 0.8rem 1.1rem;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.man-table tr:nth-child(even) td {
  background: rgba(30, 41, 59, 0.35);
}

.man-table tr:hover td {
  background: rgba(245, 158, 11, 0.06);
}

.man-table-action {
  font-weight: 700;
  color: #ffffff;
}

/* Callout Boxes */
.man-callout {
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  margin: 1.6rem 0;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  font-size: 0.94rem;
  line-height: 1.6;
}

.callout-warning {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--man-crimson);
  color: #fca5a5;
}

.callout-warning strong {
  color: #ffffff;
}

.callout-alert {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--man-amber);
  color: #fde68a;
}

.callout-info {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid var(--man-cyan);
  color: #bae6fd;
}

.callout-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Highlight for search match */
.search-highlight {
  background: rgba(245, 158, 11, 0.4);
  color: #ffffff;
  padding: 0 2px;
  border-radius: 2px;
}

.section-hidden {
  display: none !important;
}

/* Floating Back To Top Button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--man-amber);
  color: #0b0f19;
  border: none;
  font-size: 1.3rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 990;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-4px);
  background: #fbbf24;
}

/* Print Styles */
@media print {
  body.manual-page {
    background: #ffffff !important;
    color: #000000 !important;
    padding-top: 0 !important;
  }
  .manual-topbar, .manual-sidebar, .back-to-top {
    display: none !important;
  }
  .manual-wrapper {
    display: block !important;
  }
  .manual-content {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .man-table {
    border: 1px solid #333 !important;
    color: #000 !important;
    background: none !important;
  }
  .man-table th {
    background: #e2e8f0 !important;
    color: #000 !important;
  }
  .man-table td {
    color: #000 !important;
    border-bottom: 1px solid #ddd !important;
  }
  .key-badge {
    background: #f1f5f9 !important;
    color: #000 !important;
    border: 1px solid #94a3b8 !important;
  }
  .man-callout {
    background: #f8fafc !important;
    border: 1px solid #333 !important;
    color: #000 !important;
  }
}

/* Responsive */
@media (max-width: 1100px) {
  .manual-content { padding: 2rem 2rem 6rem; }
  .search-container { width: 280px; }
}

@media (max-width: 860px) {
  .manual-wrapper { grid-template-columns: 1fr; }
  .manual-sidebar { display: none; }
  .search-container { width: 200px; }
  .btn-print { display: none; }
  .manual-topbar { padding: 0 1rem; }
}
