:root {
  color-scheme: light;
  --ink: #17130f;
  --ink-soft: #43382f;
  --muted: #76695b;
  --paper: #f7ead8;
  --paper-strong: #fff9ef;
  --panel: rgba(255, 249, 239, 0.82);
  --panel-strong: rgba(255, 252, 246, 0.94);
  --line: rgba(58, 43, 32, 0.16);
  --line-strong: rgba(58, 43, 32, 0.26);
  --wine: #8d2f49;
  --wine-dark: #572138;
  --teal: #19726f;
  --teal-dark: #0f4e50;
  --gold: #b9822c;
  --amber: #e8c87f;
  --night: #151724;
  --shadow-soft: 0 18px 46px rgba(73, 48, 27, 0.14);
  --shadow-card: 0 22px 54px rgba(35, 28, 22, 0.22);
  --card-ratio: 300 / 519;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #efe0ca;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(112deg, rgba(25, 114, 111, 0.18), transparent 34%),
    linear-gradient(246deg, rgba(141, 47, 73, 0.16), transparent 38%),
    repeating-linear-gradient(0deg, rgba(76, 53, 36, 0.035) 0 1px, transparent 1px 20px),
    linear-gradient(145deg, #fff5e6 0%, #f2dfc5 54%, #eadbd9 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    conic-gradient(from 214deg at 50% 0%, rgba(255, 255, 255, 0.5), rgba(232, 200, 127, 0.12), rgba(25, 114, 111, 0.08), rgba(255, 255, 255, 0.36)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 249, 239, 0.58));
}

body.bg-amethyst::before {
  background:
    conic-gradient(from 238deg at 50% 0%, rgba(255, 255, 255, 0.52), rgba(87, 33, 56, 0.1), rgba(25, 114, 111, 0.08), rgba(255, 255, 255, 0.38)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 249, 239, 0.62));
}

body.bg-orchid::before {
  background:
    conic-gradient(from 190deg at 50% 0%, rgba(255, 255, 255, 0.5), rgba(141, 47, 73, 0.12), rgba(184, 130, 44, 0.1), rgba(255, 255, 255, 0.36)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 249, 239, 0.62));
}

body.bg-night::before {
  background:
    conic-gradient(from 220deg at 50% 0%, rgba(255, 255, 255, 0.48), rgba(21, 23, 36, 0.1), rgba(25, 114, 111, 0.1), rgba(255, 255, 255, 0.34)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 249, 239, 0.62));
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: var(--teal-dark);
  font-weight: 800;
}

:focus-visible {
  outline: 3px solid rgba(25, 114, 111, 0.7);
  outline-offset: 3px;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 42px);
  margin: 0 auto;
  padding: 20px 0 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 20px;
}

.brand-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 249, 239, 0.52);
  border-radius: 8px;
  background:
    linear-gradient(140deg, #151724 0%, #263444 46%, #8d2f49 100%);
  box-shadow: var(--shadow-soft);
}

.brand-mark span {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid #fff3d7;
  transform: rotate(45deg);
}

.brand-mark::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  content: "";
}

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

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 2.35rem;
  line-height: 0.94;
}

h2 {
  font-size: 3.25rem;
  line-height: 0.98;
}

h3 {
  font-size: 1rem;
}

.deck-count,
.counter,
.top-pill,
.sound-toggle-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: rgba(255, 249, 239, 0.74);
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(73, 48, 27, 0.08);
}

.top-pill {
  color: #fff9ef;
  border-color: transparent;
  background: linear-gradient(135deg, var(--teal-dark), var(--wine-dark));
}

.sound-toggle-button {
  cursor: pointer;
}

.sound-toggle-button[aria-pressed="false"] {
  color: rgba(67, 56, 47, 0.78);
  background: rgba(255, 252, 246, 0.56);
}

.sound-toggle-button:hover {
  border-color: rgba(25, 114, 111, 0.42);
  transform: translateY(-1px);
}

.reset-button,
.share-reading-button,
.copy-reading-button,
.new-reading-button,
.home-reading-button,
.clear-history-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: var(--panel-strong);
  box-shadow: 0 10px 24px rgba(34, 30, 25, 0.08);
  cursor: pointer;
  font-weight: 950;
  white-space: nowrap;
}

