/* ============================================================
 * mobile.css — K1 Mobile-only experience（v1.0, 2026-05-03）
 *
 * Scope: 只在 ≤640px viewport 下 active；desktop 完全不影響
 * Reference: Tado app + Pantone Cloud Dancer 2026 + DesignRush
 *            functional storytelling + ui-ux-responsive Part B/C
 *
 * 2 HTML 共用：index.html / app.html
 * ============================================================ */

/* ── Activation Guard：所有 mobile-only style 必須包在 media query 內 ── */
@media (max-width: 640px) {

  /* ── 1. CSS Custom Properties（Light mode default + Dark via prefers-color-scheme）── */
  :root {
    /* EDB brand anchor */
    --m-edb-deep:        #0D6B47;
    --m-edb-mid:         #1A8B5F;
    --m-edb-light:       #4FB388;
    --m-edb-wash:        #E5F2EB;

    /* Cloud Dancer 2026 + atmospheric companion */
    --m-cloud:           #F0EEE9;
    --m-cloud-warm:      #F8F6F2;
    --m-cream:           #E4DFD5;
    --m-sea-glass:       #9EC4B8;
    --m-sky-mist:        #D6E4E8;

    /* Text on light bg — WCAG AAA */
    --m-text-primary:    #2A3A33;
    --m-text-secondary:  #5C6A63;
    --m-text-muted:      #8A938E;

    /* Backgrounds */
    --m-bg:              var(--m-cloud);
    --m-bg-card:         #ffffff;
    --m-bg-elevated:     var(--m-cloud-warm);

    /* Role chip colours (mobile-only mapping) */
    --m-role-principal:  #BF360C;
    --m-role-panel:      #283593;
    --m-role-teacher:    #1B5E20;
    --m-role-admin:      #4527A0;

    /* Hero gradient */
    --m-hero-gradient:   linear-gradient(135deg,
                          var(--m-edb-deep) 0%,
                          var(--m-edb-mid) 55%,
                          var(--m-cloud-warm) 100%);

    /* Typography (fluid) */
    --m-text-base:       16px;
    --m-text-sm:         14px;
    --m-text-xs:         12px;
    --m-text-lg:         18px;
    --m-text-xl:         22px;
    --m-text-hero:       clamp(28px, 8vw, 36px);
    --m-text-stat:       clamp(36px, 12vw, 56px);

    --m-font:            'Noto Sans HK', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --m-leading:         1.55;
    --m-tracking-tight:  -0.01em;

    /* Spacing */
    --m-sp-xs:           4px;
    --m-sp-sm:           8px;
    --m-sp-md:           16px;
    --m-sp-lg:           24px;
    --m-sp-xl:           32px;
    --m-sp-2xl:          48px;

    /* Radius */
    --m-r-sm:            8px;
    --m-r-md:            16px;
    --m-r-lg:            24px;
    --m-r-pill:          999px;

    /* Touch */
    --m-touch:           44px;

    /* Motion */
    --m-ease:            cubic-bezier(0.32, 0.72, 0, 1);
    --m-dur-fast:        180ms;
    --m-dur-base:        240ms;
    --m-dur-slow:        360ms;

    /* Safe area inset (iPhone notch) */
    --m-safe-top:        env(safe-area-inset-top, 0px);
    --m-safe-bottom:     env(safe-area-inset-bottom, 0px);
  }

  /* ── 1b. Dark mode via prefers-color-scheme ── */
  @media (prefers-color-scheme: dark) {
    :root {
      --m-cloud:         #1A1F1C;
      --m-cloud-warm:    #232925;
      --m-cream:         #2C332E;

      --m-text-primary:  #F0EEE9;
      --m-text-secondary:#B5BCB7;
      --m-text-muted:    #7A827D;

      --m-bg:            var(--m-cloud);
      --m-bg-card:       var(--m-cloud-warm);
      --m-bg-elevated:   var(--m-cream);

      --m-edb-wash:      rgba(79, 179, 136, 0.12);

      /* Hero gradient subtler in dark */
      --m-hero-gradient: linear-gradient(135deg,
                          var(--m-edb-deep) 0%,
                          var(--m-edb-mid) 60%,
                          var(--m-cloud-warm) 100%);
    }
  }

  /* ── 2. Reset / Base ── */
  body {
    background: var(--m-bg);
    color: var(--m-text-primary);
    font-family: var(--m-font);
    font-size: var(--m-text-base);
    line-height: var(--m-leading);
    -webkit-font-smoothing: antialiased;
    padding: 0;
    margin: 0;
    /* Reserve space for bottom tab bar (64px) + safe-area-inset */
    padding-bottom: calc(64px + var(--m-safe-bottom));
  }

  /* Mobile-only / desktop-only utility classes */
  .desktop-only { display: none !important; }
  .mobile-only  { display: block; }

  /* Hide desktop nav on mobile — ONLY once mobile.js has successfully built a
     takeover shell (body.mobile-shell-active). Without a working shell the
     desktop content must stay visible (usable, not blank). */
  body.mobile-shell-active .nav,
  body.mobile-shell-active .k1-header,
  body.mobile-shell-active footer.site-footer,
  body.mobile-shell-active footer.k1-footer { display: none !important; }

  /* Hide the existing Hero / wrap only when a mobile shell is actually active */
  body.mobile-shell-active[data-mobile-active="true"] > section.hero,
  body.mobile-shell-active[data-mobile-active="true"] > div.wrap,
  body.mobile-shell-active[data-mobile-active="true"] > #root {
    display: none !important;
  }

  /* ── 3. Mobile shell layout ── */
  .m-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--m-bg);
  }

  /* ── 4. Top app bar (minimal, 56px) ── */
  .m-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--m-sp-md);
    height: 56px;
    background: var(--m-bg);
    border-bottom: 1px solid var(--m-cream);
    position: sticky;
    top: 0;
    z-index: 50;
    padding-top: calc(var(--m-sp-md) + var(--m-safe-top));
  }
  .m-appbar-title {
    font-size: var(--m-text-lg);
    font-weight: 700;
    color: var(--m-text-primary);
    letter-spacing: var(--m-tracking-tight);
  }
  .m-appbar-icon {
    width: var(--m-touch);
    height: var(--m-touch);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: var(--m-text-secondary);
    cursor: pointer;
  }

  /* ── 5. Hero gradient section (index.html / app.html search) ── */
  .m-hero {
    background: var(--m-hero-gradient);
    color: #ffffff;
    padding: var(--m-sp-2xl) var(--m-sp-md) var(--m-sp-xl);
    border-radius: 0 0 var(--m-r-lg) var(--m-r-lg);
    margin-bottom: var(--m-sp-lg);
  }
  .m-hero-eyebrow {
    font-size: var(--m-text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: var(--m-sp-sm);
  }
  .m-hero-title {
    font-size: var(--m-text-hero);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: var(--m-tracking-tight);
    margin: 0 0 var(--m-sp-md);
  }
  .m-hero-desc {
    font-size: var(--m-text-base);
    opacity: 0.92;
    line-height: 1.55;
    margin-bottom: var(--m-sp-lg);
  }
  /* S256 — minny.app 背書品牌：手機版隱藏頁尾，故在外殼底部放 m 字標（約 18 px，觸控範圍向外延伸） */
  .m-brand {
    display: flex; justify-content: center; align-items: center; gap: 6px;
    padding: 14px var(--m-sp-md) 18px;
    font-size: 12px; color: var(--m-text-secondary); text-decoration: none;
  }
  .m-brand img { display: block; width: 18px; height: auto; }

  /* ── 6. Search input (Tado-inspired large, rounded) ── */
  .m-search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    border-radius: var(--m-r-pill);
    padding: 0 var(--m-sp-xs) 0 var(--m-sp-lg);
    height: 56px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }
  .m-search-icon {
    color: var(--m-text-secondary);
    margin-right: var(--m-sp-sm);
    flex-shrink: 0;
  }
  .m-search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    font-size: var(--m-text-base);
    color: var(--m-text-primary);
    outline: none;
    /* Prevent iOS auto-zoom by ensuring 16px+ */
    min-height: var(--m-touch);
  }
  /* Tappable search button — mobile users can search WITHOUT relying on the
     keyboard Enter key (some keyboards/IMEs do not submit reliably). */
  .m-search-btn {
    flex-shrink: 0;
    margin-left: var(--m-sp-sm);
    height: 44px;
    padding: 0 var(--m-sp-md);
    border: 0;
    border-radius: var(--m-r-pill);
    background: var(--m-edb-mid);
    color: #fff;
    font-size: var(--m-text-sm);
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .m-search-btn:active { background: var(--m-edb-deep); }
  .m-search-input::placeholder {
    color: var(--m-text-muted);
    transition: opacity var(--m-dur-base) var(--m-ease);
  }

  /* ── 7. Result card list ── */
  .m-result-list {
    display: flex;
    flex-direction: column;
    gap: var(--m-sp-md);
    padding: 0 var(--m-sp-md);
  }
  .m-result-card {
    background: var(--m-bg-card);
    border-radius: var(--m-r-md);
    padding: var(--m-sp-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--m-cream);
    cursor: pointer;
    transition: transform var(--m-dur-fast) var(--m-ease);
  }
  .m-result-card:active { transform: scale(0.98); }

  .m-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--m-sp-sm);
  }
  .m-result-source {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--m-text-xs);
    font-weight: 600;
    color: var(--m-edb-deep);
    background: var(--m-edb-wash);
    padding: 4px 10px;
    border-radius: var(--m-r-pill);
  }
  .m-result-content {
    font-size: var(--m-text-sm);
    color: var(--m-text-primary);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .m-result-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--m-sp-sm);
  }
  .m-role-chip {
    font-size: var(--m-text-xs);
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--m-r-pill);
    color: #ffffff;
  }

  /* ── 8. Bottom sheet ── */
  .m-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--m-dur-base) var(--m-ease);
  }
  .m-sheet-backdrop[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
  }
  .m-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--m-bg-card);
    border-radius: var(--m-r-lg) var(--m-r-lg) 0 0;
    max-height: 90vh;
    z-index: 100;
    transform: translateY(100%);
    transition: transform var(--m-dur-slow) var(--m-ease);
    padding: var(--m-sp-md);
    padding-bottom: calc(var(--m-sp-md) + var(--m-safe-bottom));
    overflow-y: auto;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.16);
  }
  .m-sheet[aria-hidden="false"] { transform: translateY(0); }
  .m-sheet-handle {
    width: 44px;
    height: 4px;
    background: var(--m-cream);
    border-radius: var(--m-r-pill);
    margin: 0 auto var(--m-sp-md);
  }

  /* ── 9. Bottom tab bar (3 entries: 搜尋 / 文件庫 / 平台介紹) ── */
  .m-tabbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(64px + var(--m-safe-bottom));
    padding-bottom: var(--m-safe-bottom);
    background: var(--m-bg);
    border-top: 1px solid var(--m-cream);
    display: flex;
    align-items: stretch;
    z-index: 80;
  }
  .m-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: 0;
    color: var(--m-text-secondary);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    min-height: var(--m-touch);
  }
  .m-tab[aria-current="page"] {
    color: var(--m-edb-deep);
    font-weight: 700;
  }
  .m-tab[aria-current="page"]::before {
    content: '';
    position: absolute;
    top: 0; left: 25%; right: 25%;
    height: 2px;
    background: var(--m-edb-deep);
    border-radius: 0 0 2px 2px;
  }
  .m-tab-icon {
    font-size: 20px;
    line-height: 1;
  }

  /* ── 10. Role picker overlay (boot-time first-run) ── */
  .m-role-picker {
    position: fixed;
    inset: 0;
    background: var(--m-bg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: var(--m-sp-2xl) var(--m-sp-md) var(--m-sp-md);
    gap: var(--m-sp-md);
    overflow-y: auto;
  }
  .m-role-picker[aria-hidden="true"] { display: none; }
  .m-role-picker h2 {
    font-size: var(--m-text-xl);
    font-weight: 800;
    color: var(--m-text-primary);
    text-align: center;
    margin: 0 0 var(--m-sp-sm);
    letter-spacing: var(--m-tracking-tight);
  }
  .m-role-picker-eyebrow {
    font-size: var(--m-text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--m-edb-deep);
    text-align: center;
    margin-bottom: var(--m-sp-md);
  }
  .m-role-option {
    display: flex;
    align-items: center;
    gap: var(--m-sp-md);
    padding: var(--m-sp-md);
    background: var(--m-bg-card);
    border: 2px solid var(--m-cream);
    border-radius: var(--m-r-md);
    color: var(--m-text-primary);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--m-dur-fast) var(--m-ease),
                transform var(--m-dur-fast) var(--m-ease);
  }
  .m-role-option:active { transform: scale(0.98); }
  .m-role-option[aria-pressed="true"] {
    border-color: var(--m-edb-deep);
    background: var(--m-edb-wash);
  }
  .m-role-option-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .m-role-option-name {
    font-size: var(--m-text-base);
    font-weight: 600;
    margin-bottom: 2px;
  }
  .m-role-option-desc {
    font-size: var(--m-text-xs);
    color: var(--m-text-secondary);
  }

  .m-role-picker-cta {
    margin-top: auto;
    padding: var(--m-sp-md);
    background: var(--m-edb-deep);
    color: #ffffff;
    border: 0;
    border-radius: var(--m-r-pill);
    font-size: var(--m-text-base);
    font-weight: 700;
    min-height: var(--m-touch);
    cursor: pointer;
  }
  .m-role-picker-cta:disabled { opacity: 0.5; }

  /* ── 10b. 文件庫 (#guidelines) dedicated mobile render (Phase 2) ── */
  .m-guide-head {
    padding: calc(var(--m-sp-lg) + var(--m-safe-top)) var(--m-sp-md) var(--m-sp-md);
    background: var(--m-bg-elevated);
    border-bottom: 1px solid var(--m-cream);
  }
  .m-guide-eyebrow {
    font-size: var(--m-text-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--m-edb-deep);
    margin-bottom: var(--m-sp-xs);
  }
  .m-guide-title {
    font-size: var(--m-text-xl);
    font-weight: 800;
    color: var(--m-text-primary);
    letter-spacing: var(--m-tracking-tight);
    margin: 0 0 var(--m-sp-xs);
  }
  .m-guide-sub {
    font-size: var(--m-text-sm);
    color: var(--m-text-secondary);
    margin: 0 0 var(--m-sp-md);
  }
  .m-guide-search {
    display: flex;
    align-items: center;
    background: var(--m-bg-card);
    border: 1px solid var(--m-cream);
    border-radius: var(--m-r-pill);
    padding: 0 var(--m-sp-md);
    height: 48px;
  }
  .m-guide-search .m-search-icon {
    color: var(--m-text-muted);
    margin-right: var(--m-sp-sm);
    flex-shrink: 0;
  }
  .m-guide-search-input {
    flex: 1;
    border: 0;
    background: transparent;
    font-size: var(--m-text-base);
    color: var(--m-text-primary);
    outline: none;
    min-height: var(--m-touch);
  }
  .m-guide-search-input::placeholder { color: var(--m-text-muted); }

  /* Horizontal scroll chip rows */
  .m-guide-chips {
    display: flex;
    gap: var(--m-sp-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: var(--m-sp-md) var(--m-sp-md) 0;
  }
  .m-guide-chips::-webkit-scrollbar { display: none; }
  .m-guide-chips-sub { padding-top: var(--m-sp-sm); }
  .m-guide-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--m-bg-card);
    border: 1px solid var(--m-cream);
    border-radius: var(--m-r-pill);
    color: var(--m-text-secondary);
    font-size: var(--m-text-sm);
    font-weight: 600;
    padding: 8px 14px;
    min-height: 38px;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--m-dur-fast) var(--m-ease),
                border-color var(--m-dur-fast) var(--m-ease),
                color var(--m-dur-fast) var(--m-ease);
  }
  .m-chip-sm { font-size: var(--m-text-xs); padding: 6px 12px; min-height: 32px; }
  .m-guide-chip.is-active {
    background: var(--m-edb-deep);
    border-color: var(--m-edb-deep);
    color: #ffffff;
  }
  .m-guide-chip-n {
    font-size: var(--m-text-xs);
    font-weight: 700;
    background: var(--m-edb-wash);
    color: var(--m-edb-deep);
    border-radius: var(--m-r-pill);
    padding: 1px 7px;
    min-width: 18px;
    text-align: center;
  }
  .m-guide-chip.is-active .m-guide-chip-n {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
  }

  /* Sort row */
  .m-guide-sort {
    display: flex;
    align-items: center;
    gap: var(--m-sp-sm);
    padding: var(--m-sp-md) var(--m-sp-md) var(--m-sp-sm);
  }
  .m-guide-sort-lbl {
    font-size: var(--m-text-xs);
    color: var(--m-text-muted);
    font-weight: 600;
    margin-right: 2px;
  }
  .m-guide-sortbtn {
    background: transparent;
    border: 1px solid var(--m-cream);
    border-radius: var(--m-r-sm);
    color: var(--m-text-secondary);
    font-size: var(--m-text-xs);
    font-weight: 600;
    padding: 6px 12px;
    min-height: var(--m-touch);
    cursor: pointer;
  }
  .m-guide-sortbtn.is-active {
    background: var(--m-edb-wash);
    border-color: var(--m-edb-light);
    color: var(--m-edb-deep);
  }

  /* Doc card list */
  .m-guide-list {
    display: flex;
    flex-direction: column;
    gap: var(--m-sp-sm);
    padding: 0 var(--m-sp-md) var(--m-sp-md);
  }
  .m-guide-count {
    font-size: var(--m-text-xs);
    color: var(--m-text-muted);
    font-weight: 600;
    padding: 4px 2px;
  }
  .m-guide-empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--m-text-muted);
    font-size: var(--m-text-sm);
    line-height: 1.6;
  }

  .m-guide-card {
    display: block;
    background: var(--m-bg-card);
    border: 1px solid var(--m-cream);
    border-radius: var(--m-r-md);
    padding: var(--m-sp-md);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform var(--m-dur-fast) var(--m-ease);
  }
  .m-guide-card:active { transform: scale(0.98); }
  .m-guide-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--m-sp-sm);
  }
  .m-guide-fmt {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--m-text-secondary);
    background: var(--m-bg-elevated);
    border: 1px solid var(--m-cream);
    border-radius: var(--m-r-sm);
    padding: 2px 8px;
  }
  .m-guide-year {
    font-size: var(--m-text-xs);
    font-weight: 700;
    border-radius: var(--m-r-pill);
    padding: 2px 10px;
  }
  .m-gy-new    { background: var(--m-edb-wash); color: var(--m-edb-deep); }
  .m-gy-recent { background: var(--m-sky-mist); color: var(--m-text-primary); }
  .m-gy-old    { background: var(--m-bg-elevated); color: var(--m-text-muted); }
  .m-guide-card-title {
    font-size: var(--m-text-base);
    font-weight: 600;
    color: var(--m-text-primary);
    line-height: 1.5;
    margin-bottom: var(--m-sp-sm);
  }
  .m-guide-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--m-sp-sm);
  }
  .m-guide-level {
    font-size: var(--m-text-xs);
    font-weight: 600;
    color: var(--m-text-secondary);
    background: var(--m-bg-elevated);
    border-radius: var(--m-r-pill);
    padding: 2px 10px;
  }
  .m-guide-open {
    font-size: var(--m-text-xs);
    font-weight: 700;
    color: var(--m-edb-deep);
    white-space: nowrap;
  }

  /* ── 10c. Mobile onboarding tour (first-visit walkthrough, S175) ── */
  .m-tour {
    position: fixed;
    inset: 0;
    background: linear-gradient(160deg, #0D6B47 0%, #0A4F35 100%);
    z-index: 210;
    display: flex;
    flex-direction: column;
    padding: calc(env(safe-area-inset-top, 0px) + 48px) var(--m-sp-md) calc(env(safe-area-inset-bottom, 0px) + 24px);
  }
  .m-tour[aria-hidden="true"] { display: none; }
  .m-tour-icon {
    font-size: 64px;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1;
  }
  .m-tour-title {
    font-size: clamp(22px, 6vw, 28px);
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 14px;
    line-height: 1.25;
    letter-spacing: -0.02em;
  }
  .m-tour-body {
    font-size: var(--m-text-base);
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.85);
    flex: 1;
  }
  .m-tour-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 28px 0 18px;
  }
  .m-tour-dot {
    height: 7px;
    width: 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.2s ease, background 0.2s ease;
  }
  .m-tour-dot.active { width: 24px; background: #ffffff; }
  .m-tour-nav {
    display: flex;
    gap: 10px;
    align-items: center;
  }
  .m-tour-skip {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--m-text-sm);
    font-weight: 600;
    padding: 12px 4px;
    cursor: pointer;
    min-height: var(--m-touch, 48px);
  }
  .m-tour-next {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    font-size: var(--m-text-base);
    font-weight: 700;
    border-radius: var(--m-r-pill);
    min-height: var(--m-touch, 48px);
    cursor: pointer;
    transition: opacity 0.15s ease;
  }
  .m-tour-next.primary {
    background: #ffffff;
    color: var(--m-edb-deep);
    border-color: transparent;
  }
  .m-tour-next:active,
  .m-tour-skip:active { opacity: 0.7; }

  /* ── 11. Reduced motion ── */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }

}

/* ── S211 desktop-width guard — MUST stay outside the @media (max-width: 640px) block ──
   Everything above is scoped to ≤640px, so above that width the mobile shell has no styles
   at all: it renders as plain unstyled blocks at the top of <body> and pushes #root down.
   mobile.js no longer builds a shell above 640px, but a shell built before a resize crossed
   the breakpoint stays in the DOM (the resize handler drops the body flags, it does not tear
   the markup down). This guard makes that leftover invisible instead of load-bearing.
   Every element mobile.js injects at body level is listed here — keep the list complete:
   .m-shell (app / guidelines / templates shells), .m-tabbar, .m-tour, .m-role-picker. */
@media (min-width: 641px) {
  .m-shell,
  .m-tabbar,
  .m-tour,
  .m-role-picker { display: none !important; }
}
