:root {
  --sea-950: #04171f;
  --sea-900: #061c25;
  --sea-850: #082630;
  --sea-800: #0b3038;
  --sea-760: #103b42;
  --paper-100: #eee8db;
  --paper-200: #d8d3c8;
  --celadon-300: #a7c6b8;
  --celadon-400: #86afa0;
  --celadon-600: #557f73;
  --brass-300: #dfc47d;
  --brass-400: #c6a45a;
  --brass-600: #80672f;
  --cinnabar-500: #b94335;
  --cinnabar-600: #943226;
  --line-soft: rgba(198, 164, 90, 0.26);
  --line-quiet: rgba(167, 198, 184, 0.16);
  --ink-shadow: rgba(0, 7, 10, 0.45);
  --focus-ring: #f4d587;
  --ease-product: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  background: var(--sea-950);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 75% 14%, rgba(24, 73, 76, 0.34), transparent 34rem),
    linear-gradient(145deg, var(--sea-950), var(--sea-900) 38%, #06212a);
  color: var(--paper-100);
  font-family: Aptos, "Noto Sans TC", "Microsoft JhengHei", ui-sans-serif, system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    radial-gradient(circle, rgba(238, 232, 219, 0.18) 0 0.45px, transparent 0.75px),
    radial-gradient(circle, rgba(0, 4, 6, 0.46) 0 0.55px, transparent 0.85px);
  background-position: 0 0, 5px 7px;
  background-size: 9px 11px, 13px 17px;
  mix-blend-mode: soft-light;
}

::selection {
  background: rgba(198, 164, 90, 0.34);
  color: var(--paper-100);
}

button,
textarea {
  font: inherit;
}

button,
a,
textarea,
input {
  outline: none;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible + strong {
  box-shadow: 0 0 0 3px var(--sea-900), 0 0 0 5px var(--focus-ring);
}

h1,
h2,
h3,
.slot-label,
.card-nameplate strong {
  font-family: "Iowan Old Style", "Noto Serif TC", "Songti TC", PMingLiU, serif;
  text-wrap: balance;
}

.skip-link {
  border-radius: 4px;
  background: var(--paper-100);
  color: var(--sea-950);
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.topbar {
  position: relative;
  z-index: 10;
  min-height: 66px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(4, 23, 31, 0.82);
}

.brand-link {
  color: var(--brass-300);
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: auto;
  height: auto;
  border: 0;
  color: var(--brass-300);
  font-size: 1.15rem;
}

.topbar-meta {
  gap: 20px;
  color: var(--celadon-300);
  font-size: 0.78rem;
}

.deck-count::before {
  width: 5px;
  height: 5px;
  background: var(--celadon-400);
}

.text-button {
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--brass-600);
  border-radius: 0;
  background: transparent;
  color: var(--brass-300);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease;
}

.text-button:hover {
  border-color: var(--brass-300);
  color: var(--paper-100);
}

main {
  position: relative;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-rows: minmax(680px, calc(100vh - 66px)) auto;
}

.reading-surface {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 680px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.hero {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  padding: 42px 28px 28px;
  border-right: 1px solid var(--line-soft);
  background: rgba(5, 28, 36, 0.72);
}

.hero-copy {
  max-width: none;
  padding: 0 4px 26px;
}

.hero-symbol,
.hero-copy > p {
  display: none;
}

.hero h1 {
  position: relative;
  max-width: none;
  margin: 0;
  padding-bottom: 17px;
  color: var(--paper-100);
  font-size: 2.15rem;
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: 0.08em;
}

.hero h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 148px;
  height: 1px;
  background: linear-gradient(90deg, var(--brass-400), transparent);
}

.setup-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.field-label {
  order: 0;
  display: block;
  margin: 0 0 8px;
  color: var(--celadon-400);
  font-size: 0.82rem;
  font-weight: 700;
}

#question {
  order: 1;
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: 14px 15px 28px;
  border: 1px solid rgba(167, 198, 184, 0.4);
  border-radius: 5px;
  background: rgba(2, 18, 25, 0.52);
  color: var(--paper-100);
  font-size: 0.9rem;
  line-height: 1.7;
  transition: border-color 180ms ease, background 180ms ease;
}

#question:hover,
#question:focus {
  border-color: var(--celadon-400);
  background: rgba(3, 22, 29, 0.8);
}

#question::placeholder {
  color: #aebdb9;
  opacity: 1;
}

.field-meta {
  order: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: -25px 10px 18px;
  color: var(--celadon-300);
  font-size: 0.7rem;
  pointer-events: none;
}