.reset-button:hover,
.share-reading-button:hover,
.copy-reading-button:hover,
.new-reading-button:hover,
.home-reading-button:hover,
.clear-history-button:hover {
  border-color: rgba(25, 114, 111, 0.42);
  transform: translateY(-1px);
}

.start-screen {
  display: grid;
  grid-template-columns: minmax(320px, 1.04fr) minmax(320px, 0.96fr);
  align-items: center;
  min-height: 68vh;
  gap: 46px;
  padding: 24px 0 34px;
}

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

.hero-lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 1.15rem;
  font-weight: 720;
  line-height: 1.48;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.hero-meta span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid rgba(25, 114, 111, 0.2);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--teal-dark);
  background: rgba(236, 250, 245, 0.78);
  font-size: 0.82rem;
  font-weight: 900;
}

.question-panel {
  display: grid;
  gap: 10px;
  max-width: 640px;
  margin-top: 24px;
  border: 1px solid rgba(58, 43, 32, 0.13);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 249, 239, 0.7);
  box-shadow: var(--shadow-soft);
}

.question-panel label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.question-panel input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(58, 43, 32, 0.18);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 252, 246, 0.96);
  outline: none;
}

.question-panel input:focus {
  border-color: rgba(25, 114, 111, 0.58);
  box-shadow: 0 0 0 4px rgba(25, 114, 111, 0.12);
}

.focus-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.focus-chips button {
  min-height: 34px;
  border: 1px solid rgba(58, 43, 32, 0.13);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 850;
}

.focus-chips button:hover,
.focus-chips button.is-active {
  border-color: rgba(141, 47, 73, 0.35);
  color: var(--wine-dark);
  background: rgba(255, 235, 230, 0.88);
}

.mode-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 640px;
  margin-top: 14px;
}

.mode-button {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 78px;
  border: 1px solid rgba(58, 43, 32, 0.13);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  background: rgba(255, 249, 239, 0.66);
  box-shadow: 0 14px 30px rgba(73, 48, 27, 0.08);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.mode-button-wide {
  grid-column: 1 / -1;
}

.mode-button span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.mode-button strong {
  font-size: 1rem;
}

.mode-button:hover {
  border-color: rgba(25, 114, 111, 0.36);
  background: rgba(255, 252, 246, 0.9);
  transform: translateY(-2px);
}

.mode-button.is-active {
  border-color: rgba(141, 47, 73, 0.58);
  background:
    linear-gradient(135deg, rgba(255, 252, 246, 0.98), rgba(255, 233, 224, 0.94));
}

.mode-button.is-active::before {
  position: absolute;
  inset: 9px auto 9px 9px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--wine), var(--gold));
  content: "";
}

.history-section {
  margin: 0 0 28px;
  border: 1px solid rgba(58, 43, 32, 0.13);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 249, 239, 0.64);
  box-shadow: var(--shadow-soft);
}

.history-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.history-head h2 {
  font-size: 1.65rem;
}

.clear-history-button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.82);
  box-shadow: none;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.history-stat {
  border: 1px solid rgba(58, 43, 32, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 252, 246, 0.7);
}

.history-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.history-stat strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.history-item {
  display: grid;
  min-height: 78px;
  gap: 6px;
  border: 1px solid rgba(58, 43, 32, 0.12);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  background: rgba(255, 252, 246, 0.78);
  cursor: pointer;
}

.history-item:hover,
.history-item:focus-visible {
  border-color: rgba(25, 114, 111, 0.36);
  background: rgba(237, 250, 246, 0.86);
}

.history-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.history-item strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-button {
  display: grid;
  justify-self: center;
  width: min(420px, 100%);
  gap: 14px;
  border: 0;
  padding: 16px;
  background: transparent;
  cursor: pointer;
}

.deck-stack {
  position: relative;
  display: block;
  width: min(70vw, 312px);
  aspect-ratio: var(--card-ratio);
  filter: drop-shadow(0 34px 54px rgba(27, 28, 36, 0.24));
  transform: rotate(-2deg);
  transition: transform 200ms ease, filter 200ms ease;
}

