/* —— Mobile: clarity, touch, readability —— */
.cc-table-scroll-hint {
  display: none;
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 1024px) {
  :root {
    --mobile-pad: 1rem;
    --mobile-header: 3.25rem;
  }

  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    font-size: 16px;
    line-height: 1.55;
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }

  body.film-mode {
    --film-letterbox: 0;
  }

  body.film-mode::after {
    display: none;
  }

  body.film-mode .guide-scanlines {
    opacity: 0.12;
  }

  .guide-universe {
    background: #040608;
  }

  /* —— Header —— */
  .header {
    padding: 0.5rem var(--mobile-pad);
    gap: 0.4rem;
    flex-wrap: nowrap;
  }

  .header-brand {
    flex: 1;
    min-width: 0;
  }

  .header-avatar {
    width: 40px;
    height: 40px;
  }

  .logo-guide {
    font-size: 0.5rem;
    letter-spacing: 0.12em;
  }

  .logo-num {
    font-size: 1.35rem;
  }

  .logo-sub--ca {
    font-size: 0.5rem;
  }

  .btn-music-header {
    padding: 0.4rem 0.55rem !important;
    min-width: auto;
  }

  .header .btn-panic {
    padding: 0.45rem 0.65rem !important;
    font-size: 0.75rem !important;
  }

  .menu-toggle {
    display: flex;
  }

  /* —— Quote ticker —— */
  .quote-ticker {
    position: sticky;
    top: var(--mobile-header);
    z-index: 90;
    margin: 0 var(--mobile-pad) 0.5rem;
    padding: 0.5rem 0.75rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .quote-ticker__text {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  /* —— Main sections —— */
  main {
    padding-top: 0.25rem;
  }

  section {
    padding: 2.75rem var(--mobile-pad);
  }

  .section-title,
  .guide-entry-title {
    font-size: 1.35rem;
    flex-wrap: wrap;
    gap: 0.35rem;
    line-height: 1.25;
  }

  .section-lead,
  .guide-lead {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
  }

  .guide-text {
    font-size: 0.9rem;
    max-width: none;
    line-height: 1.55;
  }

  .guide-section::before {
    margin-bottom: 0.75rem;
    font-size: 0.55rem;
  }

  /* —— Hero —— */
  .hero {
    min-height: auto;
    padding: 3.5rem var(--mobile-pad) 2rem;
  }

  .hero--cosmos::before {
    opacity: 0.06;
  }

  .hero-cosmos-wrap {
    position: absolute;
    inset: 0;
    min-height: 100%;
    opacity: 0.85;
  }

  .hero-badge {
    font-size: 0.6rem;
    padding: 0.35rem 0.65rem;
    margin-bottom: 1rem;
  }

  .hero-equation {
    font-size: clamp(2.5rem, 18vw, 4rem);
    margin-bottom: 0.75rem;
  }

  .hero-tagline {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .hero-sub,
  .hero-chaos {
    font-size: 0.88rem;
    text-align: left;
    margin-bottom: 1rem;
  }

  .hero-chaos {
    display: none;
  }

  .hero-gesture {
    display: none;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  .hero-cta .btn {
    width: 100%;
    min-height: 48px;
    font-size: 0.9rem;
  }

  .hero-disclaimer {
    font-size: 0.72rem;
    margin-top: 0.5rem;
  }

  /* —— Buttons & panels —— */
  .btn {
    min-height: 44px;
  }

  .guide-panel {
    border-radius: 8px;
  }

  .quotes-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .guide-quote-card p {
    font-size: 0.88rem;
  }

  .film-stills {
    grid-template-columns: 1fr;
  }

  .film-still--hero {
    grid-column: span 1;
  }

  .video-grid {
    grid-template-columns: 1fr !important;
  }

  /* —— Helios table → cards —— */
  .helios-status {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .helios-status .btn {
    width: 100%;
  }

  .helios-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.35rem;
    margin-bottom: 0.75rem;
    gap: 0.4rem;
  }

  .helios-tab {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 0.55rem 0.85rem;
    font-size: 0.72rem;
  }

  .cc-table-scroll-hint {
    display: block;
    font-family: var(--guide-font);
    font-size: 0.68rem;
    color: var(--muted);
    text-align: center;
    margin-bottom: 0.35rem;
  }

  .cc-table-wrap--cards {
    overflow: visible;
    padding: 0;
  }

  .helios-table#tokens67-table {
    display: block;
    min-width: 0;
  }

  .helios-table#tokens67-table thead {
    display: none;
  }

  .helios-table#tokens67-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }

  .helios-table#tokens67-table tr.tokens67-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(8, 14, 18, 0.9);
  }

  .helios-table#tokens67-table tr.tokens67-row--active {
    border-color: var(--green-bright);
    box-shadow: var(--glow);
  }

  .helios-table#tokens67-table td {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0;
    border: none;
    font-size: 0.85rem;
  }

  .helios-table#tokens67-table td::before {
    content: attr(data-label);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--guide-font);
  }

  .helios-table#tokens67-table td:first-child {
    grid-column: 1 / -1;
    font-size: 1.05rem;
  }

  .helios-table#tokens67-table td:first-child::before {
    display: none;
  }

  .helios-table#tokens67-table td:last-child {
    grid-column: 1 / -1;
  }

  .helios-table#tokens67-table td:last-child a {
    display: inline-block;
    min-height: 40px;
    line-height: 40px;
  }

  /* —— Universe —— */
  .universe-hero-text {
    font-size: 0.9rem;
  }

  .universe-hud {
    flex-direction: column;
    align-items: stretch;
  }

  .universe-hud-actions {
    justify-content: stretch;
  }

  .universe-hud-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.72rem;
    padding: 0.45rem 0.35rem;
  }

  .universe-status {
    min-width: 0;
    font-size: 0.72rem;
  }

  .universe-legend {
    grid-template-columns: 1fr;
  }

  /* —— Arcade —— */
  .arcade-grid {
    grid-template-columns: 1fr !important;
  }

  .arcade-stage-wrap {
    min-height: 220px;
  }

  .cinematic-bar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .cinematic-bar .btn {
    width: 100%;
  }

  /* —— Token / roadmap —— */
  .token-row,
  .contract-row {
    flex-direction: column;
    align-items: stretch;
  }

  .roadmap-timeline {
    padding-left: 1rem;
  }

  /* —— Floating UI —— */
  .guide-chat-toggle {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    left: var(--mobile-pad);
    width: 50px;
    height: 50px;
    z-index: 160;
  }

  .guide-chat-panel {
    left: var(--mobile-pad);
    right: var(--mobile-pad);
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 55vh;
  }

  .music-dock {
    display: none;
  }

  .music-dock.music-dock--open-mobile {
    display: block;
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    left: var(--mobile-pad);
    right: var(--mobile-pad);
    width: auto;
    z-index: 155;
  }
}

