/* Product surfaces use the existing palette and leave the six ritual scenes intact. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent, #aaa5ff); outline-offset: 5px; }
button, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 1000; padding: 12px 20px; background: var(--bg-0); color: var(--text-1); border: 1px solid currentColor; border-radius: 12px; }
.skip-link:focus { top: 10px; }
.topbar { gap: 16px; align-items: center; }
.product-nav { display: flex; gap: 4px; margin-left: auto; pointer-events: auto; }
.product-nav .ghost-btn { min-height: 40px; padding: 8px 12px; white-space: nowrap; font-size: 13px; }
.product-nav [aria-current=page] { color: var(--text-1); background: rgba(150, 137, 217, .14); }
body.is-idle .topbar, body.is-ritual .topbar { opacity: 1; transform: none; }
.screen[data-screen=home] { justify-content: flex-start; padding-top: 104px; }
.j-stage[data-stage=gate].is-on { display: grid; grid-template-columns: minmax(180px, .65fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 6vw, 90px); max-width: 1100px; margin: auto; }
.gate-scene { width: min(100%, 320px); margin: 0 auto; }
.gate-copy { align-items: flex-start; text-align: left; gap: 14px; width: 100%; min-width: 0; }
.gate-copy .hero-title { font-size: clamp(32px, 4vw, 52px); line-height: 1.3; }
.gate-copy .hero-sub { font-size: 15px; line-height: 1.9; max-width: 36em; }
.gate-copy .gate-hint { font-size: 12px; }
.gate-copy .gate-hint { opacity: 1; color: var(--text-2); animation: none; }
.gate-copy .hero-quote { font-size: 13px; }
.entry-panel { width: 100%; padding: 22px; border: 1px solid rgba(155, 142, 211, .27); border-radius: 20px; background: rgba(130, 115, 180, .06); box-sizing: border-box; }
.entry-panel > label { display: block; font-size: 16px; margin-bottom: 14px; color: var(--text-1); }
.entry-panel textarea, .experience-dialog input[type=search], .reading-companion textarea, .action-check input[type=text] { width: 100%; box-sizing: border-box; color: var(--text-1); background: rgba(130, 115, 180, .07); border: 1px solid rgba(155, 142, 211, .35); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 15px; line-height: 1.8; }
.entry-panel textarea, .reading-companion textarea { resize: vertical; min-height: 84px; }
.entry-panel textarea::placeholder { color: var(--text-2); opacity: .85; }
.entry-meta { display: flex; gap: 16px; justify-content: space-between; color: var(--text-2); font-size: 11px; line-height: 1.8; margin-top: 7px; }
#entryCounter { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.intent-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.intent-chips .ghost-btn { font-size: 12px; min-height: 36px; padding: 7px 10px; }
.entry-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.entry-actions .primary-btn { font-size: 14px; padding: 12px 20px; min-height: 44px; }
.entry-actions .ghost-btn { font-size: 13px; min-height: 44px; }
.entry-steps { margin: 16px 0 0; font-size: 11px; color: var(--text-2); line-height: 1.7; }
.usage-note { margin: 12px 0 0; font-size: 11px; color: var(--text-2); line-height: 1.8; }
.path-guidance { max-width: 680px; margin: 10px auto; font-size: 14px; line-height: 1.8; color: var(--text-2); overflow-wrap: anywhere; }
.path-head { text-align: center; }
.door.is-recommended { outline: 2px solid var(--accent, #bda9fa); outline-offset: 8px; border-radius: 100px 100px 16px 16px; }
.door-plate i { white-space: normal; line-height: 1.7; }
.module-guide { width: min(760px, 100%); flex: 0 0 auto; box-sizing: border-box; border: 1px solid rgba(155, 142, 211, .2); background: rgba(130, 115, 180, .055); border-radius: 14px; padding: 12px 16px; margin: 0 0 16px; }
.journey-steps { display: flex; justify-content: space-between; gap: 12px; padding: 0; margin: 0 0 8px; list-style: none; font-size: 11px; color: var(--text-2); }
.journey-steps .is-current { color: var(--text-1); font-weight: 600; }
.module-guide p { display: inline; font-size: 12px; color: var(--text-2); line-height: 1.8; }
.module-guide .ghost-btn { font-size: 11px; padding: 6px 9px; margin-left: 10px; }
.reading-recovery { width: min(1050px, 100%); box-sizing: border-box; padding: 12px 16px; margin-bottom: 16px; border: 1px solid rgba(210, 173, 111, .35); border-radius: 12px; display: flex; gap: 16px; align-items: center; flex: 0 0 auto; }
.reading-recovery p { font-size: 12px; color: var(--text-2); line-height: 1.8; flex: 1; margin: 0; }
.reading-recovery .ghost-btn { font-size: 12px; flex-shrink: 0; }
.rl-track.is-indeterminate .rl-fill { width: 30% !important; animation: honestWait 2s ease-in-out infinite alternate; }
@keyframes honestWait { from { transform: translateX(0); } to { transform: translateX(230%); } }
.rl-steps { font-size: 11px; }
.reading-companion { border-top: 1px solid rgba(155, 142, 211, .25); margin-top: 28px; padding: 24px 0 12px; width: 100%; font-size: 14px; line-height: 1.8; box-sizing: border-box; }
.reading-companion .muted, .experience-dialog .muted { color: var(--text-2); font-size: 12px; line-height: 1.9; }
.reading-quick { padding: 18px 20px; margin-bottom: 20px; background: rgba(150, 137, 217, .1); border: 1px solid rgba(155, 142, 211, .25); border-radius: 14px; }
.reading-quick > span { font-size: 11px; color: var(--text-2); }
.reading-quick p { margin: 8px 0 0; font-size: 16px; line-height: 1.9; }
.reading-quick h3 { margin: 8px 0; font-size: 23px; font-weight: 500; }
.reading-quick small { display: block; margin-top: 12px; color: var(--text-2); line-height: 1.9; }
.reading-art { flex-shrink: 0; }
.reading-art > summary { cursor: pointer; font-size: 13px; color: var(--text-2); padding: 10px 0; }
.share-modal { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 20px; border: 0; box-sizing: border-box; color: var(--text-1); }
.share-modal::backdrop { background: #05060bcc; }
.reading-companion details { border-bottom: 1px solid rgba(155, 142, 211, .2); padding: 16px 0; }
.reading-companion summary { cursor: pointer; color: var(--text-1); padding: 6px 0; font-size: 16px; }
.action-check { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.action-check input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--accent, #9f8ed4); }
.action-check:has(input:checked) input[type=text] { opacity: .65; }
.reading-companion textarea { display: block; margin: 8px 0 12px; }
.reading-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0 0; }
.reading-feedback > span { width: 100%; font-size: 12px; color: var(--text-2); }
.reading-feedback .ghost-btn { padding: 8px 12px; font-size: 12px; }
.reading-feedback [aria-pressed=true] { background: rgba(150, 137, 217, .22); color: var(--text-1); }
.conversation-message { padding: 12px 14px; border-radius: 12px; background: rgba(150, 137, 217, .07); margin: 10px 0; }
.conversation-message b { font-size: 11px; color: var(--text-2); }
.conversation-message p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.conversation-message.from-user { margin-left: 20px; }
#followupStatus { display: block; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.is-speaking { background: rgba(162, 142, 223, .15); box-shadow: -3px 0 0 var(--accent, #b6a3e1); border-radius: 4px; transition: background .35s ease; }
body.has-audio-player .screen[data-screen=reading] { padding-bottom: 174px; }
.experience-dialog { color: var(--text-1); background: var(--bg-0, #0b0e1a); border: 1px solid rgba(155, 142, 211, .3); border-radius: 22px; width: min(780px, calc(100% - 32px)); max-height: 84dvh; padding: 24px 28px; box-sizing: border-box; box-shadow: 0 30px 100px #0007; }
.experience-dialog::backdrop { background: #06050db3; backdrop-filter: blur(7px); }
.experience-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: -24px; background: var(--bg-0); z-index: 1; padding: 4px 0 12px; }
.experience-dialog h2 { margin: 0; font-size: 24px; font-weight: 500; }
.experience-dialog h3 { margin-top: 24px; font-size: 16px; }
.experience-dialog p { font-size: 14px; line-height: 1.95; overflow-wrap: anywhere; }
.knowledge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.knowledge-link { text-align: left; border: 1px solid rgba(155, 142, 211, .25); border-radius: 14px; padding: 16px; background: rgba(130, 115, 180, .06); color: var(--text-1); cursor: pointer; font: inherit; }
.knowledge-link b { font-size: 15px; font-weight: 500; }
.knowledge-link span { display: block; font-size: 12px; line-height: 1.9; margin-top: 8px; color: var(--text-2); }
.preference-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; font-size: 14px; }
.preference-row input { width: 18px; height: 18px; accent-color: var(--accent, #a894d5); }
.record-search-label { display: block; font-size: 12px; color: var(--text-2); }
.experience-dialog input[type=search] { display: block; margin: 8px 0 18px; }
.record-card { display: flex; gap: 20px; align-items: center; padding: 18px 0; border-bottom: 1px solid rgba(155, 142, 211, .2); }
.record-card > div:first-child { flex: 1; min-width: 0; }
.record-card b { font-size: 16px; font-weight: 500; }
.record-card small { display: block; margin: 6px 0; font-size: 11px; color: var(--text-2); }
.record-card p { margin: 8px 0 0; font-size: 12px; }
.record-actions { display: flex; flex-direction: column; gap: 6px; }
.record-actions button { font-size: 12px; padding: 8px 12px; }
.empty-state { padding: 32px 0; color: var(--text-2); text-align: center; }
.experience-toast { position: fixed; left: 50%; transform: translateX(-50%); top: 90px; z-index: 150; max-width: min(600px, calc(100% - 48px)); border: 1px solid rgba(155, 142, 211, .4); background: var(--bg-0); color: var(--text-1); box-shadow: 0 10px 40px #0005; padding: 12px 20px; border-radius: 12px; font-size: 13px; line-height: 1.8; }
.share-option { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-1); margin: 16px 0 8px; }
.share-option input { width: 18px; height: 18px; }
.share-preview { font-size: 12px; color: var(--text-2); line-height: 1.9; }
@media (min-width: 981px) {
  .reading-art > summary { display: none; }
  .reading-stage .stage-number canvas { width: min(230px, 100%) !important; }
  .reading-stage .stage-gua-disc, .reading-stage .stage-mansion-disc { width: min(230px, 100%); }
  .reading-rail .reading-tools:not([hidden]) { display: grid; grid-template-columns: 1fr 1fr; }
  .reading-rail .reading-tools .ghost-btn { white-space: normal; line-height: 1.5; min-height: 38px; }
  .reading-rail { scrollbar-width: thin; }
}
html[data-large-text=true] .reading .txt p, html[data-large-text=true] .reading .synthesis p, html[data-large-text=true] .reading .actions-list li { font-size: 20px; }
html[data-calm-motion=true] *, html[data-calm-motion=true] *::before, html[data-calm-motion=true] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
html[data-calm-motion=true] #bg { opacity: .3; }
@media (max-width: 980px) {
  .j-stage[data-stage=gate].is-on { grid-template-columns: 180px minmax(0, 1fr); gap: 30px; }
  body.has-audio-player .reading-wrap { padding-bottom: 0; }
  .screen[data-screen=reading] > .reading-quick { width: min(760px, 92vw); box-sizing: border-box; flex: 0 0 auto; }
  .reading-rail { padding: 10px 16px 14px; }
  .reading-rail .reading-tools:not([hidden]) { grid-template-columns: repeat(3, 1fr); }
  .reading-art > .reading-stage { margin-top: 12px; }
}
@media (max-width: 680px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; align-content: start; }
  .brand { font-size: 19px; }
  .brand-sub { font-size: 10px; letter-spacing: .1em; }
  .product-nav { order: 3; width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0; }
  .product-nav .ghost-btn { padding: 7px 3px; font-size: 12px; min-height: 36px; }
  .screen, .screen[data-screen=tarot], .screen[data-screen=home] { padding-top: 116px; }
  .j-stage[data-stage=gate].is-on { display: flex; gap: 20px; margin: 0 auto; }
  .j-stage[data-stage=gate] .gate-scene { width: 100px; flex-shrink: 0; }
  .gate-copy { align-items: stretch; }
  .gate-copy .hero-title { font-size: 32px; text-align: center; }
  .gate-copy .hero-sub { text-align: center; font-size: 14px; }
  .entry-panel { padding: 18px 16px; }
  .entry-actions { flex-direction: column; align-items: stretch; }
  .entry-actions .primary-btn { width: 100%; }
  .entry-steps { text-align: center; font-size: 10px; }
  .entry-meta { font-size: 10px; gap: 8px; }
  .gate-copy .demo-note, .gate-copy .gate-hint { text-align: center; }
  .module-guide { padding: 10px 12px; margin-bottom: 12px; }
  .journey-steps { gap: 5px; font-size: 10px; }
  .module-guide p { font-size: 11px; }
  .module-guide .ghost-btn { margin-left: 0; display: block; }
  .screen[data-screen=tarot] > .hint { display: block; font-size: 12px; line-height: 1.8; }
  .reading-recovery { flex-direction: column; gap: 8px; align-items: flex-start; }
  body.has-audio-player .screen[data-screen=reading] { padding-bottom: 215px; }
  .experience-dialog { width: calc(100% - 20px); padding: 20px 18px; max-height: 88dvh; }
  .experience-dialog header { top: -20px; }
  .experience-dialog h2 { font-size: 21px; }
  .knowledge-grid { grid-template-columns: 1fr; }
  .experience-toast { top: 115px; width: calc(100% - 48px); }
  .record-card { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .rl-track.is-indeterminate .rl-fill { animation: none; width: 100% !important; opacity: .3; }
  .is-speaking { transition: none; }
}

/* Once text is ready, reveal overlays cannot cover it or compete with audio. */
body.has-audio-player #revealVeil { visibility: hidden; }
.reading-quick { background: var(--bg-1); }
.screen[data-screen=reading].is-active,
.screen[data-screen=reading].is-active.is-arriving > * { animation: none; }

