:root {
  --night-1: #07182d;
  --night-2: #142247;
  --temple-red: #b7352e;
  --seal-red: #b51f18;
  --gold: #e5b85b;
  --gold-soft: #ffe0a0;
  --paper: #f7e8bd;
  --paper-deep: #ead59e;
  --paper-ink: #2c1b12;
  --cream: #fff7dc;
  --cream-muted: #e7d2a6;
  --jade: #42695f;
  --line: rgba(229, 184, 91, 0.34);
  --shadow: 0 22px 68px rgba(4, 10, 22, 0.38);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--night-1);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--cream);
  font-family: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(229, 184, 91, 0.16), transparent 26rem),
    linear-gradient(160deg, var(--night-1), var(--night-2));
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.app-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
}

.night-sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.night-sky::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 248, 231, 0.14) 0 1px, transparent 2px),
    radial-gradient(circle at 66% 28%, rgba(255, 248, 231, 0.16) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 18%, rgba(232, 182, 76, 0.14) 0 1px, transparent 2px);
  background-size: 190px 170px, 240px 220px, 310px 260px;
}

.star {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 0 0 14px rgba(255, 248, 231, 0.9);
  opacity: 0.72;
  will-change: opacity, transform;
}

.star-a { left: 12%; top: 16%; }
.star-b { left: 34%; top: 10%; }
.star-c { left: 74%; top: 18%; }
.star-d { left: 88%; top: 35%; }
.star-e { left: 18%; top: 48%; }
.star-f { left: 58%; top: 40%; }

.scene-stack {
  position: relative;
  z-index: 1;
  min-height: 100svh;
}

.scene {
  min-height: 100svh;
  padding: 24px 18px 28px;
}

.scene[hidden] {
  display: none;
}

.scene-inner {
  width: min(100%, 1040px);
  margin: 0 auto;
  position: relative;
}

.scene-home {
  position: relative;
  isolation: isolate;
  background: #08172b url("../assets/hero-bg.jpg") center / cover no-repeat;
}

.scene-home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(5, 12, 24, 0.74), rgba(5, 12, 24, 0.48) 48%, rgba(5, 12, 24, 0.28)),
    linear-gradient(0deg, rgba(5, 12, 24, 0.38), rgba(5, 12, 24, 0.12));
}

.narrow-inner {
  width: min(100%, 860px);
  padding-top: clamp(46px, 12vh, 110px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold-soft);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-title,
.scene-title,
.topic-title,
.lot-title,
.poem-lines li,
.slip-topline {
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  letter-spacing: 0;
}

.home-inner {
  min-height: calc(100svh - 206px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 62px 0 30px;
}

.hero-title {
  margin: 0;
  font-size: clamp(3.4rem, 18vw, 7.2rem);
  line-height: 0.95;
  color: var(--cream);
  text-shadow:
    0 2px 0 rgba(229, 184, 91, 0.58),
    0 0 24px rgba(255, 207, 103, 0.22),
    0 20px 60px rgba(0, 0, 0, 0.5);
}

.hero-copy {
  width: min(100%, 29rem);
  margin: 22px 0 28px;
  color: #fff1cd;
  font-size: clamp(1.04rem, 4.5vw, 1.3rem);
  line-height: 1.8;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.mirror-note {
  width: min(100%, 30rem);
  margin: 18px 0 0;
  color: #ead9b8;
  line-height: 1.7;
}

.primary-btn,
.secondary-btn,
.topic-btn,
.topic-chip,
.text-link {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn {
  min-width: 156px;
  padding: 13px 22px;
  background: linear-gradient(180deg, #ffd576, #e6b24d);
  color: #24140b;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(229, 184, 91, 0.28);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(229, 184, 91, 0.34);
}

.primary-btn:active,
.secondary-btn:active,
.topic-btn:active,
.topic-chip:active {
  transform: translateY(1px);
}

.secondary-btn {
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 231, 0.08);
  color: var(--cream);
  font-weight: 800;
}

.secondary-btn:hover:not(:disabled) {
  background: rgba(255, 248, 231, 0.14);
}

.text-link {
  min-height: 0;
  padding: 2px 0;
  border-radius: 0;
  background: transparent;
  color: #ffe0a0;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.6;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.text-link:hover {
  color: #fff4cf;
}

.home-history-link {
  margin-top: 14px;
}

.guide-card {
  width: min(100%, 360px);
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 224, 160, 0.34);
  border-radius: 8px;
  background: rgba(7, 24, 45, 0.72);
  color: var(--cream);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.home-guide-card {
  margin-top: 22px;
}

.ritual-guide-card {
  margin-top: 2px;
  text-align: left;
}

.draw-guide-card {
  margin-top: -4px;
}

.guide-img {
  display: block;
  width: 76px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 224, 160, 0.28);
}

.guide-copy {
  min-width: 0;
}

.guide-name {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--gold-soft);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.2;
}

.guide-copy p {
  margin: 0;
  color: #fff0c9;
  font-size: 0.94rem;
  line-height: 1.55;
}

.result-guide-card {
  width: min(100%, 430px);
  justify-self: stretch;
  background: rgba(255, 248, 231, 0.1);
}

.redline-card {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  width: min(calc(100vw - 32px), 330px);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 0;
  padding: 10px;
  border: 1px solid rgba(255, 224, 160, 0.46);
  border-radius: 8px;
  background: rgba(43, 12, 28, 0.9);
  color: var(--cream);
  text-align: left;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.redline-card[hidden] {
  display: none;
}

.redline-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #ffe0e4;
  line-height: 1.55;
}

.redline-copy > span:last-child {
  font-size: 0.92rem;
}

.lantern-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.lantern {
  position: absolute;
  width: 78px;
  filter: drop-shadow(0 0 28px rgba(201, 67, 61, 0.42));
  transform-origin: 50% 0%;
  will-change: transform;
}

.lantern-left {
  left: 5%;
  top: 14px;
}

.lantern-right {
  right: 2%;
  top: 82px;
  width: 66px;
}

.scene-title {
  margin: 0 0 18px;
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 1.12;
}

#topic-title {
  font-size: clamp(1.6rem, 6vw, 2.5rem);
}

.scene-copy {
  margin: 0 auto;
  color: #f2e6cb;
  font-size: 1.08rem;
  line-height: 1.85;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.topic-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 248, 231, 0.09);
  color: var(--cream);
  text-align: left;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.16);
}

