/* Mobile-first ritual, shared by the home, table and reading screens. */
body { background: radial-gradient(ellipse at 50% 26%, #382542, #1b1226 70%); }
body > header { height: 72px; max-width: 760px; padding: 0 24px; border: 0; }
body > header .brand { font-size: 21px; letter-spacing: 3px; }
body > header .brand-mark { width: 32px; height: 32px; }
body > header .brand small { display: none; }
body > header nav button { display: none; }
body > header nav [data-action="history"] { display: block; min-height: 44px; }
body > footer { display: none; }
.mobile-home { max-width: 480px; margin: auto; text-align: center; padding: 18px 24px 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.mobile-home .hero-kicker { font-size: var(--text-caption); letter-spacing: 3px; margin: 0 0 15px; }
.mobile-home h1 { font-size: 32px; line-height: 1.55; letter-spacing: 2px; margin: 0; }
.home-subtitle { font-size: var(--text-label); margin: 12px 0 0; color: #d1bfd9; }
.home-deck { position: relative; display: block; height: 278px; width: 100%; margin: 16px auto; padding: 0; }
.home-back { position: absolute; width: 142px; height: 213px; left: 50%; top: 32px; border-radius: 8px; border: 1px solid #c9ad7777; box-shadow: 0 14px 32px #09061088; object-fit: cover; }
.home-back.side-left { transform: translateX(-85%) rotate(-16deg); }
.home-back.side-right { transform: translateX(-15%) rotate(16deg); }
.home-back.center-card { transform: translateX(-50%) translateY(-8px); }
.home-deck:active .center-card { transform: translateX(-50%) translateY(-16px); }
.home-orbit { position: absolute; width: 265px; height: 265px; left: 50%; top: 0; transform: translateX(-50%); border: 1px solid #c9ad772b; border-radius: 50%; background: radial-gradient(circle, #b898cf18, transparent 70%); }
.home-actions .primary { display: flex; width: 100%; border-radius: 16px; min-height: 56px; font-size: 16px; background: #dfc496; box-shadow: 0 8px 26px #09061044; }
.home-explore { display: flex; width: 100%; justify-content: space-between; align-items: center; min-height: 60px; padding: 12px 4px; margin-top: 9px; font-size: var(--text-caption); color: #c7b5ce; }
.home-explore span { color: #ead4ad; font-size: var(--text-label); }
.home-note { font-size: var(--text-caption); letter-spacing: 2px; margin: 2px 0; color: #a998b3; }
#moon-ribbon-demo { max-width: 600px; margin: 0 auto; --mr-back: url('assets/cat-card-back-v1-640.webp'); }
#moon-ribbon-demo .mr-table { min-height: 600px; padding: 12px 24px 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: radial-gradient(ellipse at 50% 45%, #160e1c18 0%, #1009168c 100%), url('assets/walnut-table-v1-1536.webp') center/cover no-repeat #1a1118; }
#moon-ribbon-demo .mr-header { padding: 0 0 12px; min-height: 44px; border-color: #c9ad7726; }
#moon-ribbon-demo .mr-header .back { min-height: 44px; }
#moon-ribbon-demo .mr-intro { text-align: center; max-width: none; margin-top: 28px; }
#moon-ribbon-demo h2 { font-size: 25px; }
#moon-ribbon-demo .mr-status { min-height: 24px; margin-top: 8px; color: #cdb9d6; }
#moon-ribbon-demo .mr-sound { top: 12px; right: 24px; padding: 8px 12px; border-radius: 22px; background: #34213f; }
#moon-ribbon-demo .mr-header span { display: none; }
#moon-ribbon-demo .mr-stage { height: 278px; margin-top: 18px; }
#moon-ribbon-demo .mr-pick { top: 62px; width: 132px; height: 198px; }
#moon-ribbon-demo .mr-pick.is-active { box-shadow: 0 0 0 1px #e0c393, 0 15px 32px #090610aa, 0 0 35px #bd91e226; }
#moon-ribbon-demo .mr-main { width: 100%; max-width: 400px; min-height: 54px; border-radius: 16px; background: #dfc496; color: #26172f; font-size: 16px; }
#moon-ribbon-demo .mr-main:hover:not(:disabled) { background: #ecd4ad; }
#moon-ribbon-demo .mr-hint { color: #cdb9d6; }
#moon-ribbon-demo .mr-foot { color: #a998b3; margin-top: 10px; }
#moon-ribbon-demo .mr-shade { position: fixed; top: 0; right: 0; bottom: 0; left: 0; padding: 24px; overflow-y: auto; background: #1b1226f5; }
#moon-ribbon-demo .mr-dialog { margin: auto; width: 100%; }
#moon-ribbon-demo .mr-zoom { width: 224px; height: 336px; max-width: 65vw; }
#moon-ribbon-demo .mr-return { min-height: 52px; min-width: 224px; margin-top: 16px; border-radius: 16px; }
#moon-ribbon-demo .mr-return[aria-disabled="true"] { opacity: .55; }
@media (max-width: 600px) {
  body > header { padding: 0 20px; height: 62px; padding-top: env(safe-area-inset-top, 0px); }
  main { min-height: calc(100vh - 62px); }
  .page, .result { padding: 16px 20px 32px; padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
  .page h2, .result h1 { font-size: 27px; line-height: 1.5; }
  textarea, input, select { font-size: 16px; }
  .back { min-height: 44px; }
  .major-daily-result .result-top { text-align: center; padding-top: 20px; }
  .major-daily-result .major-daily-art { width: 164px; margin-bottom: 24px; }
  .major-daily-result h2 { font-size: 22px; }
  .daily-guidance { display: block; padding: 0; border: 0; }
  .daily-guidance section, .daily-guidance section + section { margin-top: 16px; padding: 18px 20px; border: 1px solid #c9ad7733; border-radius: 18px; background: #b29acf09; }
  .daily-guidance p, .reading-summary p { color: #dfd1e4; font-size: 15px; }
  .journal { padding: 20px; border-radius: 18px; }
  .journal .actions { flex-direction: column; }
  .journal .actions button { width: 100%; }
  summary { min-height: 44px; padding: 10px 0; }
}
@media (max-height: 740px) and (max-width: 600px) {
  .mobile-home { padding-top: 6px; }
  .mobile-home h1 { font-size: 28px; }
  .home-deck { height: 236px; margin: 10px auto; }
  .home-back { width: 124px; height: 186px; top: 25px; }
  .home-orbit { width: 230px; height: 230px; }
  #moon-ribbon-demo .mr-intro { margin-top: 14px; }
  #moon-ribbon-demo .mr-stage { height: 240px; margin-top: 10px; }
  #moon-ribbon-demo .mr-pick { top: 48px; width: 120px; height: 180px; }
  #moon-ribbon-demo .mr-table { min-height: 0; }
  #moon-ribbon-demo .mr-zoom { width: 190px; height: 285px; }
}
@media (prefers-reduced-motion: no-preference) {
  .home-back { transition: transform .25s ease; }
}

body > header nav [data-action="daily"] { display: none; }
/* Cards enter as a floating row; the central card is the selection control. */
#moon-ribbon-demo .mr-stage { height: 320px; margin-top: 28px; overflow: hidden; }
#moon-ribbon-demo .mr-pick { top: 64px; transform-origin: center center; }
#moon-ribbon-demo .mr-pick.is-active { border-color: #f2d8aa; box-shadow: 0 0 0 1px #e0c393, 0 20px 36px #090610aa, 0 0 48px #bd91e244; }
#moon-ribbon-demo .mr-mat { inset: 0; background: radial-gradient(ellipse at center, #c29ae422, transparent 67%); }
#moon-ribbon-demo .mr-guide { bottom: 12px; left: 50%; right: auto; width: 6px; height: 6px; transform: translateX(-50%) rotate(45deg); background: #dfc496; box-shadow: 0 0 14px #dfc49688; }
#moon-ribbon-demo .mr-hint { margin-top: 22px; font-size: var(--text-label); }
#moon-ribbon-demo .mr-browse { margin-top: 6px; }
@keyframes moon-card-arrive {
  from { opacity: 0; translate: 0 35px; }
  to { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .home-back { animation: moon-card-arrive .85s cubic-bezier(.2,.7,.2,1) both; }
  .home-back.side-right { animation-delay: .12s; }
  .home-back.center-card { animation-delay: .24s; }
}
@media (max-height: 740px) and (max-width: 600px) {
  #moon-ribbon-demo .mr-stage { height: 270px; margin-top: 18px; }
  #moon-ribbon-demo .mr-pick { top: 50px; }
}
.home-ritual { max-width: 600px; margin: auto; }
.home-ritual .mr-header .back { visibility: hidden; }
.home-secondary { padding: 0 24px 24px; text-align: center; }
.home-secondary .text-button { font-size: var(--text-caption); min-height: 44px; }
#moon-ribbon-demo .mr-sound { width: 44px; height: 44px; padding: 10px; display: flex; align-items: center; justify-content: center; }
#moon-ribbon-demo .mr-sound[aria-pressed="false"] { opacity: .6; }

/* Quiet sound control beside the history entry. */
body > header nav { gap: 6px; }
body > header nav .mr-sound {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 50%;
}
body > header nav .mr-sound svg { width: 18px; height: 18px; }
body > header nav .mr-sound[aria-pressed="false"] { opacity: .55; }
.home-ritual .mr-header { display: none !important; }
/* Reserve space above the smoothly highlighted card. */
#moon-ribbon-demo .mr-pick { top: 76px; width: 132px; height: 198px; }
@media (max-width: 600px) {
  #moon-ribbon-demo .mr-pick { top: 72px; width: 120px; height: 180px; }
}
.reading-toolbar, .share-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-reading { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 4px; color: var(--gold); font-size: var(--text-label); }
#share-preview { max-width: 460px; padding: 20px; border-radius: 18px; }
#share-preview h2 { font-size: 20px; margin: 0; }
#share-preview .share-toolbar button { font-size: 28px; min-width: 44px; min-height: 44px; }
#share-poster { display: block; width: 100%; height: auto; border-radius: 10px; }
#share-preview .actions { flex-wrap: wrap; }
#share-status { font-size: var(--text-caption); }
#share-status:empty { display: none; }
#share-system[hidden] { display: none; }
@keyframes open-reading-card { to { transform: translateY(-28px) scale(.82); opacity: 0; } }
@keyframes open-reading-content { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: no-preference) {
 #moon-ribbon-demo .is-opening-reading .mr-dialog { animation: open-reading-card .32s ease-in both; }
 .reading-enter > * { animation: open-reading-content .5s ease-out both; }
 .reading-enter > .result-top { animation-delay: .06s; }
 .reading-enter > .reading-summary { animation-delay: .13s; }
 .reading-enter > .daily-guidance { animation-delay: .20s; }
}

#share-preview .share-toolbar { margin-bottom: 16px; }

/* Content-sized mobile home, preserving introductory copy. */
@media (max-width: 600px) {
 #moon-ribbon-demo h2 { font-size: clamp(16px, 5.8vw, 26px); line-height: 1.4; letter-spacing: .5px; white-space: nowrap; }
 .home-ritual #moon-ribbon-demo .mr-table { min-height: 0; padding: 10px 20px; }
 .home-ritual #moon-ribbon-demo .mr-intro { margin-top: 12px; }
 .home-ritual #moon-ribbon-demo .mr-status { display: block; min-height: 20px; margin-top: 8px; font-size: var(--text-caption); line-height: 1.6; }
 .home-ritual #moon-ribbon-demo .mr-stage { height: 224px; margin-top: 12px; }
 .home-ritual #moon-ribbon-demo .mr-pick { top: 40px; }
 .home-ritual #moon-ribbon-demo .mr-guide { bottom: 4px; }
 .home-ritual #moon-ribbon-demo .mr-browse { min-height: 24px; margin-top: 4px; }
 .home-ritual #moon-ribbon-demo .mr-hint { min-height: 18px; margin-top: 6px; font-size: var(--text-caption); }
 .home-ritual #moon-ribbon-demo .mr-foot { display: block; margin-top: 6px; line-height: 1.5; }
 .home-secondary { padding: 6px 20px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
 .home-explore { justify-content: center; gap: 12px; min-height: 48px; margin-top: 0; border: 1px solid var(--line); border-radius: 12px; }
}
#share-preview .actions { display: flex; flex-wrap: nowrap; gap: 10px; }
#share-preview .actions > .primary, #share-preview .actions > .secondary {
 flex: 1 1 0; min-width: 0; min-height: 48px; padding: 12px 8px; gap: 0;
 font-size: 14px; letter-spacing: 0; white-space: nowrap; text-align: center;
}
.cat-card-front:before, .cat-card-front:after { display: none; }
.explore-cat-art { display: block; position: absolute; inset: 0; }
.explore-cat-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.explore-cat-name {
 position: absolute; bottom: 3.5%; left: 8%; right: 8%; text-align: center; color: #3f2c25;
 font-family: var(--serif); font-size: var(--text-label); line-height: 1.2; letter-spacing: 1px;
}
.mini-art .explore-cat-name { font-size: var(--text-caption); letter-spacing: 0; }
/* Exploration steps use their own mobile layout. */
.reference-questions { display: block; }
.reference-questions summary { font-size: var(--text-caption); }
.reference-questions button { display: block; margin-top: 10px; }
@media (max-width: 600px) {
 .explore-page, .explore-ritual, .explore-reveal { padding: 6px 20px 20px; max-width: 520px; }
 .explore-page .back, .explore-ritual .back { min-height: 40px; padding: 8px 0; }
 .explore-page .page-head { margin: 8px 0 16px; }
 .explore-page .page-head h2 { margin: 8px 0; font-size: 23px; line-height: 1.5; letter-spacing: .5px; }
 .explore-page .page-head p { margin: 6px 0; font-size: var(--text-label); }
 .explore-page .question-window { padding: 16px; border-radius: 14px; }
 .explore-page .question-window > .label { margin-bottom: 4px; }
 .explore-page .question-window textarea { min-height: 94px; padding: 4px 0; line-height: 1.7; }
 .explore-page .reference-questions { padding-top: 4px; margin-top: 6px; }
 .explore-page .reference-questions summary { padding: 8px 0; min-height: 36px; }
 .explore-page .reference-questions button { padding: 8px 0; min-height: 44px; }
 .explore-page .explore-options { padding: 4px 0; }
 .explore-page .explore-options summary { padding: 10px 0; }
 .explore-page .field { margin: 12px 0; }
 .explore-page .two-fields { grid-template-columns: 1fr; gap: 0; }
 .explore-page .spread-inline { padding-top: 10px; line-height: 1.6; }
 .explore-page .spread-inline p { margin: 4px 0 0; }
 .explore-page .actions { margin-top: 16px; gap: 8px; }
 .explore-page .actions .primary { width: 100%; min-height: 48px; border-radius: 12px; }
 .explore-page .actions .hint { width: 100%; text-align: center; }
 .explore-page > .hint { margin: 6px 0; text-align: center; }
 .explore-ritual h2, .explore-reveal h2 { font-size: 23px; line-height: 1.5; letter-spacing: .5px; margin: 10px 0; }
 .explore-ritual > p, .explore-reveal > p { margin: 6px 0; line-height: 1.7; }
 .explore-ritual .fan { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; height: auto; max-width: 340px; margin: 22px auto 14px; }
 .explore-ritual .fan > .pick-card { position: relative; width: 100%; transform: none; z-index: auto !important; }
 .explore-ritual .pick-card:hover:not(:disabled) { transform: translateY(-4px); }
 .explore-ritual .pick-card.chosen { transform: scale(.92); opacity: .35; }
 .explore-ritual .shuffling .pick-card { animation: explore-shuffle .7s ease-in-out 2; }
 .explore-ritual .selection { gap: 8px; min-height: 28px; }
 .explore-ritual .actions { margin-top: 16px; justify-content: center; }
 .explore-ritual .actions .primary { width: 100%; min-height: 48px; border-radius: 12px; }
 .explore-reveal .reveal-grid { display: grid; grid-template-columns: repeat(var(--reveal-columns, 2), minmax(0, 1fr)); gap: 10px 18px; max-width: 290px; margin: 16px auto; }
 .explore-reveal .reveal-item { width: 100%; max-width: 110px; justify-self: center; }
 .explore-reveal .reveal-item > p { margin: 0 0 6px; min-height: 18px; line-height: 1.5; }
 .explore-reveal .actions { margin-top: 12px; gap: 10px; flex-wrap: nowrap; }
 .explore-reveal .actions > button { flex: 1; min-width: 0; padding: 12px 8px; min-height: 48px; border-radius: 12px; white-space: nowrap; }
 .explore-result .result-top { grid-template-columns: 90px minmax(0, 1fr); gap: 18px; padding: 18px 0 24px; }
 .explore-result .result-art { width: 90px; transform: none; }
 .explore-result h1 { font-size: 23px; line-height: 1.5; letter-spacing: .5px; margin: 8px 0; }
 .explore-result .result-top p { margin: 6px 0; overflow-wrap: anywhere; }
 .explore-result .context-tag { padding: 5px 9px; font-size: var(--text-caption); }
 .explore-result .reading-summary { margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #ad8ec20b; }
 .explore-result .reading-summary h3 { font-size: 21px; margin: 0 0 10px; }
 .explore-result .reading-summary h3:not(:first-child) { margin-top: 20px; }
 .explore-result .reading-summary p { margin: 8px 0; line-height: 1.85; font-size: 14px; }
 .explore-result .reading-heading { margin-top: 24px; }
 .explore-result .reading-heading h2 { font-size: 23px; }
 .explore-result .reading-row { grid-template-columns: 76px minmax(0, 1fr); gap: 14px; padding: 20px 0; }
 .explore-result .reading-row h3 { font-size: 20px; line-height: 1.5; }
 .explore-result .reading-row p { font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
 .explore-result .reading-row .tiny { font-size: var(--text-caption); letter-spacing: .5px; }
 .explore-result .mini-art .explore-cat-name { font-size: var(--text-caption); }
 .explore-result .journal { margin-top: 20px; padding: 18px; }
 .explore-result .journal h3 { font-size: 22px; }
 .explore-result .chips { gap: 8px; }
 .explore-result .chip { min-height: 44px; padding: 8px 12px; }
 .explore-result .refine { padding: 12px 0; }
 .explore-result .refine select { width: 100%; }
}
@keyframes explore-shuffle { 50% { transform: translateY(-5px) scale(.95); } }
@media (prefers-reduced-motion: reduce) {
 .explore-ritual .shuffling .pick-card { animation: none; }
}
@media (max-height: 650px) and (max-width: 600px) {
 .explore-ritual .fan { max-width: 280px; gap: 8px; margin-top: 14px; }
 .explore-reveal .reveal-grid { max-width: 252px; gap: 8px 14px; margin: 12px auto; }
 .explore-reveal .reveal-item { max-width: 94px; }
 .explore-reveal h2, .explore-ritual h2 { font-size: 21px; }
}
@media (max-height: 650px) and (max-width: 600px) {
 .explore-page .page-head { margin: 4px 0 10px; }
 .explore-page .page-head h2 { font-size: 19px; letter-spacing: 0; }
 .explore-page .question-window { padding: 12px 14px; }
 .explore-page .question-window textarea { min-height: 78px; }
 .explore-page .actions { margin-top: 10px; }
}
@media (max-width: 600px) {
 .explore-result .result-top { display: grid; align-items: start; }
}
@media (max-height: 650px) and (max-width: 600px) {
 .explore-reveal .reveal-item { max-width: 88px; }
 .explore-reveal .reveal-grid { gap: 6px 14px; margin: 10px auto; }
 .explore-reveal .actions { margin-top: 8px; }
}
/* Form system: aligned text, 12px rhythm and a single quiet focus boundary. */
.explore-page .question-window {
 padding: 16px;
 border: 1px solid #c9ad7744;
 background: #201629;
 transition: border-color .18s, box-shadow .18s;
}
.explore-page .question-window:focus-within { border-color: #c9ad7799; box-shadow: 0 0 0 1px #c9ad7722; }
.explore-page .question-window > .label { margin: 0; font-size: 14px; line-height: 1.6; letter-spacing: 0; font-weight: 400; }
.explore-page .question-window textarea {
 display: block;
 box-sizing: border-box;
 margin: 12px 0;
 padding: 0;
 height: 120px;
 min-height: 120px;
 border: 0;
 border-radius: 0;
 background: transparent;
 outline: none;
 box-shadow: none;
 font-size: 16px;
 line-height: 1.65;
 resize: vertical;
 color: var(--ink);
 scrollbar-width: thin;
 scrollbar-color: #ad8ec255 transparent;
}
.explore-page .question-window textarea:focus,
.explore-page .question-window textarea:focus-visible { outline: none; box-shadow: none; }
.explore-page .question-window textarea::placeholder { font-size: 14px; line-height: 1.8; color: #b8a8bf; opacity: .8; }
.explore-page .reference-questions { margin: 0; padding-top: 8px; border-top: 1px solid var(--line); }
.explore-page .reference-questions summary { min-height: 40px; padding: 8px 0; font-size: 14px; line-height: 1.6; }
.explore-page .reference-questions button { font-size: 14px; line-height: 1.7; }
.explore-page .reference-questions summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; border-radius: 3px; }
.explore-options select[hidden], .refine select[hidden] { display: none; }
.themed-select { margin: 0; padding: 0; font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif; color: var(--ink); }
.themed-select > summary {
 display: flex; align-items: center; justify-content: space-between; gap: 12px;
 min-height: 48px; padding: 12px 14px;
 border: 1px solid #ad8ec24d; border-radius: 10px;
 background: #201629; list-style: none; color: var(--ink); font-size: 14px; line-height: 1.6;
}
.themed-select > summary::-webkit-details-marker { display: none; }
.themed-select > summary::after { content: '⌄'; flex-shrink: 0; color: var(--gold); }
.themed-select[open] > summary { border-color: #c9ad7788; }
.themed-select > summary:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.themed-select-options { min-width: 0; margin: 6px 0 0; padding: 6px; border: 1px solid #c9ad7744; border-radius: 10px; background: #261a30; }
.themed-select-option { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px; border-radius: 6px; cursor: pointer; color: #e0d2e5; }
.themed-select-option:hover, .themed-select-option:focus-within { background: #c9ad7712; }
.themed-select-option input[type="radio"] {
 -webkit-appearance: none; appearance: none;
 width: 16px; height: 16px; min-height: 0; flex: 0 0 16px;
 margin: 0; padding: 0; border: 1px solid #ad8ec288; border-radius: 50%; background: transparent;
}
.themed-select-option input[type="radio"]:checked { border-color: var(--gold); background: var(--gold); box-shadow: inset 0 0 0 4px #261a30; }
.themed-select-option input[type="radio"]:checked + span { color: #ead4ad; }
.themed-select-option input[type="radio"]:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
 .explore-page .explore-options .field > span { font-size: 14px; margin-bottom: 8px; }
 .explore-page .explore-options .themed-select > summary { padding: 12px 14px; min-height: 48px; font-size: 14px; color: var(--ink); }
 .explore-page .question-window { padding: 14px 16px; }
 .explore-page .question-window textarea { height: 100px; min-height: 100px; }
}
/* Daily titles fit common phone widths without leaving a lone character. */
@media (max-width: 600px) {
 .major-daily-result h1 {
  font-size: clamp(18px, 5.8vw, 26px);
  letter-spacing: .3px;
  line-height: 1.5;
  text-wrap: balance;
 }
}
/* Keep the name in the center of the printed lower nameplate. */
.explore-cat-name {
 top: 87.2%; bottom: auto; height: 11.3%;
 display: flex; align-items: center; justify-content: center;
 white-space: nowrap; line-height: 1; letter-spacing: 0;
}
.explore-reveal .explore-cat-name { font-size: var(--text-caption); }
.explore-reveal .reveal-item { display: flex; flex-direction: column; align-items: center; }
.explore-reveal .reveal-item > .reveal-position { margin: 8px 0 0; min-height: 18px; text-align: center; line-height: 1.5; }
.explore-pages { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 6px 0 10px; }
.explore-pages button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--gold); font-size: 24px; }
.explore-pages span { min-width: 100px; font-size: var(--text-caption); color: var(--muted); font-variant-numeric: tabular-nums; }
.explore-ritual .shuffling .pick-card { animation: explore-shuffle-desktop 1.8s ease-in-out both; }
@keyframes explore-shuffle-desktop {
 0%, 100% { transform: translateX(var(--x)) translateY(var(--y)) rotate(var(--r)); }
 22%, 78% { transform: translate(0,0) rotate(0deg); }
 42% { transform: translateX(var(--split-x)) rotate(var(--shuffle-r)); }
 60% { transform: translateX(calc(var(--split-x) * -1)) rotate(calc(var(--shuffle-r) * -1)); }
}
@media (max-width: 600px) {
 .explore-ritual .shuffling .pick-card { animation: explore-shuffle-mobile 1.8s cubic-bezier(.4,0,.2,1) both; opacity: 1; }
 .explore-reveal .reveal-item > .reveal-position { margin: 6px 0 0; }
}
@keyframes explore-shuffle-mobile {
 0%, 100% { transform: none; }
 22%, 78% { transform: translate(var(--gather-x),var(--gather-y)) rotate(0deg) scale(.96); }
 42% { transform: translate(calc(var(--gather-x) + var(--split-x)),var(--gather-y)) rotate(var(--shuffle-r)) scale(.96); }
 60% { transform: translate(calc(var(--gather-x) - var(--split-x)),var(--gather-y)) rotate(calc(var(--shuffle-r) * -1)) scale(.96); }
}
@media (max-height: 650px) and (max-width: 600px) {
 .explore-ritual .fan { max-width: 240px; margin-top: 10px; margin-bottom: 8px; }
 .explore-ritual .explore-pages { margin: 0 0 4px; }
 .explore-ritual > p { font-size: var(--text-caption); }
 .explore-ritual .actions { margin-top: 10px; }
 .explore-reveal .reveal-item { max-width: 84px; }
 .explore-reveal .reveal-item > .reveal-position { font-size: var(--text-caption); }
}
@media (prefers-reduced-motion: reduce) {
 .explore-ritual .shuffling .pick-card { animation: none; }
}
/* Stable selection: only card state changes, without rebuilding the page. */
.explore-ritual h2 { min-height: 3em; display: flex; align-items: center; justify-content: center; }
.explore-ritual > p:not(.hint) { min-height: 3.4em; }
.explore-ritual .actions { min-height: 48px; }
.explore-ritual .selection { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px 12px; max-width: 340px; margin: auto; }
.explore-ritual .selection span { line-height: 1.6; }
.explore-ritual .pick-card:disabled { opacity: 1; }
.explore-ritual .pick-card.chosen { opacity: .35; }
.explore-reveal .flip-card:disabled { opacity: 1; cursor: default; }
.explore-reveal .flip-inner { transition: transform .65s cubic-bezier(.2,.65,.25,1); }
.explore-reveal .flip-inner > .card-front,
.explore-reveal .flip-inner > .card-back { -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.explore-reveal .flip-inner > .card-front { transform: rotateY(180deg) translateZ(1px); }
@media (prefers-reduced-motion: reduce) {
 .explore-reveal .flip-inner { transition: none; }
}
.explore-ritual { overflow-anchor: none; }
/* A visible current method; choices live in a modal sheet instead of extending the form. */
.exploration-selectors { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 0 0 14px; }
.exploration-selectors select[hidden] { display: none; }
.explore-page { --explore-ui-font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; --explore-control-size: 14px; }
.explore-page .method-trigger, .explore-page .method-sheet, .explore-page .question-window, .explore-page .field { font-family: var(--explore-ui-font); }
.method-trigger { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; width: 100%; min-height: 46px; padding: 10px; border: 1px solid #c9ad7744; border-radius: 10px; background: #c9ad7708; text-align: left; }
.method-trigger strong { display: block; min-width: 0; color: var(--gold); font-size: var(--explore-control-size); line-height: 1.5; font-weight: 400; letter-spacing: 0; white-space: nowrap; }
.method-chevron { color: var(--gold); font-size: 16px; flex-shrink: 0; }
.method-trigger:focus-visible, .method-choice:focus-visible, .method-sheet-close:focus-visible { outline: 1px solid var(--gold); outline-offset: 3px; }
html.method-sheet-open { overflow: hidden; }
dialog.method-sheet { position: fixed; inset: auto 0 0; box-sizing: border-box; width: 100%; max-width: 520px; max-height: 70vh; max-height: 70dvh; margin: 0 auto; padding: 0; overflow-x: hidden; overflow-y: auto; border: 1px solid #c9ad7755; border-bottom: 0; border-radius: 22px 22px 0 0; color: var(--ink); background: #281c33; box-shadow: 0 -16px 60px #100a1d66; }
dialog.method-sheet::backdrop { background: #100a1db3; }
.method-sheet-panel { padding: 10px 20px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.method-sheet-handle { width: 32px; height: 3px; margin: 0 auto 14px; border-radius: 4px; background: #c9ad7755; }
.method-sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.method-sheet-heading h3 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: .5px; }
.method-sheet-close { display: flex; align-items: center; justify-content: center; flex: 0 0 40px; width: 40px; height: 40px; margin-right: -8px; padding: 0; color: var(--muted); font-size: 26px; line-height: 1; }
.method-sheet-intro { margin: 0 0 16px; color: var(--muted); font-size: var(--text-label); line-height: 1.6; }
.method-choices { display: grid; gap: 9px; }
.method-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 76px; padding: 13px 14px; border: 1px solid #ad8ec233; border-radius: 12px; background: #20162966; text-align: left; }
.method-choice[aria-pressed="true"] { border-color: #c9ad7799; background: #c9ad770e; }
.method-choice-copy { min-width: 0; }
.method-choice strong { color: var(--ink); font-size: 14px; line-height: 1.5; font-weight: 500; }
.method-choice[aria-pressed="true"] strong { color: var(--gold); }
.method-choice strong small { color: var(--muted); font-size: var(--text-caption); font-weight: 400; white-space: nowrap; }
.method-choice-copy > span { display: block; margin-top: 4px; font-size: var(--text-label); line-height: 1.5; color: var(--muted); }
.method-check { width: 20px; flex: 0 0 20px; color: var(--gold); font-size: 18px; text-align: center; }
.method-sheet[open] { animation: method-sheet-in .24s cubic-bezier(.2,.75,.25,1); }
@keyframes method-sheet-in { from { transform: translateY(35px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@media(prefers-reduced-motion: reduce) { .method-sheet[open] { animation: none; } }

.method-sheet-note { margin: 16px 0 0; color: var(--muted); font-size: var(--text-caption); line-height: 1.7; }
@media(max-width:360px) { .explore-page { --explore-control-size: 13px; } }

#context-sheet .method-choice { min-height: 64px; padding: 10px 14px; }
/* Symmetric navigation separates the page title from both actions. */
.page-navigation { display: grid; grid-template-columns: 64px minmax(0,1fr) 64px; align-items: center; width: 100%; height: 48px; margin: 0 0 16px; gap: 0; text-align: center; }
.page-back { display: inline-flex; justify-self: start; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; color: var(--muted); border-radius: 50%; }
.page-back:hover { color: var(--gold); }
.page-back svg { display: block; }
.page-navigation-title { min-width: 0; font-family: var(--serif); font-size: 16px; font-weight: 400; line-height: 1.5; letter-spacing: 0; color: var(--ink); text-align: center; cursor: default; }
.page-navigation-actions { display: flex; align-items: center; justify-content: flex-end; min-width: 0; width: 64px; min-height: 44px; }
.page-navigation-actions .share-reading { font-size: 14px; white-space: nowrap; }
#app > .page, #app > .result, #app > .explore-ritual, #app > .explore-reveal { padding-top: 0; }
.page-navigation + .page-head { margin-top: 0; }
.page-navigation + .page-head > h2 { margin-top: 0; }
.result > .page-navigation + .result-top { padding-top: 0; }
#moon-ribbon-demo .mr-header { border: 0; padding: 0; min-height: 48px; }
#moon-ribbon-demo .mr-header .page-navigation { width: 100%; }
#moon-ribbon-demo .mr-header .page-navigation > .page-navigation-title { display: block; font-size: 16px; color: var(--ink); }
#moon-ribbon-demo .mr-header .page-navigation > .page-navigation-actions { display: flex; }
#app > #moon-ribbon-demo .mr-table { padding-top: 0; }
@media(max-width:760px) {
 body > header { height: calc(56px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); }
 main { min-height: calc(100vh - 56px); }
}

.daily-share-actions .primary { width: 100%; min-height: 48px; border-radius: 12px; white-space: nowrap; }

/* Return visits keep the focus on the saved card and its analysis. */
.home-revisit {
 display: grid;
 grid-template-columns: minmax(0, 144px) minmax(0, 1fr);
 align-items: center;
 gap: clamp(18px, 6vw, 36px);
 max-width: 480px;
 margin: 32px auto 24px;
 padding: 24px;
}
.home-revisit-art { position: relative; width: 100%; aspect-ratio: var(--card-ratio); }
.home-revisit-art img { border-radius: 6px; }
.home-revisit h1 { margin: 0 0 8px; font: 400 clamp(19px, 4.8vw, 28px)/1.5 var(--serif); }
.home-revisit p { margin: 0 0 18px; color: var(--muted); }
.home-revisit .primary { min-height: 44px; padding-inline: 14px; }
.home-info { display: flex; justify-content: center; gap: 14px; margin-top: 4px; }
.home-info button { min-height: 44px; padding: 6px 12px; color: var(--muted); font-size: var(--text-label); }
.home-info button:hover { color: var(--ink); }
.history-undo {
 display: flex;
 align-items: center;
 justify-content: space-between;
 gap: 12px;
 margin: 0 0 16px;
 padding: 8px 12px;
 border: 1px solid var(--line);
 border-radius: 12px;
 color: var(--muted);
}
.history-undo button { min-height: 44px; padding: 8px 12px; }
.explore-result .reading-next { border-left: 2px solid var(--gold); }
@media (max-width: 480px) {
 .home-revisit { grid-template-columns: minmax(88px, 34%) minmax(0, 1fr); margin: 18px auto 10px; padding: 20px; }
 .home-revisit p { font-size: 14px; }
}

@media (max-height: 720px) {
 #share-poster { max-height: max(120px, calc(100dvh - 15rem)); object-fit: contain; }
}