.deck-button:hover .deck-stack {
  filter: drop-shadow(0 38px 62px rgba(27, 28, 36, 0.3));
  transform: translateY(-5px) rotate(-1deg);
}

.deck-label {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  justify-self: center;
  border: 1px solid rgba(255, 249, 239, 0.36);
  border-radius: 999px;
  padding: 0 22px;
  color: #fff9ef;
  background: linear-gradient(135deg, #151724, #0f4e50 56%, #8d2f49);
  box-shadow: 0 18px 38px rgba(34, 30, 25, 0.18);
  font-weight: 950;
}

.deck-caption {
  max-width: 300px;
  justify-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1.35;
  text-align: center;
}

.card-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 2px solid rgba(255, 243, 215, 0.94);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 243, 215, 0.08) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(0deg, rgba(255, 243, 215, 0.08) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(150deg, #151724 0%, #243344 36%, #0f4e50 66%, #572138 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.06),
    inset 0 0 44px rgba(255, 243, 215, 0.11);
}

.card-back::before,
.card-back::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.card-back::before {
  inset: 9%;
  border: 1px solid rgba(255, 243, 215, 0.64);
  border-radius: 8px;
  background:
    conic-gradient(from 0deg, transparent 0 9deg, rgba(255, 243, 215, 0.36) 9deg 11deg, transparent 11deg 30deg),
    radial-gradient(circle at 50% 50%, rgba(255, 243, 215, 0.9) 0 3%, transparent 4%);
}

.card-back::after {
  inset: 27% 23%;
  border: 1px solid rgba(255, 243, 215, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 46%, rgba(255, 243, 215, 0.72) 47%, rgba(255, 243, 215, 0.72) 50%, transparent 51%),
    linear-gradient(-45deg, transparent 46%, rgba(255, 243, 215, 0.72) 47%, rgba(255, 243, 215, 0.72) 50%, transparent 51%);
  transform: rotate(45deg);
}

.back-frame {
  position: absolute;
  inset: 8%;
  border: 2px solid rgba(255, 243, 215, 0.58);
  border-radius: 8px;
}

.back-offset {
  box-shadow: 0 18px 38px rgba(35, 35, 40, 0.2);
}

.back-offset-one {
  transform: translate(10px, 10px) rotate(3deg);
}

.back-offset-two {
  opacity: 0.9;
  transform: translate(20px, 20px) rotate(5deg);
}

.back-offset-three {
  opacity: 0.78;
  transform: translate(30px, 30px) rotate(7deg);
}

.main-back {
  z-index: 4;
}

.spread-section {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 280ms ease, transform 280ms ease;
  scroll-margin-top: 16px;
}

.spread-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.spread-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.draw-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 900;
}

.counter {
  margin: 0;
}

