.for-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; max-width: var(--wrap); margin: 0 auto; padding: 24px var(--gutter) 48px; }
.for-layout [hidden] { display: none !important; }
.for-main { min-width: 0; }
.for-main [data-act] { scroll-margin-top: calc(var(--header-h) + 16px); padding: 8px 0 32px; }

.for-rail { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; font-size: .95rem; padding-right: 4px; }
.for-rail ol { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: act; border-left: 2px solid var(--line); }
.for-rail ol li { margin: 0; counter-increment: act; }
.for-rail ol a { display: block; padding: 8px 10px 8px 14px; margin-left: -2px; border-left: 4px solid transparent; color: var(--ink-soft); text-decoration: none; font-weight: 500; line-height: 1.3; }
.for-rail ol a::before { content: counter(act) ".  "; font-weight: 650; }
.for-rail ol a:hover { color: var(--navy); background: var(--teal-mist); }
.for-rail ol a[aria-current] { color: var(--navy); font-weight: 700; border-left-color: var(--teal); background: var(--teal-soft); }

.panel-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.panel-strip, .panel-sheet { display: none; }

@media (max-width: 900px) {
  .for-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 16px; }
  .for-rail { position: static; max-height: none; overflow: visible; padding: 0; }
  .for-layout:not(.panel-js) .for-rail ol { display: flex; flex-wrap: wrap; gap: 4px 12px; border-left: 0; }
  .for-layout.panel-js .for-rail > ol { display: none; }
  .for-layout.panel-js { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  .panel-strip { display: flex; align-items: stretch; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(18, 48, 74, .1); }
  .panel-story-btn { flex: 0 0 auto; min-width: 64px; min-height: 48px; padding: 0 12px; border: 2px solid var(--navy); border-radius: var(--radius-sm); background: var(--navy); color: #fff; font: 650 .88rem var(--sans); cursor: pointer; }

  .panel-sheet:not([hidden]) { display: flex; align-items: flex-end; position: fixed; inset: 0; z-index: 70; background: rgba(18, 48, 74, .45); }
  .panel-sheet-body { width: 100%; max-height: 80vh; overflow-y: auto; background: var(--card); border-radius: var(--radius) var(--radius) 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)); animation: panel-rise .22s ease-out; }
  .panel-sheet-title { font: 600 1.15rem var(--serif); color: var(--navy); margin: 0 0 8px; }
  .panel-sheet-body ol { list-style: none; margin: 0 0 12px; padding: 0; counter-reset: sheet; }
  .panel-sheet-body li { counter-increment: sheet; }
  .panel-sheet-body li a { display: flex; align-items: center; min-height: 48px; padding: 6px 12px; border-left: 4px solid transparent; color: var(--ink); text-decoration: none; font-weight: 500; }
  .panel-sheet-body li a::before { content: counter(sheet) ".  "; font-weight: 650; white-space: pre; }
  .panel-sheet-body li a[aria-current] { border-left-color: var(--teal); background: var(--teal-soft); color: var(--navy); font-weight: 700; }
  .panel-sheet-close { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); font: 600 1rem var(--sans); cursor: pointer; }
}

@keyframes panel-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .panel-sheet-body { animation: none; }
}

@media (min-width: 900px) {
  .for-layout { padding-top: 16px; padding-bottom: 32px; }
  .for-main [data-act] { padding: 6px 0 20px; }
}