.topic-btn:hover {
  border-color: var(--gold-soft);
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(229, 184, 91, 0.3);
}

.topic-btn.is-selected {
  border-color: var(--gold-soft);
  box-shadow:
    0 0 0 2px rgba(229, 184, 91, 0.22),
    0 16px 40px rgba(229, 184, 91, 0.28);
}

.topic-img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: filter 0.18s ease;
}

.topic-btn:hover .topic-img {
  filter: brightness(1.08);
}

.topic-copy {
  display: block;
  width: 100%;
  padding: 12px 14px 13px;
  min-width: 0;
}

.topic-title {
  display: block;
  margin-bottom: 5px;
  font-weight: 900;
  font-size: clamp(1.05rem, 3.6vw, 1.15rem);
  line-height: 1.25;
  white-space: nowrap;
}

.topic-desc {
  display: block;
  color: var(--cream-muted);
  font-size: 0.85rem;
  line-height: 1.35;
  white-space: nowrap;
}

.breathe-inner,
.draw-inner {
  min-height: calc(100svh - 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}

.breath-orb-wrap {
  width: min(68vw, 250px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 10px 0;
}

.breath-orb {
  width: 68%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 224, 160, 0.5);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(229, 184, 91, 0.24), rgba(229, 184, 91, 0.06) 58%, transparent 68%);
  box-shadow: 0 0 60px rgba(229, 184, 91, 0.16);
  will-change: transform;
}

.breath-orb span {
  width: 38%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(255, 248, 231, 0.78);
  box-shadow: 0 0 34px rgba(255, 248, 231, 0.56);
}

.ready-btn {
  visibility: hidden;
}

.draw-stage {
  width: min(100%, 340px);
  min-height: 360px;
  position: relative;
  display: grid;
  place-items: center;
}

.fortune-tube-wrap {
  position: relative;
  width: min(78vw, 286px);
  height: 330px;
  display: grid;
  grid-template-rows: 100%;
  place-items: center;
  filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.34));
  will-change: transform;
  touch-action: none;
  cursor: pointer;
  -webkit-touch-callout: none;
  user-select: none;
}

.tube-art,
.fortune-tube,
.tube-stick-layer {
  grid-area: 1 / 1;
}