.field-meta > span:first-child {
  opacity: 0;
}

.spread-fieldset {
  order: 3;
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.spread-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.spread-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(167, 198, 184, 0.4);
  border-radius: 5px;
}

.spread-option {
  position: relative;
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: rgba(4, 25, 32, 0.54);
  color: var(--paper-200);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.spread-option + .spread-option {
  border-left: 1px solid rgba(167, 198, 184, 0.3);
}

.spread-option:hover {
  background: rgba(134, 175, 160, 0.12);
}

.spread-option:has(input:checked) {
  background: var(--celadon-400);
  color: var(--sea-950);
}

.spread-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.spread-option strong {
  font-size: 0.82rem;
  font-weight: 760;
}

.spread-option span {
  display: none;
}

.primary-button {
  order: 4;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid #d06556;
  border-radius: 5px;
  background: var(--cinnabar-500);
  color: #fff4e7;
  font-family: "Iowan Old Style", "Noto Serif TC", serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms var(--ease-product);
}

.primary-button:hover {
  background: #c94e3d;
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.mobile-action-label {
  display: none;
}

.rail-history {
  margin: auto 4px 0;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
}

.rail-history summary {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  color: var(--celadon-400);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  list-style: none;
  cursor: pointer;
}

.rail-history summary::-webkit-details-marker {
  display: none;
}

.history-disclosure {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.rail-history[open] .history-disclosure {
  transform: rotate(225deg);
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-entry {
  max-width: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid rgba(167, 198, 184, 0.34);
  border-radius: 5px;
  background: rgba(3, 21, 28, 0.42);
  color: var(--celadon-300);
  font-size: 0.7rem;
}

.history-thumb {
  width: 44px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--sea-850);
}

.history-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

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

.history-entry strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--paper-100);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-entry time {
  display: block;
  margin-top: 4px;
  color: var(--celadon-400);
  font-size: 0.64rem;
}

.seal-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin: 22px 4px 0;
  border: 2px solid var(--cinnabar-500);
  color: #dc5d4d;
  font-family: "Noto Serif TC", PMingLiU, serif;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  transform: rotate(-2deg);
}

.reading-table {
  position: relative;
  isolation: isolate;
  grid-column: auto;
  grid-row: auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  margin: 0;
  padding: 26px clamp(24px, 4vw, 60px) 28px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgba(5, 28, 36, 0.28);
  box-shadow: none;
}

.reading-table::before {
  content: "";
  position: absolute;
  inset: 16px;
  z-index: -1;
  border: 1px solid rgba(198, 164, 90, 0.15);
  border-radius: 0;
  pointer-events: none;
}

.table-head {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
}

.table-head h2 {
  margin: 0;
  color: var(--paper-200);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.table-head p {
  margin: 3px 0 0;
  color: var(--celadon-300);
  font-size: 0.7rem;
}

.reading-status {
  min-width: 78px;
  padding: 5px 9px;
  border: 1px solid rgba(167, 198, 184, 0.24);
  border-radius: 999px;
  background: rgba(3, 21, 28, 0.64);
  color: var(--celadon-300);
  font-size: 0.66rem;
}

.ritual-progress {
  --progress-scale: 0;
  position: relative;
  z-index: 3;
  width: min(680px, calc(100% - 48px));
  margin: 14px auto 0;
  padding-top: 8px;
}

.ritual-progress[data-state="shuffle"] { --progress-scale: 0.333; }
.ritual-progress[data-state="reveal"] { --progress-scale: 0.666; }
.ritual-progress[data-state="reading"] { --progress-scale: 1; }

.progress-track {
  position: absolute;
  top: 16px;
  left: 10%;
  right: 10%;
  height: 1px;
  overflow: hidden;
  background: rgba(198, 164, 90, 0.22);
}

.progress-track::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--celadon-600), var(--brass-300));
  transform: scaleX(var(--progress-scale));
  transform-origin: left center;
  transition: transform 360ms var(--ease-product);
}

.progress-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.progress-step {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: rgba(216, 211, 200, 0.54);
  font-size: 0.68rem;
  transition: color 220ms ease;
}