/* A centered, bounded sheet instead of the browser reset's top-left dialog. */
.experience-dialog {
  position: fixed; inset: 0; margin: auto; height: fit-content;
  width: min(720px, calc(100% - 40px)); max-height: 86vh; max-height: 86dvh;
  padding: 32px 34px; overflow-y: auto; overflow-x: hidden;
  border-radius: 26px; border-color: rgba(var(--accent-rgb), .3);
  background: linear-gradient(145deg, var(--bg-1), var(--bg-0));
  box-shadow: 0 28px 100px #0008, inset 0 1px 0 rgba(255,255,255,.05);
}
.experience-dialog::backdrop { background: rgba(5, 6, 14, .68); backdrop-filter: blur(12px); }
.experience-dialog > header { top: 0; padding: 0 0 22px; margin-bottom: 8px; gap: 24px; background: transparent; position: relative; }
.experience-dialog > header h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.experience-dialog > header > button { flex-shrink: 0; }
.experience-dialog header h2 { font: 500 28px/1.5 var(--font-display); letter-spacing: .08em; }
.experience-dialog header .ghost-btn { min-height: 40px; padding: 8px 18px; font-size: 12px; }
.ritual-guide { position: relative; text-align: center; }
.ritual-seal { position: relative; display: grid; place-items: center; width: 84px; height: 84px; margin: 2px auto 20px; border: 1px solid rgba(var(--accent-rgb), .4); border-radius: 50%; background: radial-gradient(circle, rgba(var(--accent-rgb), .17), transparent 70%); }
.ritual-seal::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(var(--accent-rgb), .17); border-radius: 50%; }
.ritual-seal i { position: absolute; inset: -7px; border-top: 1px solid rgba(var(--accent-rgb), .5); border-bottom: 1px solid rgba(var(--accent-rgb), .18); border-radius: 50%; transform: rotate(-24deg); }
.ritual-seal > span { font: 34px/1 var(--font-display); color: var(--accent); }
.experience-dialog .ritual-eyebrow { margin: 0; font-size: 10px; letter-spacing: .24em; color: var(--text-2); }
.experience-dialog .ritual-intro { max-width: 30em; margin: 14px auto 24px; font: 400 19px/1.9 var(--font-display); color: var(--text-1); }
.ritual-instructions { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; text-align: left; }
.ritual-instructions li { display: flex; gap: 16px; padding: 15px 18px; border: 1px solid rgba(var(--accent-rgb), .14); background: rgba(var(--accent-rgb), .035); border-radius: 14px; }
.ritual-instructions li > span { flex-shrink: 0; font: 21px/1.5 var(--font-display); color: var(--accent); opacity: .75; }
.ritual-instructions b { font-size: 14px; font-weight: 500; }
.experience-dialog .ritual-instructions p { margin: 5px 0 0; font-size: 12px; line-height: 1.9; color: var(--text-2); }
.ritual-about { margin: 17px 0; text-align: left; font-size: 11px; color: var(--text-2); }
.ritual-about summary { cursor: pointer; padding: 7px 0; }
.experience-dialog .ritual-about p { font-size: 12px; }
.ritual-enter { display: inline-flex; align-items: center; justify-content: center; gap: 28px; min-width: 220px; margin-top: 5px; padding: 13px 30px; font-size: 15px; }

