:root {
  --zt-bg: #000;
  --zt-panel: #111;
  --zt-border: #2a2a2a;
  --zt-text: #fff;
  --zt-text-dim: #888;
  --zt-nav-h: 48px;
}

/* ============================================================
   SITE NAVIGATION
   ============================================================ */
.zt-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--zt-nav-h);
  background: rgba(0, 0, 0, 0.93);
  border-bottom: 1px solid var(--zt-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 9999;
  font-family: sans-serif;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.zt-nav a {
  color: var(--zt-text);
  text-decoration: none;
  font-size: 13pt;
  font-weight: 100;
  padding: 6px 16px;
  border-radius: 4px;
  transition: background 0.2s;
  white-space: nowrap;
  letter-spacing: 0.01em;
  /* Minimum touch target height */
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.zt-nav a:hover {
  background: rgba(255, 255, 255, 0.07);
  text-decoration: none;
}

.zt-nav .zt-brand {
  font-weight: bold;
  font-size: 14pt;
  margin-right: 6px;
}

.zt-nav .zt-sep {
  color: #333;
  font-size: 18pt;
  line-height: 1;
  user-select: none;
}

.zt-streak {
  display: none;
  align-items: center;
  gap: 3px;
  font-size: 11pt;
  font-weight: 600;
  color: #f6ad55;
  margin-right: 6px;
  white-space: nowrap;
  user-select: none;
}

@media (max-width: 768px) {
  .zt-streak { font-size: 10pt; margin-right: 4px; }
}

/* ── Nav links wrapper (desktop: inline; mobile: dropdown) ── */
.zt-nav-links {
  display: flex;
  align-items: center;
}

/* ── Mobile-only right-side controls (lang + hamburger) ── */
.zt-nav-mobile {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Hamburger button ── */
.zt-hamburger {
  display: none;
  background: none;
  border: 1px solid transparent;
  color: var(--zt-text-dim);
  font-size: 17px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.zt-hamburger:hover { color: var(--zt-text); }

/* ── Mobile nav (≤ 768 px) ── */
@media (max-width: 768px) {
  .zt-nav {
    justify-content: flex-start;
    padding: 0 12px;
    gap: 0;
    overflow: visible;
  }

  /* Collapse desktop links into a dropdown */
  .zt-nav-links {
    display: none;
    position: fixed;
    top: var(--zt-nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: rgba(0, 0, 0, 0.97);
    border-bottom: 1px solid var(--zt-border);
    padding: 6px 0 10px;
    z-index: 9998;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .zt-nav-links.open { display: flex; }

  .zt-nav-links .zt-sep { display: none; }

  .zt-nav-links a {
    padding: 11px 20px;
    font-size: 14pt;
    border-radius: 0;
  }

  /* Lang buttons hidden in dropdown — shown via .zt-nav-mobile */
  .zt-nav-links .zt-lang-btn { display: none; }

  /* Show the mobile-only strip */
  .zt-nav-mobile { display: flex; }
  .zt-hamburger  { display: flex; }
}

/* ============================================================
   PAGE WRAPPER (listing pages)
   ============================================================ */
.zt-page {
  background: var(--zt-bg);
  color: var(--zt-text);
  font-family: sans-serif;
  min-height: 100vh;
  padding-top: var(--zt-nav-h);
  padding-bottom: 60px;
}

/* ============================================================
   SECTION LABELS
   ============================================================ */
.zt-section-title {
  text-align: center;
  font-size: 11pt;
  font-weight: 100;
  color: var(--zt-text-dim);
  margin: 42px 0 16px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ============================================================
   "YOU MIGHT ALSO LIKE" FOOTER (injected by nav.js on content pages)
   ============================================================ */
.zt-related-wrap {
  max-width: 880px;
  margin: 56px auto 0;
  padding: 32px 20px 8px;
  border-top: 1px solid var(--zt-border);
}

/* ============================================================
   CARD GRID
   ============================================================ */
.zt-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  max-width: 880px;
  margin: 0 auto;
}

.zt-card {
  background: var(--zt-panel);
  border: 1px solid var(--zt-border);
  border-radius: 6px;
  padding: 20px 30px;
  text-decoration: none;
  color: var(--zt-text);
  font-family: sans-serif;
  transition: background 0.22s, border-color 0.22s, transform 0.14s;
  text-align: center;
  min-width: 190px;
  display: block;
  /* Minimum touch target */
  min-height: 70px;
}

.zt-card:hover {
  background: #181818;
  border-color: #484848;
  transform: translateY(-2px);
  color: var(--zt-text);
  text-decoration: none;
}

.zt-card-title {
  font-size: 13pt;
  font-weight: bold;
  margin-bottom: 6px;
}

.zt-card-desc {
  font-size: 9pt;
  color: var(--zt-text-dim);
  line-height: 1.5;
}

/* ============================================================
   PAGE HERO
   ============================================================ */
.zt-hero {
  text-align: center;
  padding: 36px 20px 10px;
}

.zt-hero h1 {
  color: var(--zt-text);
  font-size: 24pt;
  font-weight: 100;
  margin: 0 0 6px;
}

.zt-hero p {
  color: var(--zt-text-dim);
  font-size: 11pt;
  font-weight: 100;
  margin: 0;
}

/* ============================================================
   BACK LINK
   ============================================================ */
.zt-back {
  display: inline-block;
  color: var(--zt-text-dim);
  text-decoration: none;
  font-size: 10pt;
  font-family: sans-serif;
  font-weight: 100;
  padding: 4px 10px;
  border-radius: 3px;
  transition: color 0.2s;
}

.zt-back:hover { color: var(--zt-text); }

/* ============================================================
   FAB — Floating Action Button
   Shown on mobile to toggle the control panel bottom sheet.
   Invisible on desktop.
   ============================================================ */
.zt-fab {
  display: none;            /* shown only via media query */
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 10001;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid #475569;
  color: #e2e8f0;
  font-size: 24px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
  transition: background 0.2s, transform 0.25s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* The icon inside the FAB */
.zt-fab::before { content: '☰'; }
.zt-fab.active { transform: rotate(90deg); }
.zt-fab.active::before { content: '✕'; }

/* ============================================================
   DRAG HANDLE — visual cue inside the bottom sheet
   ============================================================ */
.zt-panel-handle {
  display: none;            /* shown only via media query */
  width: 40px;
  height: 4px;
  background: #475569;
  border-radius: 2px;
  margin: 10px auto 14px;
  flex-shrink: 0;
}

/* ============================================================
   OVERLAY — dim the canvas when bottom sheet is open
   ============================================================ */
.zt-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 9990;
  -webkit-tap-highlight-color: transparent;
}

.zt-overlay.visible { display: block; }

/* ============================================================
   BOTTOM SHEET — control panels on mobile
   Panels that carry the class .zt-mobile-panel transform into
   a slide-up bottom sheet on screens ≤ 768 px.
   ============================================================ */
@media (max-width: 768px) {

  /* Show FAB and handle */
  .zt-fab            { display: flex; }
  .zt-panel-handle   { display: block; }

  /* Transform the control panel into a bottom sheet */
  .zt-mobile-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 62vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px 14px 0 0 !important;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000 !important;
    box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.55) !important;
  }

  .zt-mobile-panel.open {
    transform: translateY(0);
  }

  /* Larger touch targets inside panels on mobile */
  .zt-mobile-panel button {
    min-height: 44px;
    font-size: 14px;
  }

  .zt-mobile-panel input[type="range"] {
    height: 12px;
  }

  .zt-mobile-panel input[type="range"]::-webkit-slider-thumb {
    width: 24px !important;
    height: 24px !important;
  }

  .zt-mobile-panel input[type="number"],
  .zt-mobile-panel select {
    min-height: 44px;
    font-size: 16px; /* prevent iOS zoom */
  }
}

/* ============================================================
   LANGUAGE SELECTOR
   ============================================================ */
.zt-lang-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--zt-text-dim);
  font-size: 11pt;
  font-family: sans-serif;
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 3px;
  transition: color 0.2s, border-color 0.2s;
  min-height: 28px;
  line-height: 1;
  width: auto;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.zt-lang-btn:hover { color: var(--zt-text); }

.zt-lang-btn.active {
  color: var(--zt-text);
  border-color: var(--zt-border);
}

/* ============================================================
   RESPONSIVE — Phones (≤ 600 px)
   ============================================================ */
@media (max-width: 600px) {
  /* Tighter card grid */
  .zt-grid { gap: 8px; padding: 0 10px; }
  .zt-card {
    min-width: 145px;
    flex: 1 1 145px;
    padding: 14px 12px;
  }
  .zt-card-title { font-size: 11pt; }
  .zt-card-desc  { font-size: 8.5pt; }

  .zt-hero h1          { font-size: 19pt; }
  .zt-hero p           { font-size: 10pt; }
  .zt-section-title    { font-size: 9.5pt; margin: 28px 0 12px; letter-spacing: 2px; }
}

/* ============================================================
   RESPONSIVE — Small phones (≤ 400 px)
   ============================================================ */
@media (max-width: 400px) {
  .zt-card { min-width: 130px; flex: 1 1 130px; }
}

/* ============================================================
   SHARE BUTTON ROW
   ============================================================ */
.zt-share-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0 4px;
}
.zt-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--zt-border);
  color: var(--zt-text-dim);
  font-size: 12px;
  font-family: sans-serif;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  touch-action: manipulation;
  width: auto;
  margin: 0;
}
.zt-share-btn:hover { color: var(--zt-text); border-color: #555; }
.zt-share-btn.copied { color: #4fd1c5; border-color: #4fd1c5; }

/* ============================================================
   ABOUT / SEO SECTION (model & benchmark pages)
   ============================================================ */
.zt-about {
  max-width: 760px;
  margin: 48px auto 48px;
  padding: 0 24px;
  font-family: sans-serif;
}
.zt-about h2 {
  color: var(--zt-text);
  font-weight: 300;
  font-size: 1.25rem;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--zt-border);
  padding-bottom: 10px;
}
.zt-about p {
  color: var(--zt-text-dim);
  line-height: 1.7;
  font-size: 14px;
  margin: 0 0 14px;
}
.zt-about p:last-child { margin-bottom: 0; }

/* ============================================================
   PWA INSTALL PROMPT
   ============================================================ */
.zt-pwa-prompt {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(18, 18, 22, 0.97);
  border-top: 1px solid var(--zt-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  font-family: sans-serif;
  font-size: 13px;
  color: var(--zt-text-dim);
  z-index: 10000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.zt-pwa-text { flex: 1; }
.zt-pwa-install {
  background: #2d7dd2;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  width: auto;
  margin: 0;
}
.zt-pwa-dismiss {
  background: none;
  border: none;
  color: var(--zt-text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  touch-action: manipulation;
  width: auto;
  margin: 0;
}
.zt-pwa-dismiss:hover { color: var(--zt-text); }

/* ============================================================
   BENCHMARK RESULT TABLE & PERSONAL LINK
   (injected by getresults.php into #bm-rank-table on all pages)
   ============================================================ */
#bm-rank-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.zt-result-table {
  width: auto;
  margin: 0 auto;
  border-collapse: collapse;
  font-family: sans-serif;
  font-size: 14px;
  color: var(--zt-text);
  white-space: nowrap;
}
.zt-result-table th {
  color: var(--zt-text-dim);
  font-weight: 500;
  padding: 8px 20px;
  border-bottom: 1px solid var(--zt-border);
  text-align: center;
}
.zt-result-table td {
  padding: 8px 20px;
  border-bottom: 1px solid var(--zt-border);
  text-align: center;
}
.zt-result-table tbody tr:last-child td { border-bottom: none; }
.zt-result-table tbody tr:hover td { background: var(--zt-panel); }
.zt-res-links {
  text-align: center;
  margin: 12px 0 4px;
}
.reslink, .copylnk {
  display: inline-block;
  color: var(--zt-text-dim);
  font-family: sans-serif;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  margin: 0 10px;
  padding: 4px 0;
}
.reslink:hover, .copylnk:hover { color: var(--zt-text); text-decoration: none; }
.zt-rate-limit {
  color: var(--zt-text-dim);
  font-family: sans-serif;
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
  margin: 0;
}

/* ============================================================
   MODEL PAGE LAYOUT
   Nav sits in the document flow on desktop (scrolls with page).
   On mobile (≤ 768 px) it reverts to fixed so it stays on screen.
   Usage:
     <body class="zt-model-layout">
       <nav class="zt-nav">…</nav>
       <div class="zt-model-content">…</div>   ← full-screen viz
       OR
       <div class="zt-model-content zt-model-content-scroll">…</div>
     </body>
   ============================================================ */
.zt-model-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

.zt-model-layout > .zt-nav {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  flex-shrink: 0;
}

.zt-model-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.zt-model-content-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .zt-model-layout > .zt-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
  }

  .zt-model-content-scroll {
    padding-top: var(--zt-nav-h);
  }
}