.progress-dot {
  width: 17px;
  height: 17px;
  border: 1px dashed var(--brass-600);
  border-radius: 50%;
  background: var(--sea-900);
  transition: background 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.progress-step.is-done {
  color: var(--celadon-400);
}

.progress-step.is-done .progress-dot {
  border-style: solid;
  border-color: var(--celadon-400);
  background: var(--celadon-600);
}

.progress-step.is-current {
  color: var(--brass-300);
}

.progress-step.is-current .progress-dot {
  border-style: solid;
  border-color: var(--brass-300);
  background: var(--brass-300);
  box-shadow: 0 0 0 5px rgba(198, 164, 90, 0.12);
}

.meridian-dial {
  position: absolute;
  top: 116px;
  left: 50%;
  z-index: -1;
  width: min(76vw, 900px);
  aspect-ratio: 1;
  border: 1px solid rgba(198, 164, 90, 0.18);
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.meridian-dial::before,
.meridian-dial::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.meridian-dial::before {
  inset: 28px;
  border: 1px solid rgba(198, 164, 90, 0.1);
}

.meridian-dial::after {
  inset: -10px;
  opacity: 0.42;
  background: repeating-conic-gradient(from -90deg, rgba(198, 164, 90, 0.34) 0 0.2deg, transparent 0.2deg 7.5deg);
  -webkit-mask: radial-gradient(circle, transparent 69%, #000 69.2% 69.5%, transparent 69.7%);
  mask: radial-gradient(circle, transparent 69%, #000 69.2% 69.5%, transparent 69.7%);
}

.deck-stage,
.spread-slots {
  position: relative;
  z-index: 2;
  min-height: 0;
}

.deck-stage {
  display: grid;
  place-items: center;
  padding: 24px 0 8px;
  text-align: center;
}

.deck-stack {
  width: clamp(150px, 16vw, 190px);
  margin-bottom: 20px;
}

.deck-layer {
  border-color: var(--brass-600);
  border-radius: 6px;
  box-shadow: 0 6px 8px var(--ink-shadow);
}

.deck-instruction {
  max-width: 40ch;
  color: var(--celadon-300);
  font-size: 0.76rem;
}

.reading-table.is-shuffling .deck-layer:nth-child(1) { transform: translate(-64px, 5px) rotate(-8deg); }
.reading-table.is-shuffling .deck-layer:nth-child(2) { transform: translate(60px, -2px) rotate(7deg); }
.reading-table.is-shuffling .deck-layer:nth-child(3) { transform: translate(-30px, -7px) rotate(-3deg); }
.reading-table.is-shuffling .deck-layer:nth-child(4) { transform: translate(29px, 5px) rotate(3deg); }

.spread-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 4.4vw, 64px);
  min-width: 0;
  padding: 20px 8px 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}

.card-slot {
  flex: 0 0 clamp(170px, 16vw, 220px);
  min-width: 0;
}

.slot-label {
  position: relative;
  min-height: 36px;
  margin-bottom: 10px;
  color: var(--brass-300);
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.slot-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 54px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brass-600), transparent);
  transform: translateX(-50%);
}

.tarot-card {
  border-radius: 6px;
}

.card-face {
  border-color: var(--brass-600);
  border-radius: 6px;
  box-shadow: 0 6px 8px var(--ink-shadow);
}

.tarot-card:hover .card-inner {
  transform: translateY(-4px);
}

.tarot-card.is-revealed:hover .card-inner {
  transform: translateY(-4px) rotateY(180deg);
}

.card-inner {
  transition: transform 560ms var(--ease-product);
}

.card-topline,
.card-nameplate {
  left: 7px;
  right: 7px;
  padding: 5px 7px;
  border-radius: 3px;
  background: rgba(3, 20, 26, 0.9);
  font-size: 0.65rem;
}

.tap-hint {
  margin-top: 8px;
  color: var(--celadon-300);
  font-size: 0.66rem;
}

.table-actions {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 0;
}

.secondary-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(167, 198, 184, 0.3);
  border-radius: 5px;
  background: rgba(4, 25, 32, 0.68);
  color: var(--paper-200);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.secondary-button:hover {
  border-color: var(--celadon-400);
  background: rgba(134, 175, 160, 0.12);
  color: var(--paper-100);
}

.reading-result {
  position: relative;
  z-index: 6;
  grid-column: auto;
  grid-row: auto;
  min-width: 0;
  max-height: 240px;
  display: grid;
  grid-template-columns: minmax(210px, 0.46fr) minmax(0, 1.54fr);
  gap: 26px;
  margin: 0 16px 16px;
  padding: 18px 22px;
  overflow: hidden;
  border: 1px solid rgba(198, 164, 90, 0.45);
  border-radius: 0;
  background: rgba(4, 23, 31, 0.97);
  box-shadow: none;
}

.reading-surface:has(.reading-result:not([hidden])) .table-actions {
  opacity: 0;
  pointer-events: none;
}