/* The voice remains controllable, while its visual language belongs to the scene. */
.is-speaking { background: linear-gradient(90deg, rgba(var(--accent-rgb), .12), rgba(var(--accent-rgb), .025)); box-shadow: inset 2px 0 0 rgba(var(--accent-rgb), .6); border-radius: 5px; transition: background .6s ease; }
@keyframes oracleBreath { 0%,100% { box-shadow: 0 0 15px rgba(var(--accent-rgb), .1); } 50% { box-shadow: 0 0 28px rgba(var(--accent-rgb), .3); } }
@keyframes oracleWave { from { transform: scaleY(.45); } to { transform: scaleY(1); } }

/* Day mode is a warm ivory scene, with framed art and readable surfaces. */
html[data-theme=day] .gate-scene {
  -webkit-mask-image: radial-gradient(ellipse 52% 51% at 50% 51%, #000 50%, rgba(0,0,0,.85) 67%, transparent 97%);
  mask-image: radial-gradient(ellipse 52% 51% at 50% 51%, #000 50%, rgba(0,0,0,.85) 67%, transparent 97%);
  filter: drop-shadow(0 14px 30px rgba(110, 85, 128, .2)) brightness(1.1);
}
html[data-theme=day] .entry-panel { background: rgba(255, 253, 249, .88); border-color: rgba(118, 97, 160, .2); box-shadow: 0 18px 50px rgba(116, 92, 138, .055); }
html[data-theme=day] .entry-panel textarea { background: rgba(255, 255, 255, .78); border-color: rgba(118, 97, 160, .25); }
html[data-theme=day] #bg { opacity: .3; }
html[data-theme=day] .gate-copy .hero-quote { color: #736584; }
html[data-theme=day] .experience-dialog { background: linear-gradient(145deg, #fffdf9, #f7f1e9); border-color: rgba(118, 97, 160, .2); box-shadow: 0 28px 90px rgba(77, 59, 96, .2); }
html[data-theme=day] .experience-dialog::backdrop { background: rgba(71, 56, 85, .22); }
html[data-theme=day] .module-guide, html[data-theme=day] .reading-companion { border-color: rgba(118, 97, 160, .22); }
@media (max-width: 680px) {
  .experience-dialog { width: calc(100% - 24px); padding: 26px 22px; border-radius: 22px; max-height: 87dvh; }
  .experience-dialog > header { top: 0; padding-bottom: 18px; margin-bottom: 4px; gap: 18px; }
  .experience-dialog header h2 { font-size: 23px; }
  .ritual-seal { width: 62px; height: 62px; margin-bottom: 14px; }
  .ritual-seal > span { font-size: 27px; }
  .experience-dialog .ritual-intro { font-size: 17px; margin: 12px auto 18px; }
  .ritual-instructions { gap: 9px; }
  .ritual-instructions li { padding: 12px; gap: 12px; }
  .ritual-enter { min-width: 190px; }
}


.reading-rail::-webkit-scrollbar { width: 4px; }
.reading-rail::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), .3); border-radius: 4px; }

/* Original controls stay directly visible at every viewport size. */
.topbar { flex-wrap: nowrap; }
.brand { flex-shrink: 0; }
.topbar > .topbar-dock { position: static; flex-shrink: 0; }
.topbar-dock .ghost-btn { min-height: 40px; }
body.is-transitioning .topbar, body.is-cast .topbar { opacity: 1; transform: none; }
.screen[data-screen] { padding-top: calc(var(--app-topbar-height, 84px) + 20px); }
@media (max-width: 1280px) {
  .topbar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; padding: 12px 20px; }
  .topbar .brand { grid-row: 1; grid-column: 1; }
  .product-nav { grid-row: 1; grid-column: 2; justify-self: end; margin-left: 0; }
  .topbar > .topbar-dock { grid-row: 2; grid-column: 1 / -1; width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .topbar-dock .topbar-sep { display: none; }
}
@media (max-width: 680px) {
  .topbar { grid-template-columns: minmax(0, 1fr); padding: 10px 14px; gap: 7px; }
  .topbar .brand { grid-row: 1; grid-column: 1; }
  .topbar > .topbar-dock { grid-row: 2; grid-column: 1; grid-template-columns: 1.25fr 1.1fr 1fr 1fr .8fr; padding: 3px; border-radius: 14px; gap: 0; }
  .product-nav { grid-row: 3; grid-column: 1; justify-self: stretch; width: 100%; }
  .product-nav .ghost-btn { font-size: 11px; min-height: 32px; padding: 6px 3px; }
  .topbar-dock .ghost-btn, .topbar-dock #cameraToggle, .topbar-dock #soundToggle, .topbar-dock #bgmToggle { font-size: 11px; padding: 6px 3px; min-height: 40px; line-height: 1.35; white-space: normal; letter-spacing: 0; }
  #cameraToggle::before, #soundToggle::before, #bgmToggle::before { display: none; }
}

/* Commit a theme as one frame: text and surfaces must never cross-fade separately. */
html.theme-changing, html.theme-changing *, html.theme-changing *::before, html.theme-changing *::after { transition: none !important; }

body.has-audio-player .screen[data-screen=reading] { padding-bottom: var(--oracle-player-height, 210px); }

