/* Reflow the reference components; never scale or crop the whole interface. */
html { background: #24221f; }
body { min-width: 320px; background: transparent; }
.viewport { width: 100%; max-width: none; aspect-ratio: auto; overflow: visible; }
.scene {
  position: relative; inset: auto; transform: none; width: min(100%, 1380px);
  height: auto; min-height: 100svh; margin: auto; padding: 28px 40px 48px;
  display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1.13fr);
  grid-template-rows: 64px auto auto auto auto 1fr; column-gap: 40px; row-gap: 20px;
  overflow: visible; isolation: auto;
}
.scenery { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: #24221f; }
.scenery-art { position: absolute; width: max(100vw, 66.6667svh); aspect-ratio: 2/3; left: 50%; top: 50%; transform: translate(-50%, -45%); }
.scenery .environment { position: absolute; inset: 0; width: 100%; height: 100%; z-index: auto; }
.scenery::after { content: ""; position: absolute; inset: 0; background: #17120d30; }
.scene > :not(.scenery):not(.ambient-petals) { min-width: 0; }
.sidebar { position: relative; inset: auto; grid-column: 1; grid-row: 1 / 7; width: auto; height: auto; }
.hamburger { left: 0; top: 8px; width: 44px; height: 44px; }
.brand { left: 0; top: 104px; width: 56px; height: 167px; }
.side-intro { left: 0; top: 310px; font-size: 14px; line-height: 26px; }
.side-links { left: 0; top: 404px; gap: 8px; }
.side-links button { font-size: 13px; min-height: 36px; letter-spacing: .5px; }
.hero-copy { position: static; grid-column: 2; grid-row: 2; padding: 24px 0 4px; }
.hero-copy h1 { font-size: clamp(26px, 2.1vw, 32px); line-height: 1.65; letter-spacing: 3px; }
.hero-copy p { position: static; width: auto; margin-top: 20px; font-size: 16px; line-height: 1.9; letter-spacing: 1.2px; }
.persona-choice { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; max-width: 100%; margin-top: 16px; padding: 4px 0; color: #f1dec0; font-size: 14px; line-height: 1.6; text-align: left; }
.persona-choice span:last-child { font-size: 12px; white-space: nowrap; opacity: .8; }
.persona-choice:hover { color: #fff3dd; }
.persona-choice:disabled { opacity: .65; cursor: wait; }
.toolbar { top: 36px; width: 44px; height: 44px; }
.search-control { left: auto; right: 96px; }
.search-control svg { width: 24px; height: 24px; }
.quiet-control { left: auto; right: 40px; font-size: 22px; }
.side-verse { display: none; }
.question-form { position: relative; inset: auto; grid-column: 2; grid-row: 5; width: 100%; height: 64px; border-radius: 16px; align-self: end; }
.question-flower { left: 18px; top: 18px; width: 32px; height: 28px; }
.question-form input { position: static; margin-left: 64px; width: calc(100% - 116px); height: 48px; font-size: 16px; line-height: normal; letter-spacing: .4px; }
.question-submit { right: 3px; top: 8px; width: 44px; height: 48px; }
.category-tabs { position: static; grid-column: 2; grid-row: 4; width: 100%; height: auto; gap: 4px 16px; flex-wrap: wrap; justify-content: flex-start; }
.category-tabs button:nth-child(n) { position: relative; inset: auto; font-size: 14px; height: 44px; line-height: 44px; letter-spacing: .5px; }
.fortune-card { position: relative; inset: auto; grid-column: 3; grid-row: 2 / 6; align-self: center; width: 100%; height: auto; aspect-ratio: 605/548; container-type: inline-size; border-radius: 22px; }
.fortune-card h2 { left: 39.83%; top: 6.2%; font-size: 3.22cqw; line-height: 1.5; letter-spacing: .76cqw; }
.fortune-date { left: auto; right: 6%; top: 7.3%; font-size: 2.23cqw; line-height: 1.6; letter-spacing: .05cqw; }
.p1 { left: 62.15%; top: 16.97%; width: 7.27%; height: 28.65%; }
.p2 { left: 51.24%; top: 17.88%; width: 7.27%; height: 44.16%; }
.p3 { left: 40.5%; top: 26.28%; width: 7.1%; height: 30.29%; }
.p4 { left: 30.74%; top: 33.58%; width: 7.44%; height: 37.23%; }
.poem-text { font-size: 5.62cqw; line-height: 7.27cqw; letter-spacing: .99cqw; }
.poem-arrow { top: 36.13%; width: 44px; height: 44px; }
.previous { left: 3.8%; }.next { right: 3.97%; }
.fortune-caption { left: 0; top: 76.46%; width: 100%; text-align: center; font-size: 2.48cqw; line-height: 1.6; letter-spacing: .28cqw; }
.read-button { left: 19.17%; top: 83.39%; width: 62.31%; height: 11.86%; min-height: 44px; }
.read-button span { position: static; display: block; text-align: center; padding-right: 10px; font-size: 3.3cqw; line-height: 1.5; letter-spacing: .33cqw; }
.read-button svg { left: auto; right: 6%; top: calc(50% - 10px); width: 20px; height: 20px; }
.action-tiles { position: static; grid-column: 2; grid-row: 3; width: 100%; height: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.action-tile { position: relative; inset: auto; width: 100%; height: 128px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.action-tile img { position: static; width: 42px; height: 40px; object-fit: contain; }
.action-tile span { position: static; font-size: 14px; line-height: 1.7; letter-spacing: .3px; }
.feature-banner { position: relative; inset: auto; grid-column: 3; grid-row: 6; width: 100%; height: 132px; align-self: start; }
.feature-title { left: 24px; top: 18px; font-size: 19px; line-height: 1.55; letter-spacing: 1px; }
.feature-sub { left: 24px; top: auto; bottom: 17px; font-size: 12px; line-height: 1.6; letter-spacing: .4px; }
.feature-arrow { left: auto; right: 24px; top: 45px; width: 36px; height: 36px; }
.bottom-rail { position: static; grid-column: 2 / 4; grid-row: 1; width: calc(100% - 128px); height: 64px; background: none; border-bottom: 1px solid #e8d3b52b; }
.bottom-rail nav { position: static; width: min(100%, 540px); height: 64px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bottom-item { height: 64px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.bottom-item:nth-child(n) img { position: static; width: 24px; height: 27px; object-fit: contain; }
.bottom-item span { position: static; font-size: 14px; line-height: 1.5; letter-spacing: .5px; }
.bottom-item i { left: calc(50% - 10px); top: auto; bottom: 0; width: 20px; height: 2px; border-radius: 0; }
.ambient-petals { position: fixed; z-index: 1; }
.plaque-motion-control { left: 4.9%; top: 45.6%; width: 11.1%; height: 15%; border-radius: 0; clip-path: polygon(0 14%, 53% 0, 96% 14%, 100% 96%, 14% 100%); pointer-events: auto; }
.toast { bottom: max(24px, env(safe-area-inset-bottom)); }
.app-dialog[open] { display: flex; flex-direction: column; overflow: hidden; max-height: min(88dvh, calc(var(--visible-height, 100dvh) - 32px), 900px); }
.dialog-heading, .dialog-footer { flex: none; }
.dialog-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.dialog-close { flex-basis: 44px; width: 44px; height: 44px; padding: 12px; }
.dialog-footer { padding-top: 12px; padding-bottom: 12px; }
.composer-persona { margin-bottom: 22px; }
.dialog-body .composer-help { margin: 10px 0 0; }
.reading-stream { overflow-anchor: none; }
body:has(.app-dialog[open]) { overflow: hidden; }
.keyboard-open .bottom-rail { visibility: hidden; }
@media (min-width: 1051px) and (min-height: 850px) {
  .scene { padding-top: 44px; row-gap: 28px; }
  .toolbar { top: 52px; }
  .hero-copy { padding-top: 40px; }
}
@media (max-width: 1050px) {
  html { scroll-padding-bottom: calc(176px + env(safe-area-inset-bottom)); }
  .scene { width: min(100%, 680px); padding: max(20px, env(safe-area-inset-top)) 24px calc(192px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; }
  .sidebar { height: 76px; width: 100%; flex: none; }
  .hamburger { top: 10px; }
  .brand { left: 60px; top: 0; width: 25px; height: 75px; }
  .side-intro, .side-links { display: none; }
  .toolbar { top: calc(max(20px, env(safe-area-inset-top)) + 10px); }
  .search-control { right: 80px; }.quiet-control { right: 24px; }
  .hero-copy { padding: 6px 8px 0; }
  .hero-copy h1 { font-size: 28px; line-height: 1.65; letter-spacing: 3px; }
  .hero-copy p { margin-top: 14px; font-size: 15px; line-height: 1.85; }
  .question-form { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 32px), 632px); z-index: 11; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
  .keyboard-open .question-form { top: calc(var(--visible-top, 0px) + var(--visible-height, 100dvh) - 76px); bottom: auto; }
  .category-tabs { flex: none; flex-wrap: nowrap; overflow-x: auto; gap: 22px; scrollbar-width: thin; padding-bottom: 3px; }
  .category-tabs button { flex: none; }
  .fortune-card { flex: none; }
  .fortune-card h2 { font-size: max(14px, 3.22cqw); letter-spacing: 2px; }
  .fortune-date { font-size: max(10px, 2.23cqw); right: 4%; }
  .fortune-caption { font-size: max(12px, 2.48cqw); }
  .read-button span { font-size: max(14px, 3.3cqw); }
  .action-tiles { flex: none; gap: 10px; }
  .feature-banner { flex: none; height: 140px; }
  .bottom-rail { position: fixed; inset: auto 0 0; z-index: 10; width: 100%; height: calc(76px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #27211ef2; border-top: 1px solid #d4bd883d; backdrop-filter: blur(16px); }
  .bottom-rail nav { height: 76px; margin: auto; width: min(100%, 640px); }
  .bottom-item { height: 76px; flex-direction: column; gap: 4px; }
  .bottom-item span { font-size: 12px; }
  .bottom-item:nth-child(n) img { width: 27px; height: 29px; }
  .bottom-item i { bottom: 5px; }
  .scenery-art { transform: translate(-50%, -50%); }
  .toast { bottom: calc(166px + env(safe-area-inset-bottom)); }
}
@media (max-width: 440px) {
  .scene { padding-left: 16px; padding-right: 16px; gap: 18px; }
  .quiet-control { right: 16px; }.search-control { right: 70px; }
  .hero-copy h1 { font-size: 25px; }
  .question-form { height: 60px; }
  .question-form input { margin-left: 52px; width: calc(100% - 100px); }
  .question-flower { left: 13px; width: 28px; height: 25px; }
  .question-submit { top: 6px; }
  .fortune-card { margin-top: 2px; }
  .fortune-card h2 { left: 35%; top: 5.5%; }
  .fortune-date { top: 13%; right: 8%; font-size: 10px; }
  .read-button { left: 16%; width: 68%; top: 82%; }
  .read-button span { font-size: 14px; letter-spacing: 0; }
  .action-tiles { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-tile { height: 82px; flex-direction: row; gap: 10px; }
  .action-tile img { width: 36px; height: 34px; }
  .action-tile span { font-size: 14px; text-align: left; }
  .feature-title { left: 20px; font-size: 18px; }
  .feature-sub { left: 20px; font-size: 11px; }
  .feature-arrow { right: 18px; width: 32px; height: 32px; }
  .dialog-heading, .dialog-body { padding: 20px 18px; }
}
@media (max-width: 600px) {
  .scene { gap: 16px; }
  .sidebar { height: 60px; }
  .brand { width: 20px; height: 60px; }
  .hero-copy h1 { font-size: 24px; line-height: 1.5; }
  .hero-copy p { margin-top: 10px; font-size: 14px; }
  .persona-choice { margin-top: 8px; }
  .app-dialog { position: fixed; top: calc(var(--visible-top, 0px) + 8px); bottom: auto; width: calc(100% - 16px); margin: 0 auto; border-radius: 16px; }
  .app-dialog[open] { max-height: calc(var(--visible-height, 100dvh) - 16px); }
  .dialog-heading { padding: 16px; align-items: center; }
  .dialog-heading h2 { font-size: 19px; }
  .dialog-body { padding: 18px 16px; }
  .dialog-footer { padding: 10px 16px; font-size: 10px; }
  .dialog-poem { padding-top: 8px; padding-bottom: 16px; }
}