.result-summary {
  position: static;
  min-width: 0;
  padding-right: 22px;
  border-right: 1px solid var(--line-soft);
}

.result-summary h2 {
  margin: 0 0 7px;
  color: var(--paper-100);
  font-size: 1.02rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

.result-summary > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 10px;
  color: var(--celadon-300);
  font-size: 0.7rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result-question {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 12px;
  padding: 0;
  background: transparent;
  color: var(--paper-200);
  font-size: 0.72rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.interpretation-list {
  min-width: 0;
  display: flex;
  flex-direction: row;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.interpretation-item {
  flex: 1 1 0;
  min-width: 190px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  padding: 4px 18px;
  border-top: 0;
  border-bottom: 0;
  border-right: 1px solid var(--line-quiet);
}

.interpretation-item:last-child {
  border-right: 0;
}

.interpretation-thumb {
  width: 54px;
  border-radius: 3px;
}

.interpretation-position {
  color: var(--brass-300);
  font-size: 0.62rem;
}

.interpretation-item h3 {
  margin: 1px 0 4px;
  color: var(--paper-100);
  font-size: 0.95rem;
  line-height: 1.35;
}

.interpretation-item p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--paper-200);
  font-size: 0.68rem;
  line-height: 1.48;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.keyword {
  padding: 2px 7px;
  border: 1px solid rgba(134, 175, 160, 0.28);
  border-radius: 999px;
  color: var(--celadon-300);
  font-size: 0.58rem;
}

.deck-note {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 40px clamp(24px, 5vw, 72px);
  border-top: 1px solid var(--line-soft);
  border-bottom: 0;
  background: rgba(3, 21, 28, 0.68);
}

.deck-note-grid {
  width: min(1060px, 100%);
  margin: 0 auto;
}

.deck-note h2 {
  color: var(--brass-300);
  font-size: 1.05rem;
}

.deck-note p {
  color: var(--paper-200);
  font-size: 0.84rem;
}

.site-footer {
  width: 100%;
  padding: 20px 28px max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-quiet);
  color: var(--celadon-300);
  font-size: 0.7rem;
}

.toast {
  border-radius: 5px;
  background: var(--paper-100);
  color: var(--sea-950);
}

@media (max-width: 1080px) {
  main {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .hero {
    padding-inline: 22px;
  }

  .reading-table {
    padding-inline: 26px;
  }

  .ritual-progress {
    width: min(600px, calc(100% - 16px));
  }

  .spread-slots {
    gap: 24px;
  }

  .card-slot {
    flex-basis: clamp(150px, 17vw, 190px);
  }

  .reading-result {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
  }
}

@media (max-width: 840px) {
  .topbar {
    padding-inline: 18px;
  }

  main {
    display: block;
  }

  .reading-surface {
    min-height: 0;
    display: block;
    overflow: visible;
  }

  .hero {
    min-height: auto;
    padding: 30px 18px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .hero-copy {
    padding-bottom: 20px;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .setup-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.74fr);
    grid-template-rows: auto auto auto auto;
    column-gap: 18px;
  }

  .field-label,
  #question,
  .field-meta {
    grid-column: 1;
  }

  .spread-fieldset,
  .primary-button {
    grid-column: 2;
  }

  .spread-fieldset {
    grid-row: 2;
    align-self: end;
    margin-bottom: 12px;
  }

  .primary-button {
    grid-row: 3;
    align-self: end;
  }

  .rail-history {
    margin-top: 24px;
  }

  .history-list {
    display: flex;
    overflow-x: auto;
  }

  .history-entry {
    flex: 0 0 260px;
  }

  .seal-mark {
    display: none;
  }

  .reading-table {
    min-height: 680px;
    padding: 24px 18px;
  }

  .meridian-dial {
    width: 760px;
  }

  .reading-result {
    position: static;
    display: grid;
    max-height: none;
    margin: 0;
    padding: 28px 20px;
    border-width: 1px 0 0;
    grid-template-columns: 1fr;
  }

  .result-summary {
    padding: 0 0 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .interpretation-list {
    display: grid;
    overflow: visible;
  }

  .interpretation-item {
    grid-template-columns: 62px minmax(0, 1fr);
    padding: 18px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line-quiet);
  }

  .interpretation-item:last-child {
    border-bottom: 0;
  }

  .interpretation-thumb {
    width: 62px;
  }

  .reading-surface:has(.reading-result:not([hidden])) .table-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    min-height: 60px;
    padding-inline: 14px;
  }

  .deck-count {
    display: none;
  }

  .hero {
    padding: 12px 12px 10px;
  }

  .hero-copy {
    padding: 0 2px 10px;
  }

  .hero h1 {
    padding-bottom: 8px;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
  }

  .hero h1::after {
    width: 88px;
  }

  .setup-panel {
    display: flex;
    padding: 0 2px;
  }

  .field-label,
  #question,
  .field-meta,
  .spread-fieldset,
  .primary-button {
    width: 100%;
  }

  .field-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  #question {
    order: 2;
    height: 54px;
    min-height: 54px;
    margin-bottom: 8px;
    padding: 12px 13px;
    resize: none;
    font-size: 1rem;
    line-height: 1.45;
  }

  .field-meta {
    display: none;
  }

  .spread-fieldset {
    order: 1;
    margin: 0 0 8px;
  }

  .primary-button {
    position: fixed;
    inset-inline: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    z-index: var(--z-sticky);
    width: auto;
    min-height: 56px;
    border-color: #df7464;
    box-shadow: 0 12px 28px rgba(0, 7, 10, 0.52), 0 0 0 1px rgba(238, 232, 219, 0.08);
  }

  .desktop-action-label {
    display: none;
  }

  .mobile-action-label {
    display: inline;
  }

  .setup-panel:focus-within .primary-button {
    position: static;
    width: 100%;
    margin-top: 2px;
    box-shadow: none;
  }

  .rail-history {
    margin: 4px 2px 0;
    padding-top: 8px;
  }

  .rail-history summary {
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid rgba(167, 198, 184, 0.26);
    border-radius: 5px;
    background: rgba(3, 21, 28, 0.42);
    color: var(--paper-200);
    font-size: 0.78rem;
  }

  .rail-history[open] summary {
    margin-bottom: 10px;
    border-color: rgba(198, 164, 90, 0.42);
    color: var(--brass-300);
  }

  .history-list {
    padding-bottom: 4px;
  }

  .history-entry {
    flex-basis: min(260px, calc(100vw - 44px));
  }

  .reading-table {
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    padding: 12px 10px 16px;
  }

  .reading-table::before {
    inset: 8px;
  }

  .table-head {
    padding-inline: 4px;
  }

  .table-head h2 {
    font-size: 0.74rem;
  }

  .reading-status {
    min-width: 70px;
    padding: 4px 8px;
  }

  .table-head p {
    display: none;
  }

  .ritual-progress {
    width: 100%;
    margin-top: 6px;
    padding-top: 5px;
  }

  .progress-step {
    font-size: 0.6rem;
  }

  .progress-dot {
    width: 14px;
    height: 14px;
  }

  .progress-track {
    top: 11px;
  }

  .meridian-dial {
    top: 78px;
    width: 480px;
  }

  .deck-stage {
    padding: 10px 0 4px;
  }

  .deck-stack {
    width: 128px;
    margin-bottom: 10px;
  }

  .deck-instruction {
    max-width: 34ch;
    font-size: 0.7rem;
    line-height: 1.5;
  }

  .spread-slots {
    justify-content: flex-start;
    align-items: flex-start;
    gap: 16px;
    margin-inline: -4px;
    padding: 10px calc(50% - 76px) 4px;
  }

  .spread-slots[data-count="1"] {
    justify-content: center;
    padding-inline: 4px;
  }

  .card-slot {
    flex-basis: 152px;
  }

  .slot-label {
    min-height: 28px;
    margin-bottom: 6px;
    font-size: 0.82rem;
  }

  .tap-hint {
    margin-top: 5px;
  }

  .table-actions {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 6px;
  }

  .table-actions > * {
    width: auto;
    min-height: 44px;
    flex: 0 1 180px;
  }

  #newReadingButton {
    display: none;
  }

  .reading-result {
    margin: 0;
    padding: 20px 14px 24px;
    border-top-color: rgba(198, 164, 90, 0.48);
  }

  .result-summary {
    padding-bottom: 16px;
  }

  .result-summary h2 {
    font-size: 1.18rem;
  }

  .interpretation-item {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 16px 0;
  }

  .interpretation-thumb {
    width: 56px;
  }

  .deck-note {
    padding: 30px 18px;
  }

  .site-footer {
    padding-inline: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-track::after,
  .progress-dot,
  .progress-step,
  .card-inner,
  .primary-button {
    transition-duration: 0.01ms !important;
  }

  .tarot-card:hover .card-inner {
    transform: none;
  }

  .tarot-card.is-revealed:hover .card-inner {
    transform: rotateY(180deg);
  }
}