.draw-tray {
  display: grid;
  grid-template-columns: repeat(var(--slot-count, 3), minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}

.draw-slot {
  display: grid;
  min-height: 60px;
  align-content: center;
  border: 1px dashed rgba(58, 43, 32, 0.22);
  border-radius: 8px;
  padding: 10px 11px;
  background: rgba(255, 249, 239, 0.56);
}

.draw-slot.is-filled {
  border-style: solid;
  border-color: rgba(25, 114, 111, 0.34);
  background: rgba(233, 250, 244, 0.82);
}

.draw-slot span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.draw-slot strong {
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spread-grid {
  position: relative;
  margin: 0 calc(50% - 50vw);
  overflow-x: auto;
  overflow-y: visible;
  padding: 18px 0 36px;
  outline: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.spread-grid::-webkit-scrollbar {
  height: 10px;
}

.spread-grid::-webkit-scrollbar-track {
  background: rgba(255, 249, 239, 0.42);
}

.spread-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(25, 114, 111, 0.36);
}

.fan-stage {
  position: relative;
  width: var(--fan-width);
  min-width: 100%;
  height: var(--fan-height);
  margin: 0 auto;
}

.spread-card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: var(--z);
  width: 96px;
  max-width: none;
  aspect-ratio: var(--card-ratio);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
  scroll-snap-align: center;
  transform: translateX(-50%) rotate(var(--rotate));
  transform-origin: 50% 130%;
  transition: filter 190ms ease, transform 190ms ease;
}

.spread-card:focus-visible {
  outline: 3px solid rgba(25, 114, 111, 0.82);
  outline-offset: 5px;
  border-radius: 8px;
}

.spread-card:hover,
.spread-card:focus-visible {
  filter: drop-shadow(0 18px 28px rgba(21, 24, 33, 0.24));
  transform: translateX(-50%) translateY(-12px) rotate(var(--rotate)) scale(1.04);
}

.spread-card.is-flipped {
  filter: drop-shadow(0 16px 28px rgba(25, 114, 111, 0.22));
}

.spread-card.is-disabled {
  cursor: default;
  opacity: 0.42;
  pointer-events: none;
}

.spread-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.spread-card.is-flipped .spread-card-inner {
  transform: rotateY(180deg);
}

.spread-face {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  backface-visibility: hidden;
  box-shadow: 0 12px 28px rgba(29, 31, 45, 0.18);
  pointer-events: none;
}

.spread-front {
  display: grid;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(58, 43, 32, 0.18);
  background: #fff9ef;
  transform: rotateY(180deg);
}

.spread-front.image-missing,
.selected-card-frame.image-missing {
  display: grid;
  place-items: center;
  border: 1px solid rgba(58, 43, 32, 0.18);
  background:
    repeating-linear-gradient(45deg, rgba(58, 43, 32, 0.04) 0 1px, transparent 1px 10px),
    linear-gradient(145deg, rgba(255, 249, 239, 0.94), rgba(238, 228, 211, 0.9));
}

.spread-front.image-missing::after,
.selected-card-frame.image-missing::after {
  max-width: 78%;
  color: var(--ink-soft);
  content: attr(data-card-name);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.spread-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reading-section {
  display: block;
  margin: 24px 0 34px;
  padding: 24px 0 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 18px;
}

.selected-card {
  display: grid;
  width: 100%;
  gap: 18px;
  transform-origin: center;
}

.reading-spread-head {
  max-width: 840px;
  margin: 0 auto;
  text-align: center;
}

.reading-spread-head h2 {
  margin-bottom: 8px;
  font-size: 2.25rem;
}

.reading-spread-head p {
  max-width: 68ch;
  margin: 0 auto;
  color: var(--muted);
  line-height: 1.55;
}

.reading-question {
  display: inline-flex;
  max-width: 100%;
  min-height: 36px;
  align-items: center;
  margin: 10px auto 0;
  border: 1px solid rgba(184, 130, 44, 0.34);
  border-radius: 999px;
  padding: 0 14px;
  color: #704c12;
  background: rgba(255, 246, 218, 0.82);
  font-weight: 900;
}

.drawn-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  max-width: 900px;
  margin: 8px auto 0;
}

.drawn-cards.count-1 {
  max-width: 360px;
  grid-template-columns: minmax(0, 1fr);
}

.drawn-cards.count-2 {
  max-width: 620px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drawn-cards.count-4,
.drawn-cards.count-5,
.drawn-cards.count-6,
.drawn-cards.count-12 {
  max-width: 980px;
}

.drawn-card {
  display: grid;
  gap: 10px;
}

.selected-card-label {
  text-align: center;
}

.selected-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.02rem;
}

.selected-card-frame {
  width: min(100%, 188px);
  aspect-ratio: var(--card-ratio);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(58, 43, 32, 0.16);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(58, 43, 32, 0.04) 0 1px, transparent 1px 10px),
    linear-gradient(145deg, rgba(255, 249, 239, 0.92), rgba(238, 228, 211, 0.86));
  box-shadow: 0 12px 30px rgba(35, 28, 22, 0.12);
}

.selected-card img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: var(--shadow-card);
}

.selected-card.reveal {
  animation: revealCard 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reading-copy {
  min-width: 0;
  margin-top: 30px;
}

.reading-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.element-pill,
.reading-tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid rgba(25, 114, 111, 0.28);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--teal-dark);
  background: rgba(232, 250, 245, 0.86);
  font-size: 0.78rem;
  font-weight: 950;
}

.summary {
  max-width: 76ch;
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 1.04rem;
  line-height: 1.66;
}

