/* Provisional Signalia shell. Colors, brand typography and tool UI remain in style.css. */
.app-shell{--shell-max-width:940px;--shell-gutter:clamp(16px,3vw,28px);--shell-canvas-padding:24px;max-width:var(--shell-max-width);padding:0 var(--shell-gutter);margin:12px auto}
.app-shell [hidden]{display:none!important}
.app-header{position:sticky;top:0;z-index:20;min-height:76px;padding:12px 0;gap:20px;border:0;background:var(--page)}
.app-header .brand{flex-shrink:0}
.app-nav{display:flex;align-items:center;gap:10px}
.app-nav .header-primary{min-height:38px;padding:9px 14px;border:1px solid var(--accent);background:var(--accent);color:white;font-size:13px;font-weight:600;white-space:nowrap}
.app-nav .header-primary:hover{background:#354b60}
.header-nav-menu{position:relative}
.header-nav-menu>summary{display:none}
.shell-nav-items{display:flex;align-items:center;gap:4px}
.shell-nav-items button{min-height:38px;padding:8px 10px;font-size:13px;background:transparent;white-space:nowrap}
.shell-nav-items button[aria-current=page]{background:var(--soft);color:var(--accent)}
.shell-count{display:inline-flex;align-items:center;justify-content:center;min-width:18px;font-size:10px!important;line-height:18px;margin-left:4px!important;border-radius:9px;background:var(--soft);color:var(--muted)}
.app-canvas{background:var(--paper);border:1px solid var(--line);border-radius:16px;padding:var(--shell-canvas-padding);min-height:70vh;margin:10px 0 24px}
.app-canvas .canvas-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}
.app-canvas .canvas-heading .eyebrow{margin:0;font-family:inherit;font-size:11px;font-weight:500;letter-spacing:.18em;line-height:1.5}
.app-canvas .reading-layout{grid-template-columns:minmax(0,1fr);gap:20px}
.reading-page{padding:0;margin:0 0 24px}
.reading-lock{display:flex;align-items:center;gap:6px;min-height:36px;padding:7px 10px;font-size:12px;background:transparent}
.reading-lock svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.reading-lock[aria-pressed=true]{background:var(--soft);border-color:var(--accent);color:var(--accent)}
.reading-page .reading-export{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:-4px 0 0;padding:0;background:transparent;border:0;box-shadow:none}
.reading-export .reading-lock{min-height:44px;font-size:14px;padding:10px 14px}
.reading-export-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-left:auto}
.reading-export-actions .check{margin:0;font-size:12px;font-weight:400;min-height:44px;display:flex;align-items:center;gap:6px}
.reading-export-actions button{width:auto;min-height:44px;min-width:0;margin:0;font-size:14px}
.app-canvas .question{padding:14px 16px}
.canvas-return{background:transparent;font-size:12px;padding:8px 10px;white-space:nowrap}
.app-canvas h1{font-family:inherit;font-size:24px;font-weight:600;letter-spacing:0;line-height:1.3}
.library-switch{display:flex;gap:6px;margin:24px 0 18px;flex-wrap:wrap}
.library-switch button{font-size:13px;padding:9px 14px}
.library-switch button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:white}
.library-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.library-symbol{display:flex;align-items:center;gap:16px;min-height:88px;padding:16px;text-align:left;border:1px solid var(--line);background:var(--paper)}
.library-symbol>span{font:34px/1.1 "Apple Symbols","Segoe UI Symbol",sans-serif;color:var(--accent);width:40px;text-align:center;flex-shrink:0}
.library-symbol strong{font-size:14px;font-weight:500}
.shell-dialog{width:min(440px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:24px;border:1px solid var(--line);border-radius:16px;background:var(--paper);color:var(--ink);box-shadow:0 12px 60px #263b4e24}
.shell-dialog::backdrop{background:#27364466;backdrop-filter:blur(3px)}
.shell-dialog-top{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}
.shell-dialog-top h2{font-size:19px}
.shell-dialog-top button{border:0;background:transparent;font-size:24px;padding:4px 10px;min-height:40px}
.shell-dialog .check{margin:0;font-size:14px;font-weight:400;line-height:1.6}
.shell-dialog p{font-size:12px;color:var(--muted);line-height:1.8;margin:12px 0 0}
@media(max-width:760px){.library-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){
 .app-shell{--shell-gutter:14px;--shell-canvas-padding:16px;margin:4px auto}
 .app-header{min-height:72px;gap:8px;padding:12px 0}
 .app-nav{gap:8px}
 .app-nav .header-primary{font-size:12px;padding:8px 10px}
 .header-nav-menu>summary{display:grid;place-items:center;width:40px;height:40px;padding:0;list-style:none;border:1px solid var(--line);border-radius:9px;color:var(--ink);background:var(--paper);font-size:24px;cursor:pointer}
 .header-nav-menu>summary::-webkit-details-marker{display:none}
 .shell-nav-items{position:absolute;right:0;top:calc(100% + 6px);display:grid;gap:4px;min-width:160px;padding:6px;background:var(--paper);border:1px solid var(--line);border-radius:10px;box-shadow:0 6px 22px #263b4e20}
 .shell-nav-items button{text-align:left;min-height:44px;padding:10px 12px}
 .app-canvas{margin-top:8px;border-radius:13px}
 .app-canvas .canvas-heading{margin-bottom:16px}
 .app-canvas h1{font-size:20px}
 .app-canvas .question{padding:12px}
 .reading-page .reading-export{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 8px}
 .reading-export-actions{display:contents}
 .reading-export .reading-lock{justify-self:start}
 .reading-export-actions .check{justify-self:end;white-space:nowrap}
 .reading-export-actions button{min-width:0}
 .app-canvas .throw-top{flex-wrap:wrap;gap:8px}
 .app-canvas .throw-top input{flex:1;min-width:140px}
 .library-symbol{gap:10px;padding:12px;min-height:80px}
 .library-symbol strong{font-size:12px}
 .library-symbol>span{font-size:30px;width:32px}
}
@media(max-width:360px){.app-header{flex-wrap:wrap}.app-nav{margin-left:auto}.library-grid{grid-template-columns:1fr}}

/* Home reuses the existing Reading cards with a quiet exit and start dialog. */
.home-canvas{min-height:50vh}
.home-history-link{display:block;margin:24px 0 0 auto;background:transparent;border:0;font-size:13px;color:var(--accent)}
.recent-reading .history-open{width:100%}
.recent-reading strong,.recent-reading p{overflow-wrap:anywhere}
.new-reading-start{display:block;width:100%;margin-top:20px;background:var(--accent);border-color:var(--accent);color:white}
.new-reading-start:hover{background:#354b60;color:white}

/* Summary closes the canvas; export and exit actions follow outside it. */
.app-canvas .reading-layout #readingSummary{grid-column:1}
.app-canvas .reading-layout #readingSummary{margin-top:4px}

/* Reading setup scrolls independently; the start action remains available. */
#newReadingForm{display:flex;flex-direction:column;min-height:0}
.new-reading-fields{padding:8px 24px 18px;overflow:auto;min-height:0;overscroll-behavior:contain}
.new-reading-footer{flex-shrink:0;padding:16px 24px 20px;border-top:1px solid var(--line);background:var(--paper)}
.new-reading-footer .new-reading-start{margin:0;min-height:46px}
.quick-dice-label{display:block;margin-top:18px;font-size:14px;font-weight:600}
#quickDice{margin-top:8px}
.reading-setup-link{display:block;width:100%;margin-top:12px;padding:8px 0;min-height:40px;border:0;background:transparent;color:var(--muted);font-size:12px;line-height:1.6;text-align:center}
.reading-setup-link:hover{background:transparent;color:var(--ink);text-decoration:underline}
.new-reading-footer .setup-error{margin:0 0 12px}
.throw-card .throw-state{margin:12px 0;font-size:12px;line-height:1.6;color:var(--muted)}
@media(max-width:680px){
 .new-reading-fields{padding:8px 18px 16px}
 .new-reading-footer{padding:12px 18px 16px}
}

/* Inline New Reading: one restrained column, without a surrounding card. */
.new-reading-page{width:min(100%,520px);margin:38px auto 32px;padding:0 24px 32px;box-sizing:border-box}
.new-reading-page h1{font-family:inherit;font-size:24px;font-weight:500;line-height:1.4;letter-spacing:0;margin:0 0 28px}
.new-reading-page .new-reading-fields{padding:0;overflow:visible;overscroll-behavior:auto}
.new-reading-page label{margin-bottom:10px}
.new-reading-page #newReadingQuestion{min-height:104px;background:var(--paper);resize:vertical}
.new-reading-page .quick-dice-label{margin-top:26px}
.new-reading-page .dice-picker{justify-content:center}
.new-reading-page .new-reading-footer{padding:28px 0 0;border:0;background:transparent}
.new-reading-page .setup-error{color:#9b423b;font-size:12px}
@media(max-width:680px){.new-reading-page{margin-top:26px;padding:0 4px 24px}.new-reading-page h1{font-size:22px;margin-bottom:24px}.new-reading-page .quick-dice-label{margin-top:24px}.new-reading-page .new-reading-footer{padding-top:24px}}

/* Compact navigation keeps one menu level and comfortable tap targets. */
@media(max-width:680px){.header-nav-menu>summary{width:44px;height:44px}.app-nav .header-primary,.canvas-return{min-height:44px}}

/* Shared header hierarchy: text navigation, primary start action, quiet settings. */
html.header-design{--shell-ink:var(--ink);--shell-muted:color-mix(in srgb,var(--ink) 55%,var(--muted-ink,var(--muted)));--shell-accent:var(--primary,var(--accent));}
.header-design :is(.appHeader,.app-header){gap:20px;}
.header-design :is(.headerActions,.app-nav){gap:16px;}
.header-design :is(.headerNavItems,.shell-nav-items){gap:8px;}
.header-design :is(.appHeader,.app-header) .shell-nav-link{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;padding:0 10px;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;color:var(--shell-muted);font:500 13px/1.3 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;text-decoration:none;white-space:nowrap;}
.header-design :is(.appHeader,.app-header) .shell-nav-link:hover{color:var(--shell-accent);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:8px;}
.header-design :is(.appHeader,.app-header) .shell-nav-link[aria-current="page"]{color:var(--shell-accent);text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:8px;}
.header-design :is(.appHeader,.app-header) .shell-primary{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:0 14px;border:1px solid var(--shell-accent);border-radius:8px;background:var(--shell-accent);color:#fff;font:600 13px/1.3 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;white-space:nowrap;box-shadow:none;}
.header-design :is(.appHeader,.app-header) .shell-primary:hover{filter:brightness(.95);}
.header-design .shell-icon{display:block;width:18px;height:18px;flex:none;}
.header-design .shell-nav-link .shell-icon{width:16px;height:16px;opacity:.85;}
.header-design .shell-primary .shell-icon{width:16px;height:16px;}
.header-design :is(.appHeader,.app-header) .shell-settings-control{display:inline-flex;align-items:center;justify-content:center;gap:9px;width:44px;min-height:44px;box-sizing:border-box;padding:0;border:0!important;border-radius:8px;background:transparent!important;box-shadow:none!important;color:var(--shell-muted);cursor:pointer;}
.header-design :is(.appHeader,.app-header) .shell-settings-control:hover{background:color-mix(in srgb,var(--shell-accent) 8%,transparent)!important;color:var(--shell-accent);}
.header-design :is(.appHeader,.app-header) .shell-settings-control .shell-icon{width:20px;height:20px;}
.header-design .shell-settings-label{display:none;}
.header-design :is(.appHeader,.app-header) :is(button,summary,a):focus-visible{outline:2px solid var(--shell-accent);outline-offset:3px;}
.header-design .headerLocation{flex-direction:row;gap:0;}

@media(max-width:680px){
 .header-design[data-header-app="astro"] :is(.app-header,.app-nav){gap:8px;}
 .header-design[data-header-app="astro"] .header-nav-menu>summary{display:grid;place-items:center;width:44px;height:44px;box-sizing:border-box;padding:0;border:0;background:transparent;color:var(--shell-ink);border-radius:8px;cursor:pointer;}
 .header-design[data-header-app="astro"] .shell-nav-items{gap:2px;width:184px;min-width:0;padding:6px;}
 .header-design[data-header-app="astro"] .shell-nav-items .shell-nav-link{width:100%;justify-content:flex-start;padding:0 12px;}
 .header-design[data-header-app="astro"] .shell-nav-items .shell-settings-control{width:100%;justify-content:flex-start;padding:0 12px;font:500 13px/1.3 system-ui,sans-serif;}
 .header-design[data-header-app="astro"] .shell-settings-label{display:inline;}
 .header-design[data-header-app="astro"] .shell-primary{padding:0 12px;font-size:12px;}
 .header-design[data-header-app="astro"] .shell-primary .shell-icon{display:none;}
 .header-design[data-header-app="astro"] .header-nav-menu>summary:hover{background:color-mix(in srgb,var(--shell-accent) 8%,transparent);}
}
@media(max-width:600px){
 .header-design[data-header-app="geomancy"] :is(.appHeader,.headerActions){gap:8px;}
 .header-design[data-header-app="geomancy"] .headerNavMenu>summary{display:grid;place-items:center;width:44px;height:44px;box-sizing:border-box;padding:0;border:0;background:transparent;color:var(--shell-ink);border-radius:8px;cursor:pointer;}
 .header-design[data-header-app="geomancy"] .headerNavItems{gap:2px;width:184px;padding:6px;}
 .header-design[data-header-app="geomancy"] .headerNavItems .shell-nav-link{width:100%;justify-content:flex-start;padding:0 12px;}
 .header-design[data-header-app="geomancy"] .headerNavItems .shell-settings-control{width:100%;justify-content:flex-start;padding:0 12px;font:500 13px/1.3 system-ui,sans-serif;}
 .header-design[data-header-app="geomancy"] .shell-settings-label{display:inline;}
 .header-design[data-header-app="geomancy"] .shell-primary{padding:0 12px;font-size:12px;}
 .header-design[data-header-app="geomancy"] .shell-primary .shell-icon{display:none;}
 .header-design[data-header-app="geomancy"] .headerNavMenu>summary:hover{background:color-mix(in srgb,var(--shell-accent) 8%,transparent);}
}

.header-design #headerNavMenu>summary .shell-icon{width:22px;height:22px;}
/* Approved home D / form B; confined to the inline New Reading form. */
.new-reading-page{width:100%;margin:28px auto 28px;padding:30px 28px 28px;background:#fff;border:0;border-radius:0;box-shadow:none;}
.new-reading-page>:is(h1,form){width:100%;max-width:496px;margin-inline:auto;}
.new-reading-page h1{font-size:16px;font-weight:400;line-height:1.5;margin-bottom:20px;letter-spacing:.02em;}
.new-reading-page .new-reading-fields>label{font-size:12px;font-weight:400;color:var(--muted);margin-bottom:8px;}
.new-reading-page #newReadingQuestion{box-sizing:border-box;font-size:16px;line-height:24px;min-height:44px;height:44px;max-height:240px;padding:9px 12px;overflow-y:auto;resize:vertical;}
.new-reading-page #newReadingQuestion:focus-visible{outline:2px solid var(--accent);outline-offset:2px;}
.new-reading-page .quick-dice-label{margin-top:24px;font-size:15px;color:var(--ink);}
.new-reading-page #quickDice{margin-top:12px;padding:14px 12px;border:1px solid #d5dad7;border-radius:10px;background:#eff0ec;box-shadow:inset 0 1px 3px #26394a0d;cursor:default;}
.new-reading-page .dice-choice-column{width:104px;max-width:104px;}
.new-reading-page .dice-choice{margin-bottom:0;}
.new-reading-page #quickDice .dice-choice-card{border-radius:9px;background:#fcfbf8;}
.new-reading-page .planet-set{min-width:0;border:0;border-top:1px solid #d5dad7;padding:10px 0 0;margin:10px 0 0;}
.new-reading-page .planet-set-heading{display:flex;justify-content:space-between;align-items:baseline;gap:6px;min-height:18px;max-width:336px;margin:0 auto 6px;font-size:12px;font-weight:500;line-height:1.5;color:var(--planet-material);}
.new-reading-page .planet-set-reason{font-size:10px;font-weight:400;color:var(--muted);white-space:nowrap;}
.new-reading-page .planet-set-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));max-width:336px;margin-inline:auto;border:1px solid #c8c6d0;border-radius:6px;background:#ffffff70;}
.new-reading-page .planet-set-pair label{position:relative;margin:0;min-width:0;font-size:12px;font-weight:400;cursor:pointer;}
.new-reading-page .planet-set-pair label+label{border-left:1px solid #d7d3df;}
.new-reading-page .planet-set-pair input{position:absolute;width:1px;height:1px;opacity:0;}
.new-reading-page .planet-set-pair span{display:flex;justify-content:center;align-items:center;min-height:44px;white-space:nowrap;padding:7px 8px;color:var(--muted);border-radius:4px;}
.new-reading-page .planet-set-pair input:checked+span{color:var(--planet-material);background:color-mix(in srgb,var(--planet-material) 10%,#fff);box-shadow:inset 0 -2px var(--planet-material);font-weight:500;}
.new-reading-page .planet-set-pair label:has(input:focus-visible){outline:2px solid var(--planet-material);outline-offset:-3px;border-radius:4px;z-index:1;}
.new-reading-page .planet-set:disabled .planet-set-pair{opacity:.48;}
.new-reading-page .planet-set:disabled .planet-set-heading{color:var(--muted);}
.new-reading-page .planet-set:disabled label{cursor:default;}
.new-reading-page .new-reading-footer{padding-top:24px;}
.new-reading-page #readingSetupLink{display:block;width:max-content;max-width:100%;min-height:44px;margin:22px 0 0 auto;padding:10px 0;font-size:12px;text-align:right;}
@media(max-width:680px){
 .new-reading-page{position:relative;isolation:isolate;margin-top:20px;padding:26px 4px;background:transparent;}
 .new-reading-page::before{content:"";position:absolute;inset-block:0;left:50%;width:100vw;transform:translateX(-50%);background:#fff;z-index:-1;}
 .new-reading-page #quickDice{padding:10px 7px;border-radius:8px;}
 .new-reading-page .dice-choice-column{width:auto;flex:1;min-width:0;max-width:94px;}
}

/* Mobile scroll behavior: the sticky header retains its original layout space. */
@media (max-width: 600px) {
  html { scroll-padding-top: var(--scroll-header-offset, 80px); }
  .app-header { transition: transform 180ms ease; will-change: transform; }
  .app-header.scroll-header-hidden { transform: translateY(calc(-100% - 16px)); pointer-events: none; }
  .app-header.scroll-header-instant { transition: none; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .app-header { transition: none; }
}