.tube-art {
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.fortune-tube {
  width: min(78vw, 280px);
  overflow: visible;
}

.fortune-tube[hidden] {
  display: none;
}

.tube-stick-layer {
  width: min(78vw, 280px);
  overflow: visible;
  pointer-events: none;
}

.stick,
.chosen-stick,
.chosen-stick-mark,
.jiao-cup {
  will-change: transform, opacity;
  transform-box: fill-box;
  transform-origin: center;
}

.chosen-stick,
.chosen-stick-mark {
  opacity: 0;
}

.jiao-area {
  position: absolute;
  inset: auto 0 2px;
  height: 104px;
  pointer-events: none;
}

.jiao-cup {
  position: absolute;
  width: 78px;
  opacity: 0;
}

.jiao-front {
  left: calc(50% - 90px);
  bottom: 12px;
}

.jiao-back {
  right: calc(50% - 90px);
  bottom: 12px;
}

.jiao-cup[data-side="front"] .cup-face,
.jiao-cup:not([data-side]) .cup-face {
  fill: #c9433d;
}

.jiao-cup[data-side="front"] .cup-ridge,
.jiao-cup:not([data-side]) .cup-ridge {
  stroke: #f0b2a8;
}

.jiao-cup[data-side="back"] .cup-face {
  fill: #7f1f28;
}

.jiao-cup[data-side="back"] .cup-ridge {
  stroke: #e8b64c;
}

.draw-status {
  position: relative;
  z-index: 1;
  width: min(100%, 32rem);
  min-height: 3em;
  margin: 0;
  color: #fdf0d2;
  font-size: clamp(1.08rem, 4.4vw, 1.28rem);
  font-weight: 600;
  line-height: 1.7;
}

.shake-btn {
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.result-inner {
  padding-top: 18px;
  padding-bottom: 34px;
}

.daily-notice {
  width: fit-content;
  margin: 0 auto 14px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 224, 160, 0.38);
  border-radius: 8px;
  background: rgba(255, 248, 231, 0.12);
  color: #fff0c9;
  line-height: 1.5;
}

.result-layout {
  display: grid;
  gap: 18px;
  align-items: start;
}

.poem-slip {
  width: min(100%, 312px);
  min-height: min(76svh, 720px);
  margin: 0 auto;
  padding: 18px 16px 20px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 14px;
  color: var(--paper-ink);
  background:
    linear-gradient(rgba(247, 232, 189, 0.86), rgba(247, 232, 189, 0.88)),
    url("../assets/paper-texture.jpg") center / cover;
  border: 3px double var(--seal-red);
  box-shadow: var(--shadow), inset 0 0 0 7px rgba(181, 31, 24, 0.08);
}

.slip-topline {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6c1714;
  font-weight: 900;
  font-size: 0.96rem;
  line-height: 1.45;
  text-align: center;
}

.poem-lines {
  list-style: none;
  margin: 0;
  padding: 10px 6px;
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 4vw, 22px);
  min-height: 410px;
}

.poem-lines li {
  writing-mode: vertical-rl;
  text-orientation: upright;
  margin: 0;
  color: #2a130e;
  font-size: clamp(1.55rem, 7vw, 2.02rem);
  font-weight: 700;
  line-height: 1.42;
  text-align: start;
}

.direction-line {
  margin: 0;
  color: #7f3a24;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

.seal-img {
  width: 74px;
  height: 74px;
  justify-self: center;
  object-fit: contain;
}

.result-copy {
  display: grid;
  gap: 14px;
}

.tone-badge {
  position: relative;
  justify-self: start;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px 10px;
  border-radius: 24px 24px 18px 18px;
  --tone-top: #d94838;
  --tone-bottom: #a9221e;
  color: #fff4cf;
  background: linear-gradient(180deg, var(--tone-top), var(--tone-bottom));
  box-shadow: 0 12px 26px rgba(181, 31, 24, 0.25);
  font-weight: 900;
  white-space: nowrap;
}

.tone-badge[data-tone="bright"],
.history-tone[data-tone="bright"] {
  --tone-top: #d94838;
  --tone-bottom: #a9221e;
}

.tone-badge[data-tone="rising"],
.history-tone[data-tone="rising"] {
  --tone-top: #d97f38;
  --tone-bottom: #a9561e;
}

.tone-badge[data-tone="steady"],
.history-tone[data-tone="steady"] {
  --tone-top: #4a7a6d;
  --tone-bottom: #31544a;
}

.tone-badge[data-tone="deep"],
.history-tone[data-tone="deep"] {
  --tone-top: #4a5390;
  --tone-bottom: #333a6b;
}

.tone-badge::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 38px;
  height: 9px;
  border-radius: 8px 8px 2px 2px;
  background: var(--gold);
  transform: translateX(-50%);
}

.tone-badge::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  width: 2px;
  height: 16px;
  background: var(--gold);
  box-shadow: -7px 3px 0 -0.5px var(--gold), 7px 3px 0 -0.5px var(--gold);
  transform: translateX(-50%);
}