.summary p {
  margin: 0 0 12px;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  max-width: 980px;
  margin: 0 0 22px;
}

.insight {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(58, 43, 32, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 249, 239, 0.72);
}

.insight span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.insight strong {
  color: var(--ink);
}

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

.detail-card {
  min-height: 210px;
  border: 1px solid rgba(58, 43, 32, 0.12);
  border-radius: 8px;
  padding: 17px;
  background: var(--panel-strong);
}

.detail-card h3 {
  margin-bottom: 8px;
  color: var(--ink);
}

.detail-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.62;
}

.detail-card p:last-child {
  margin-bottom: 0;
}

.question-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.reading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.new-reading-button {
  color: #fff9ef;
  border-color: transparent;
  background: linear-gradient(135deg, var(--teal-dark), var(--wine-dark));
}

.home-reading-button {
  color: var(--ink-soft);
  background: rgba(255, 252, 246, 0.86);
}

.share-reading-button {
  color: #fff9ef;
  border-color: transparent;
  background: linear-gradient(135deg, #151724, var(--teal-dark) 58%, var(--gold));
}

.source-note {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 18px;
  color: rgba(23, 19, 15, 0.62);
  font-size: 0.82rem;
  line-height: 1.4;
}

@keyframes revealCard {
  from {
    opacity: 0.82;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  h1 {
    font-size: 1.9rem;
  }

  h2 {
    font-size: 2.45rem;
  }

  .start-screen {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-bottom: 20px;
    text-align: center;
  }

  .hero-lead,
  .question-panel,
  .mode-panel {
    margin-right: auto;
    margin-left: auto;
  }

  .hero-meta {
    justify-content: center;
  }

  .deck-button {
    margin: 0 auto;
  }

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    align-items: start;
  }

  .brand-mark,
  .deck-count,
  .top-pill {
    display: none;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .reset-button {
    min-height: 38px;
    padding: 0 12px;
  }

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

  .history-head {
    align-items: start;
  }

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

  .mode-button {
    min-height: 74px;
    padding: 11px;
  }

  .mode-button strong {
    font-size: 0.92rem;
  }

  .deck-stack {
    width: min(72vw, 238px);
  }

  .spread-head {
    align-items: start;
  }

  .draw-tray {
    grid-template-columns: 1fr;
  }

  .spread-grid {
    margin: 0;
    overflow: visible;
    padding: 12px 0 22px;
    scroll-snap-type: none;
  }

  .fan-stage {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100% !important;
    min-width: 0;
    height: auto !important;
    margin: 0;
    gap: 10px;
  }

  .spread-card {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    transform: rotate(var(--rotate));
    transform-origin: center;
  }

  .spread-card:hover,
  .spread-card:focus-visible {
    transform: translateY(-5px) rotate(var(--rotate)) scale(1.02);
  }

  .reading-section {
    margin-top: 18px;
    padding: 18px 0 24px;
  }

  .reading-spread-head h2 {
    font-size: 1.8rem;
  }

  .drawn-cards,
  .drawn-cards.count-2,
  .drawn-cards.count-4,
  .drawn-cards.count-5,
  .drawn-cards.count-6,
  .drawn-cards.count-12 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .selected-card-title {
    display: grid;
    justify-items: center;
    font-size: 0.9rem;
    line-height: 1.14;
  }

  .selected-card-frame {
    width: min(100%, 104px);
  }

  .element-pill,
  .reading-tag {
    min-height: 24px;
    padding: 0 8px;
    font-size: 0.68rem;
  }

  .summary {
    font-size: 0.98rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-card {
    min-height: auto;
  }

  .reading-actions {
    display: grid;
  }
}

@media (max-width: 460px) {
  .mode-panel {
    grid-template-columns: 1fr;
  }

  .drawn-cards,
  .drawn-cards.count-2,
  .drawn-cards.count-4,
  .drawn-cards.count-5,
  .drawn-cards.count-6,
  .drawn-cards.count-12 {
    grid-template-columns: 1fr 1fr;
  }

  .drawn-cards.count-1 {
    grid-template-columns: 1fr;
  }

  .selected-card-frame {
    width: min(44vw, 150px);
  }
}

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