:root {
  --bg: #0B0C10;
  --surface: #1F2833;
  --surface-light: #121824;
  --accent-cyan: #00F0FF;
  --accent-green: #39FF14;
  --accent-pink: #FF007F;
  --accent-red: #FF3B30;
  --accent-purple: #ED57FF;
  --accent-teal: #45A29E;
  --text: #C5C6C7;
  --text-bright: #FFFFFF;
  --text-dim: #6B7280;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 60px 20px 40px;
  border-bottom: 1px solid rgba(0,240,255,0.2);
  background: linear-gradient(180deg, rgba(0,240,255,0.05) 0%, transparent 100%);
}
.hero h1 {
  font-size: 2.2rem;
  color: var(--accent-cyan);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.hero p {
  color: var(--accent-teal);
  font-style: italic;
  font-size: 1rem;
}
.hero .version {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.hero .back-home {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 22px;
  border: 1px solid var(--accent-green);
  border-radius: 999px;
  color: var(--accent-green);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.hero .back-home:hover {
  background: var(--accent-green);
  color: #000;
}

/* Table of Contents */
.toc {
  background: var(--surface);
  border: 1px solid rgba(0,240,255,0.3);
  border-radius: 12px;
  padding: 24px 30px;
  margin: 30px 0;
}
.toc h2 {
  color: var(--accent-cyan);
  font-size: 1.1rem;
  margin-bottom: 14px;
  font-weight: 700;
}
.toc ol {
  list-style: none;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
  padding: 6px 0;
}
.toc li::before {
  content: counter(toc) ".";
  color: var(--accent-cyan);
  font-weight: 700;
  margin-right: 10px;
}
.toc a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}
.toc a:hover { color: var(--accent-cyan); }

/* Sections */
section {
  padding: 40px 0;
  border-bottom: 1px solid rgba(31,40,51,0.8);
}
section:last-child { border-bottom: none; }
section h2 {
  color: var(--accent-cyan);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
section h2 .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,240,255,0.1);
  border: 1px solid var(--accent-cyan);
  font-size: 0.9rem;
  flex-shrink: 0;
}
section h3 {
  color: var(--accent-green);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}
section p {
  margin-bottom: 12px;
  color: var(--text);
}
section ul, section ol {
  margin: 10px 0 16px 24px;
}
section li {
  margin-bottom: 6px;
}
section strong {
  color: var(--text-bright);
}
section code {
  background: var(--surface-light);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  overflow-wrap: break-word;
  word-break: break-all;
}

/* Callout boxes */
.callout {
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 0.92rem;
}
.callout-info {
  background: rgba(0,240,255,0.08);
  border: 1px solid rgba(0,240,255,0.3);
}
.callout-info strong { color: var(--accent-cyan); }
.callout-warning {
  background: rgba(255,59,48,0.08);
  border: 1px solid rgba(255,59,48,0.3);
}
.callout-warning strong { color: var(--accent-red); }
.callout-tip {
  background: rgba(57,255,20,0.06);
  border: 1px solid rgba(57,255,20,0.25);
}
.callout-tip strong { color: var(--accent-green); }

/* Screenshot placeholders */
.screenshot-placeholder {
  width: 100%;
  min-height: 200px;
  border: 2px dashed rgba(0,240,255,0.25);
  border-radius: 12px;
  background: rgba(0,240,255,0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  padding: 30px;
  text-align: center;
}
.screenshot-placeholder .icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: 0.4;
}
.screenshot-placeholder .label {
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.screenshot-placeholder .hint {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 6px;
}
.screenshot-placeholder img {
  max-width: 100%;
  border-radius: 8px;
}

/* Platform Table Responsive Grid */
.platform-table-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 16px 0;
}
@media (min-width: 768px) {
  .platform-table-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.platform-table-grid table {
  margin: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}
th {
  background: var(--surface-light);
  color: var(--accent-cyan);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--accent-cyan);
  font-weight: 600;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(31,40,51,0.5);
}
tr:hover td { background: rgba(0,240,255,0.03); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-locked { background: rgba(255,59,48,0.15); color: var(--accent-red); border: 1px solid var(--accent-red); }
.badge-timed { background: rgba(245,158,11,0.15); color: #F59E0B; border: 1px solid #F59E0B; }
.badge-allowed { background: rgba(148,163,184,0.1); color: #94A3B8; border: 1px solid #64748B; }

/* Footer */
.footer {
  text-align: center;
  padding: 40px 20px 100px 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid rgba(31,40,51,0.8);
}
.footer .back-home {
  display: inline-block;
  margin-bottom: 16px;
  padding: 8px 22px;
  border: 1px solid var(--accent-green);
  border-radius: 999px;
  color: var(--accent-green);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.footer .back-home:hover {
  background: var(--accent-green);
  color: #000;
}
.footer a {
  color: var(--accent-cyan);
  text-decoration: none;
  overflow-wrap: break-word;
  word-break: break-all;
}

/* Scroll-to-Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  background-color: var(--surface);
  color: var(--accent-cyan);
  border: 2px solid var(--accent-green);
  border-radius: 9999px;
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.25rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}
.scroll-top-btn:hover {
  background-color: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 20px var(--accent-cyan);
  transform: translateY(-2px);
}
.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Quick Nav */
.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}
.quick-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid rgba(0,240,255,0.2);
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.quick-nav a:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Tablet & small phone */
@media (max-width: 640px) {
  .hero { padding: 40px 16px 30px; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.9rem; }
  .container { padding: 0 16px; }
  section { padding: 28px 0; }
  section h2 { font-size: 1.25rem; gap: 8px; }
  section h2 .num { width: 30px; height: 30px; font-size: 0.8rem; }
  section h3 { font-size: 1rem; }
  section ul, section ol { margin-left: 18px; }
  .toc { padding: 18px 20px; margin: 20px 0; }
  .callout { padding: 14px 16px; font-size: 0.85rem; }
  .screenshot-placeholder { min-height: 140px; padding: 20px; }
  .screenshot-placeholder .icon { font-size: 2rem; }
  .quick-nav a { padding: 5px 10px; font-size: 0.75rem; }
  .scroll-top-btn { bottom: 1rem; right: 1rem; width: 2.25rem; height: 2.25rem; font-size: 1rem; }
  .footer { padding: 30px 16px; }
  table { font-size: 0.82rem; }
  th, td { padding: 8px 10px; }
}

/* Very narrow phones (~6cm / ~240px) */
@media (max-width: 380px) {
  .hero { padding: 30px 12px 24px; }
  .hero h1 { font-size: 1.35rem; letter-spacing: 0.5px; }
  .hero p { font-size: 0.82rem; }
  .hero .version { font-size: 0.72rem; }
  .container { padding: 0 12px; }
  section { padding: 22px 0; }
  section h2 { font-size: 1.1rem; gap: 6px; }
  section h2 .num { width: 26px; height: 26px; font-size: 0.72rem; }
  section h3 { font-size: 0.92rem; margin-top: 18px; }
  section p { font-size: 0.88rem; line-height: 1.6; }
  section ul, section ol { margin-left: 14px; }
  section li { font-size: 0.88rem; margin-bottom: 5px; }
  section code { font-size: 0.82em; padding: 1px 5px; overflow-wrap: break-word; word-break: break-all; }
  .toc { padding: 14px 14px; margin: 16px 0; }
  .toc h2 { font-size: 1rem; margin-bottom: 10px; }
  .toc li { padding: 5px 0; font-size: 0.85rem; }
  .toc li::before { margin-right: 6px; }
  .callout { padding: 12px 12px; font-size: 0.8rem; margin: 12px 0; }
  .screenshot-placeholder { min-height: 100px; padding: 14px; }
  .screenshot-placeholder .icon { font-size: 1.6rem; }
  .screenshot-placeholder .label { font-size: 0.75rem; }
  .screenshot-placeholder .hint { font-size: 0.68rem; }
  .quick-nav { gap: 6px; margin: 14px 0; }
  .quick-nav a { padding: 4px 8px; font-size: 0.7rem; gap: 4px; }
  .scroll-top-btn { bottom: 0.75rem; right: 0.75rem; width: 2rem; height: 2rem; font-size: 0.875rem; }
  .footer { padding: 24px 12px 100px 12px; font-size: 0.78rem; }
  .footer p { font-size: 0.78rem; }
  table { font-size: 0.76rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 6px 8px; }
  .badge { font-size: 0.68rem; padding: 2px 7px; }
}
  
.guide-link-cyan { color: #00F0FF; font-weight: bold; }
.guide-link-green { color: #39FF14; }

/* Guide-specific helpers */
.guide-logo { height: 80px; width: auto; margin: 0 auto 20px; display: block; }
.guide-disclaimer { display: none; margin: 16px auto; max-width: 600px; text-align: center; }
.guide-disclaimer-visible { display: block; margin: 16px auto; max-width: 600px; text-align: center; }
.guide-lang-select { background: #0B0C10; border: 1px solid #1F2833; border-radius: 9999px; padding: 6px 14px; font-family: monospace; font-size: 0.75rem; color: #C5C6C7; outline: none; }
.guide-margin-top { margin-top: 16px; }
.guide-margin-top-sm { margin-top: 8px; }
.guide-text-center { text-align: center; }
.guide-dashboard-link { font-size: 1.1rem; padding: 10px 20px; display: inline-block; max-width: 100%; overflow-wrap: break-word; word-break: break-all; }
.guide-heartbeat-ok { border-color: #10B981; color: #10B981; background: rgba(16, 185, 129, 0.1); }
.guide-footer-fine { margin-top: 8px; font-size: 0.7rem; color: #666; }

/* Custom Language Dropdown */
.lang-dropdown-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(11, 12, 16, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
}
.lang-dropdown-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}
.lang-dropdown-container { position: relative; display: inline-block; z-index: 50; }
.lang-dropdown-btn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.lang-flag-img { height: 14px; width: 21px; border-radius: 2px; border: 1px solid #1F2833; object-fit: cover; display: inline-block; vertical-align: middle; }
.lang-flag-img-menu { height: 16px; width: 24px; border-radius: 2px; border: 1px solid #1F2833; object-fit: cover; display: inline-block; vertical-align: middle; }
.lang-chevron { transition: transform 0.2s; }
.lang-dropdown-menu { position: absolute; right: 0; top: 100%; margin-top: 8px; min-width: 180px; max-height: 320px; overflow-y: auto; border: 1px solid #1F2833; background: #0B0C10; border-radius: 12px; padding: 4px 0; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6); z-index: 9999; display: none; }
.lang-dropdown-menu.open { display: block; }
.lang-dropdown-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 16px; text-align: left; font-family: monospace; font-size: 0.75rem; background: none; border: none; cursor: pointer; color: #C5C6C7; transition: background 0.15s; }
.lang-dropdown-item:hover { background: #1F2833; }
.lang-dropdown-item.active { color: #00F0FF; }
.lang-dropdown-btn.open .lang-chevron { transform: rotate(180deg); }

/* ── Cookie Consent Modal CSP-safe Styles ── */
#lmg-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 16px;
}
#lmg-cookie-modal.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}
#lmg-cookie-modal.active .lmg-cookie-box {
  transform: translateY(0) !important;
}
.lmg-cookie-box {
  background: #0B0C10;
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  padding: 32px 28px;
  color: #C5C6C7;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 0 40px rgba(0, 240, 255, 0.15);
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.lmg-cookie-title-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.lmg-cookie-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #00F0FF;
  letter-spacing: 0.5px;
}
.lmg-cookie-desc {
  margin: 0 0 14px;
  color: #C5C6C7;
}
.lmg-cookie-desc a {
  color: #00F0FF;
  text-decoration: underline;
}
#lmg-prefs {
  display: none;
  margin-bottom: 18px;
}
.lmg-pref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(31, 40, 51, 0.6);
  cursor: default;
}
.lmg-pref-row-last {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  cursor: pointer;
}
.lmg-pref-checkbox {
  accent-color: #39FF14;
  width: 18px;
  height: 18px;
}
.lmg-pref-label {
  color: #fff;
}
.lmg-cookie-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
#lmg-accept {
  flex: 1;
  min-width: 130px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid #39FF14;
  background: #39FF14;
  color: #000;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
#lmg-accept:hover {
  background: #2ce30d;
  border-color: #2ce30d;
}
#lmg-reject {
  flex: 1;
  min-width: 130px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid #6B7280;
  background: transparent;
  color: #C5C6C7;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
#lmg-reject:hover {
  background: #6B7280;
  color: #000;
}
.lmg-manage-container {
  text-align: center;
  margin-top: 12px;
}
#lmg-manage {
  background: none;
  border: none;
  color: #00F0FF;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}
#lmg-cookie-reopen {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 2147483645;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 240, 255, 0.3);
  background: #0B0C10;
  color: #6B7280;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  cursor: pointer;
  transition: all 0.2s;
}
#lmg-cookie-reopen:hover {
  color: #00F0FF;
  border-color: #00F0FF;
}