/* Mobile menu (hidden on desktop) */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 14, 18, 0.9);
  color: var(--green-bright);
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0.3s;
}

.mobile-drawer--open {
  pointer-events: auto;
  visibility: visible;
}

.mobile-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-drawer--open .mobile-drawer__backdrop {
  opacity: 1;
}

.mobile-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(300px, 88vw);
  height: 100%;
  background: linear-gradient(180deg, #0c1418 0%, #040608 100%);
  border-left: 2px solid var(--green);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.6);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  padding-top: calc(1rem + env(safe-area-inset-top, 0px));
}

.mobile-drawer--open .mobile-drawer__panel {
  transform: translateX(0);
}

.mobile-drawer__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-family: var(--guide-font);
  color: var(--green-bright);
  letter-spacing: 0.1em;
}

.mobile-drawer__close {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.mobile-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.mobile-drawer__nav a {
  display: block;
  padding: 0.85rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.mobile-drawer__nav a:hover,
.mobile-drawer__nav a:focus {
  background: rgba(66, 232, 133, 0.1);
  border-color: var(--border);
  color: var(--green-bright);
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px), (pointer: coarse) and (max-width: 1024px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 140;
    background: rgba(6, 10, 14, 0.96);
    backdrop-filter: blur(12px);
    border-top: 2px solid var(--green);
    padding: 0.35rem 0.25rem;
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    gap: 0.15rem;
  }

  .mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.2rem;
    text-decoration: none;
    color: var(--muted);
    font-family: var(--guide-font);
    font-size: 0.58rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 6px;
    min-height: 48px;
    justify-content: center;
  }

  .mobile-bottom-nav a span.icon {
    font-size: 1.15rem;
    line-height: 1;
  }

  .mobile-bottom-nav a.is-active {
    color: var(--green-bright);
    background: rgba(66, 232, 133, 0.12);
  }
}
