/* adventure-responsive.css — Mobile breakpoints (loaded last) */

@media (max-width: 900px) {
  .adv-play {
    flex-direction: column;
    padding-bottom: 64px; /* space for bottom sheet */
  }

  /* --- Bottom Sheet Sidebar --- */
  .adv-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    width: 100%;
    max-height: 56px;
    overflow: hidden;
    background: var(--sf-bg-elevated);
    backdrop-filter: var(--sf-glass-blur);
    -webkit-backdrop-filter: var(--sf-glass-blur);
    border-top: 1px solid var(--sf-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .adv-sidebar--sheet-open {
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .adv-sidebar .adv-panel {
    flex: none;
    min-width: 0;
    margin: 0 0.75rem;
    border-radius: 10px;
  }

  .adv-sidebar .adv-panel:last-child {
    margin-bottom: 0.75rem;
  }

  /* Drag handle */
  .adv-sidebar__handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px 4px;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .adv-sidebar__handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(var(--sf-text-rgb), 0.3);
    transition: background 0.2s;
  }

  .adv-sidebar__handle:hover .adv-sidebar__handle-bar,
  .adv-sidebar--sheet-open .adv-sidebar__handle-bar {
    background: rgba(var(--sf-text-rgb), 0.5);
  }

  /* Mini summary bar (visible when collapsed) */
  .adv-sidebar__mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2px 16px 8px;
    font-size: 0.72rem;
    color: var(--sf-text-muted);
    flex-shrink: 0;
  }

  .adv-sidebar__mini i {
    margin-right: 0.2rem;
    font-size: 0.65rem;
  }

  .adv-sidebar--sheet-open .adv-sidebar__mini {
    border-bottom: 1px solid var(--sf-border);
    padding-bottom: 10px;
    margin-bottom: 0.5rem;
  }

  /* Hide portrait in bottom sheet (it's in the sidebar) */
  .adv-sidebar__portrait {
    margin: 0 0.75rem;
  }

  /* Level bar in bottom sheet */
  .adv-level-bar {
    margin: 0 0.75rem;
  }
}

@media (max-width: 768px) {
  /* Wizard stats layout stacks vertically on tablets */
  .adv-wizard__stats-layout {
    flex-direction: column;
    align-items: center;
  }

  .adv-stat-radar {
    order: -1;
  }

  .adv-wizard__stats-controls {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .adv-main {
    padding: 1rem;
    gap: 1rem;
  }

  .adv-header {
    padding: 0.5rem 1rem;
  }

  .adv-header__logo {
    font-size: 0.95rem;
  }

  .adv-scene__text {
    font-size: 0.95rem;
  }

  /* Wizard responsive */
  .adv-wizard__steps {
    padding: 0 0.5rem;
  }

  .adv-wizard__step-label {
    display: none;
  }

  .adv-wizard__title {
    font-size: 1.2rem;
  }

  .adv-genre-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .adv-char-creator__body {
    flex-direction: column;
    align-items: center;
  }

  .adv-portrait__frame {
    width: 180px;
    height: 180px;
  }

  .adv-char-creator__options {
    grid-template-columns: 1fr;
  }

  .adv-art-style__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .adv-archetype-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .adv-stat-allocator__footer {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .adv-stat-allocator__preview {
    max-width: 100%;
    text-align: left;
  }

  .adv-choice {
    padding: 0.7rem 0.85rem;
    font-size: 0.88rem;
    min-height: 3rem;
    align-items: flex-start;
  }

  .adv-choice__key {
    margin-top: 0.1rem;
    flex-shrink: 0;
  }

  .adv-choice__text {
    flex: 1;
    min-width: 0;
  }

  .adv-choice__skill {
    flex-shrink: 0;
    margin-top: 0.1rem;
  }

  .adv-panel {
    padding: 1rem;
  }

  .adv-sidebar {
    flex-direction: column;
  }

  .adv-sidebar .adv-panel {
    min-width: 0;
  }

  .adv-ending__stats {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .adv-ending__title {
    font-size: 1.4rem;
  }

  .adv-dice__value {
    font-size: 2.5rem;
  }
}

/* --- Touch Swipe Choice Highlight --- */
.adv-choice--highlighted {
  border-color: var(--sf-accent) !important;
  box-shadow: 0 0 16px rgba(var(--sf-accent-rgb), 0.3),
              inset 0 0 0 1px rgba(var(--sf-accent-rgb), 0.2);
  transform: translateX(4px);
}

/* Hide handle/mini on desktop (injected by JS, hide via CSS) */
.adv-sidebar__handle,
.adv-sidebar__mini {
  display: none;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .adv-scene__image-placeholder::before,
  .adv-scene__image-placeholder::after {
    display: none;
  }

  .adv-scene--critical::after {
    animation: none;
    opacity: 0.8;
  }

  /* Skip particles */
  .adv-particles {
    display: none !important;
  }

  /* Skip hover transforms */
  .adv-hub__genre:hover,
  .adv-hub__save-card:hover,
  .adv-gallery__card:hover {
    transform: none !important;
  }

  /* Skip image zoom */
  .adv-scene__image {
    transform: none !important;
  }

  /* Instant gallery card entrance */
  .adv-gallery__card {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Skip wizard panel slide */
  .adv-wizard__panel {
    transition: none !important;
  }

  /* Skip choice stagger */
  .adv-choice {
    opacity: 1 !important;
    animation: none !important;
  }
}

/* Disable immersive mode on small screens — sidebar is bottom sheet */
@media (max-width: 900px) {
  .adv-btn--icon#immersiveBtn {
    display: none !important;
  }

  .adv-sidebar-toggle {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .adv-main {
    padding: 0.75rem;
  }

  .adv-header__nav {
    gap: 0.5rem;
  }

  .adv-header__link {
    font-size: 0.75rem;
  }

  .adv-choice__key {
    display: none;
  }

  .adv-scene__image-wrap {
    aspect-ratio: 4 / 3;
  }

  .adv-art-style__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .adv-pause__panel {
    padding: 1.5rem;
    min-width: 0;
    width: 90%;
  }
}