.result-sections {
  display: grid;
  gap: 12px;
}

.origin-block {
  border: 1px dashed rgba(120, 63, 34, 0.42);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(247, 232, 189, 0.5);
  color: var(--paper-ink);
}

.origin-block > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  color: #7a3f22;
  letter-spacing: 0.02em;
}

.origin-block > summary::-webkit-details-marker {
  display: none;
}

.origin-mark {
  margin-right: 4px;
}

.origin-hint {
  margin-left: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(120, 63, 34, 0.72);
}

.origin-block[open] > summary {
  margin-bottom: 8px;
}

.origin-block > p {
  margin: 0;
  line-height: 1.9;
  font-family: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  color: #3a2415;
}

.result-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(120, 63, 34, 0.26);
  border-radius: 8px;
  padding: 14px;
  color: var(--paper-ink);
  background:
    linear-gradient(rgba(250, 237, 201, 0.9), rgba(250, 237, 201, 0.92)),
    url("../assets/paper-texture.jpg") center / cover;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

.result-panel h3 {
  min-width: 38px;
  margin: 0;
  padding: 9px 7px;
  border-radius: 6px;
  background: var(--seal-red);
  color: #ffe7a1;
  font-size: 0.92rem;
  line-height: 1.35;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.result-panel h3 span {
  color: #ffe7a1;
  font-size: 0.82rem;
  font-weight: 700;
}

.result-panel p {
  margin: 0;
  color: #352016;
  line-height: 1.82;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 2px 0 0;
}

.again-wrap {
  display: grid;
  gap: 8px;
}

.daily-lock-note {
  margin: 0;
  color: var(--cream-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.again-note {
  margin: 0;
  color: var(--cream-muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.topic-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.topic-switcher[hidden] {
  display: none;
}

.result-footer {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.footer-line {
  margin: 0;
  color: #f4dfb8;
  font-size: 0.95rem;
  line-height: 1.7;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
}

.topic-chip {
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid rgba(229, 184, 91, 0.3);
  background: rgba(255, 248, 231, 0.08);
  color: var(--cream);
  font-weight: 800;
}

.topic-chip.is-selected {
  background: var(--gold);
  color: #24140b;
}

.history-inner {
  padding-bottom: 48px;
}

.history-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 22px 0 24px;
  padding: 0;
}

.history-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(7.5rem, 1fr) auto auto;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 248, 231, 0.08);
  color: var(--cream);
  text-align: left;
}

.history-row:hover {
  border-color: var(--gold-soft);
  background: rgba(255, 248, 231, 0.13);
}

.history-date,
.history-lot,
.history-topic {
  line-height: 1.45;
}

.history-date {
  color: #ffe0a0;
  font-weight: 900;
  white-space: nowrap;
}

.history-lot {
  min-width: 0;
  font-weight: 900;
}

.history-tone {
  --tone-top: #d94838;
  --tone-bottom: #a9221e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.2em;
  min-height: 28px;
  padding: 4px 9px 5px;
  border-radius: 999px;
  color: #fff4cf;
  background: linear-gradient(180deg, var(--tone-top), var(--tone-bottom));
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.history-topic {
  color: var(--cream-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.history-empty {
  margin: 24px 0;
  color: var(--cream-muted);
  line-height: 1.8;
}

@media (min-width: 700px) {
  .scene {
    padding: 32px 28px 36px;
  }

  .home-inner {
    min-height: calc(100svh - 188px);
    padding-left: 5vw;
  }

  .lantern {
    width: 96px;
  }

  .lantern-right {
    width: 82px;
    right: 8%;
  }

  .topic-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }

  .result-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .topic-switcher {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .home-inner {
    padding-left: 3vw;
  }
  .result-inner {
    width: min(100%, 1080px);
  }

  .result-layout {
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 28px;
  }

  .result-guide-card {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .result-guide-card .guide-img {
    width: 86px;
  }

  .poem-slip {
    position: sticky;
    top: 24px;
    min-height: min(82svh, 740px);
  }

  .result-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .scene {
    padding-left: 14px;
    padding-right: 14px;
  }

  .poem-slip {
    min-height: 650px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .poem-lines {
    gap: 10px;
    min-height: 392px;
  }

  .result-panel {
    grid-template-columns: 1fr;
  }

  .result-panel h3 {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    width: fit-content;
    min-width: 0;
    padding: 6px 10px;
  }

  .history-row {
    grid-template-columns: 1fr auto;
  }

  .history-lot,
  .history-topic {
    grid-column: 1 / -1;
  }

  .history-tone {
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
