:root {
  color-scheme: dark;
  --bg: #11100f;
  --panel: #1b1917;
  --panel-strong: #24211d;
  --line: #3d352d;
  --line-strong: #6c5a43;
  --text: #f4eee4;
  --muted: #b8a99a;
  --gold: #d8a84d;
  --gold-soft: rgba(216, 168, 77, 0.16);
  --rose: #c47b86;
  --green: #8cbf9f;
  --blue: #7aa7c7;
  --danger: #d36f63;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 0%, rgba(216, 168, 77, 0.12), transparent 32rem),
    linear-gradient(135deg, #11100f 0%, #1d1814 48%, #101416 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.tarot-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.tarot-topbar,
.panel-head-row,
.reading-actions,
.panel-actions,
.library-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tarot-topbar {
  padding: 14px 0 18px;
}

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

.brand-tagline {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.16;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.site-links,
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-links a,
.mode-tab,
.secondary-action,
.primary-action,
.danger-action {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 850;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.site-links a {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  color: var(--muted);
  background: rgba(27, 25, 23, 0.72);
}

.site-links a:hover,
.mode-tab:hover,
.secondary-action:hover {
  border-color: var(--line-strong);
}

.mode-tabs {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 0 14px;
  background: linear-gradient(180deg, rgba(17, 16, 15, 0.96), rgba(17, 16, 15, 0.78));
  backdrop-filter: blur(12px);
}

.mode-tab {
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(27, 25, 23, 0.84);
}

.mode-tab.is-active {
  border-color: rgba(216, 168, 77, 0.62);
  color: var(--text);
  background: var(--gold-soft);
}

.oracle-panel {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 25, 23, 0.9);
  box-shadow: var(--shadow);
}

.oracle-panel.is-view-enter {
  animation: panelEnter 240ms ease both;
}

@keyframes panelEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.reading-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.68fr) minmax(0, 1.32fr);
  min-height: 620px;
}

.reading-control,
.card-stage,
.answer-panel,
[data-panel="journal"],
[data-panel="library"] {
  padding: 22px;
}

.reading-control {
  border-right: 1px solid var(--line);
  background: rgba(36, 33, 29, 0.58);
}

.section-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.section-head.compact {
  margin-bottom: 14px;
}

.question-field,
.reflection-field,
.followup-field,
.draw-method,
.icon-picker {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.icon-picker {
  gap: 10px;
}

.icon-picker-head,
.draw-method-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.icon-picker-head small,
.draw-method-head small {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.draw-method-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.draw-method-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(18, 16, 15, 0.72);
  cursor: pointer;
}

.draw-method-option:has(input:checked) {
  border-color: rgba(216, 168, 77, 0.78);
  color: var(--text);
  background: rgba(216, 168, 77, 0.1);
}

.draw-method-option input {
  accent-color: var(--gold);
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.icon-choice {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(18, 16, 15, 0.72);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-choice:hover:not(:disabled),
.icon-choice:focus-visible {
  border-color: rgba(216, 168, 77, 0.62);
  color: var(--text);
  background: rgba(216, 168, 77, 0.08);
}

.icon-choice.is-selected {
  border-color: rgba(216, 168, 77, 0.86);
  color: var(--text);
  background: rgba(216, 168, 77, 0.16);
  transform: translateY(-1px);
}

.icon-choice:disabled {
  cursor: default;
  opacity: 0.46;
}

.icon-choice-mark {
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #17120d;
  background: var(--gold);
  font-size: 11px;
  font-weight: 950;
}

.icon-choice-mark:empty {
  display: none;
}

.icon-choice-symbol {
  font-size: 25px;
  line-height: 1;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #12100f;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 132px;
  padding: 13px 14px;
  line-height: 1.62;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(216, 168, 77, 0.14);
}

.reading-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 16px;
}

.primary-action,
.secondary-action,
.danger-action {
  padding: 9px 14px;
}

.primary-action {
  border-color: var(--gold);
  color: #17120a;
  background: linear-gradient(180deg, #ebc76c, #c89132);
}

.secondary-action {
  color: var(--text);
  background: #24211d;
}

.danger-action {
  border-color: rgba(211, 111, 99, 0.48);
  color: #ffd8d2;
  background: rgba(211, 111, 99, 0.14);
}

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

.status-text {
  margin: 16px 0 0;
  min-height: 22px;
  color: var(--muted);
  line-height: 1.6;
}

.status-text.is-error {
  color: #ffb0a8;
}

.card-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
}

.card-spread {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  width: 100%;
  max-width: 1120px;
  gap: 16px;
}

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

.card-spread:has(.tarot-card:only-child) {
  grid-template-columns: minmax(250px, 390px);
  justify-content: center;
}

.manual-draw-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(100%, 1120px);
}

.manual-draw-panel[hidden] {
  display: none;
}

.manual-draw-head,
.manual-draw-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-draw-head h3 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 20px;
}

.manual-draw-head > span {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.manual-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 8px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding: 2px 4px 8px 2px;
}

.manual-card-back {
  position: relative;
  min-height: 0;
  width: 100%;
  padding: 4px;
  cursor: pointer;
  appearance: none;
}

.manual-card-back .card-inner {
  height: 100%;
  min-height: 0;
}

.manual-card-back:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.manual-card-back.is-selected {
  border-color: rgba(255, 223, 160, 0.96);
  box-shadow: 0 0 0 2px rgba(216, 168, 77, 0.28), 0 18px 44px rgba(0, 0, 0, 0.42);
  transform: translateY(-6px);
}

.manual-card-order {
  position: absolute;
  z-index: 2;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 223, 160, 0.8);
  border-radius: 999px;
  color: #160f06;
  background: linear-gradient(180deg, #f5d992, #c48b35);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
}

.manual-card-order:empty {
  display: none;
}

.tarot-card {
  min-width: 0;
  aspect-ratio: 0.66;
  border: 1px solid rgba(216, 168, 77, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(155deg, rgba(216, 168, 77, 0.12), transparent 44%),
    #171412;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
  padding: 8px;
  perspective: 1000px;
}

.card-inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  height: 100%;
  border: 1px solid rgba(216, 168, 77, 0.44);
  border-radius: 6px;
  padding: 8px;
  background:
    radial-gradient(circle at 50% 35%, rgba(216, 168, 77, 0.18), transparent 42%),
    linear-gradient(180deg, #24201b, #11100f);
  transform-style: preserve-3d;
}

.tarot-card.is-flipped .card-inner {
  animation: flipReveal 2400ms cubic-bezier(0.16, 0.72, 0.16, 1) both;
}

@keyframes flipReveal {
  0% {
    opacity: 0;
    transform: rotateY(88deg) scale(0.96);
  }

  58% {
    opacity: 1;
    transform: rotateY(-8deg) scale(1.01);
  }

  100% {
    opacity: 1;
    transform: rotateY(0) scale(1);
  }
}

.card-back .card-inner {
  position: relative;
  place-items: center;
  grid-template-rows: 1fr;
  border: 0;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.04)),
    url("/card-back.png") center / cover no-repeat,
    #07102b;
  transition: transform 420ms cubic-bezier(0.2, 0.72, 0.18, 1), filter 420ms ease;
  will-change: transform;
}

.card-back {
  transform: translateY(0) rotate(0);
  transition: transform 420ms cubic-bezier(0.2, 0.72, 0.18, 1), border-color 320ms ease, box-shadow 420ms ease;
}

.card-back .card-inner::before {
  content: "";
  position: absolute;
  inset: -18%;
  background:
    linear-gradient(105deg, transparent 30%, rgba(255, 223, 160, 0.28) 46%, transparent 62%),
    radial-gradient(circle at 50% 8%, rgba(232, 191, 117, 0.18), transparent 36%);
  opacity: 0;
  transform: translateX(-32%) rotate(8deg);
  transition: opacity 360ms ease, transform 900ms cubic-bezier(0.16, 0.72, 0.16, 1);
  pointer-events: none;
}

.card-back .card-inner::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 223, 160, 0.24);
  border-radius: 7px;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 320ms ease, transform 420ms ease;
  pointer-events: none;
}

.card-back:hover {
  transform: translateY(-10px) rotate(-1.2deg);
  border-color: rgba(255, 223, 160, 0.82);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.58), 0 0 46px rgba(232, 191, 117, 0.2);
}

.card-back:hover .card-inner {
  animation: cardBackFloat 1800ms ease-in-out infinite;
  filter: saturate(1.08) brightness(1.06);
}

.card-back:hover .card-inner::before {
  opacity: 1;
  transform: translateX(32%) rotate(8deg);
}

.card-back:hover .card-inner::after {
  opacity: 1;
  transform: scale(1);
}

@keyframes cardBackFloat {
  0%,
  100% {
    transform: rotateY(0deg) rotateX(0deg) scale(1);
  }

  50% {
    transform: rotateY(4deg) rotateX(-2deg) scale(1.018);
  }
}

.card-sigil {
  display: none;
}

.card-position {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.card-image {
  display: block;
  align-self: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 5px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 180ms ease;
}

.card-image.is-loaded {
  opacity: 1;
}

.card-image.is-reversed {
  transform: rotate(180deg);
}

.card-name {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: center;
  font-size: 17px;
  line-height: 1.18;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.orientation {
  display: inline-flex;
  width: fit-content;
  padding: 4px 7px;
  border-radius: 999px;
  color: #17120a;
  background: var(--gold);
  font-weight: 900;
}

.answer-panel {
  border-top: 1px solid var(--line);
  background: rgba(18, 16, 15, 0.62);
}

.answer-text {
  color: #f7f0e6;
  line-height: 1.8;
  white-space: pre-wrap;
}

.answer-text.is-structured {
  white-space: normal;
}

.reading-report {
  display: grid;
  gap: 20px;
}

.reading-section {
  min-width: 0;
  padding-top: 2px;
}

.reading-section + .reading-section {
  padding-top: 18px;
  border-top: 1px solid rgba(216, 168, 77, 0.18);
}

.reading-section h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 19px;
  line-height: 1.25;
}

.reading-section h3::before {
  content: "";
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(216, 168, 77, 0.28);
}

.reading-section p {
  margin: 0;
  color: #f7f0e6;
  line-height: 1.86;
}

.reading-section strong {
  color: #fff7df;
  font-weight: 950;
}

.reading-summary {
  padding: 14px 16px;
  border: 1px solid rgba(216, 168, 77, 0.22);
  border-radius: 8px;
  background: rgba(216, 168, 77, 0.08);
}

.reading-card-list {
  display: grid;
  gap: 14px;
}

.reading-card-note {
  min-width: 0;
  padding-left: 14px;
  border-left: 2px solid rgba(216, 168, 77, 0.48);
}

.reading-card-note h4 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.reflection-question {
  margin-top: 8px !important;
  color: var(--muted) !important;
}

.reading-advice-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
  color: #f7f0e6;
  line-height: 1.78;
}

.reading-caution {
  color: #ffe6d2;
}

.followup-panel {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(216, 168, 77, 0.22);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(216, 168, 77, 0.08), rgba(255, 255, 255, 0.025)),
    rgba(5, 8, 20, 0.6);
}

.followup-head,
.followup-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.followup-head h3 {
  margin: 3px 0 0;
  color: #fff4df;
  font-size: 20px;
  line-height: 1.3;
}

.followup-head > span {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(216, 168, 77, 0.22);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.followup-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.followup-suggestion {
  min-height: 36px;
  border: 1px solid rgba(216, 168, 77, 0.24);
  border-radius: 999px;
  padding: 7px 12px;
  color: #ead5b0;
  background: rgba(255, 255, 255, 0.045);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.followup-suggestion:hover,
.followup-suggestion:focus-visible {
  border-color: rgba(216, 168, 77, 0.74);
  color: #fff4df;
  background: rgba(216, 168, 77, 0.1);
  transform: translateY(-1px);
}

.followup-thread {
  display: grid;
  gap: 11px;
}

.followup-empty,
.followup-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.followup-status.is-error {
  color: #ffd1c7;
}

.followup-item {
  display: grid;
  gap: 7px;
  padding: 13px;
  border: 1px solid rgba(216, 168, 77, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.followup-item p {
  margin: 0;
}

.followup-question {
  color: #f5d992;
  font-weight: 900;
  line-height: 1.55;
}

.followup-answer {
  color: #f7f0e6;
  line-height: 1.78;
}

.followup-item time {
  color: var(--muted);
  font-size: 12px;
}

.followup-field {
  display: grid;
  gap: 8px;
}

.followup-field span {
  color: #ead5b0;
  font-size: 13px;
  font-weight: 900;
}

.followup-actions {
  align-items: center;
}

.panel-head-row {
  align-items: flex-start;
  margin-bottom: 18px;
}

.journal-list {
  display: grid;
  gap: 12px;
}

.journal-card,
.library-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 16, 15, 0.68);
  padding: 15px;
}

.library-card {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 8px;
  color: var(--text);
  text-align: left;
}

.library-card:hover,
.library-card:focus-visible {
  border-color: rgba(216, 168, 77, 0.72);
  background: rgba(216, 168, 77, 0.08);
}

.library-card:focus-visible {
  outline: 3px solid rgba(216, 168, 77, 0.2);
  outline-offset: 2px;
}

.journal-card header,
.library-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.journal-card time,
.small-muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.journal-question {
  margin: 10px 0;
  color: var(--text);
  font-weight: 850;
  line-height: 1.5;
}

.journal-followups {
  display: grid;
  gap: 9px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(216, 168, 77, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.journal-followups h4 {
  margin: 0;
  color: var(--gold);
  font-size: 14px;
}

.journal-followup-item {
  display: grid;
  gap: 5px;
}

.journal-followup-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.62;
}

.card-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.card-chip {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(216, 168, 77, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.journal-reflection {
  min-height: 80px;
  margin-top: 12px;
}

.empty-note {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.library-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.library-tools input {
  width: min(280px, 100%);
}

.library-group-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.library-group-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(18, 16, 15, 0.68);
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.library-group-nav a:hover,
.library-group-nav a:focus-visible {
  border-color: rgba(216, 168, 77, 0.68);
  color: var(--text);
  background: rgba(216, 168, 77, 0.08);
}

.library-sections {
  display: grid;
  gap: 22px;
}

.library-section {
  scroll-margin-top: 84px;
}

.library-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(216, 168, 77, 0.2);
}

.library-section-head h3 {
  margin: 0;
}

.library-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.library-card h3 {
  margin-bottom: 2px;
}

.library-image-frame {
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(112px, 100%);
  margin: 0;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(216, 168, 77, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(155deg, rgba(216, 168, 77, 0.1), transparent 46%),
    rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.library-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 180ms ease;
}

.library-image.is-loaded {
  opacity: 1;
}

.library-card-group,
.library-card-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-card-group {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.library-card-name {
  font-size: 16px;
  line-height: 1.2;
}

.site-disclaimer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 14px 16px 0;
  border-top: 1px solid rgba(216, 168, 77, 0.22);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.site-disclaimer strong {
  color: var(--gold);
}

.library-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.library-detail {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(216, 168, 77, 0.42);
  border-radius: 8px;
  background: #181512;
  box-shadow: var(--shadow);
}

.library-detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.36);
  font-size: 24px;
  line-height: 1;
}

.library-detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.library-detail-image-frame {
  display: grid;
  place-items: center;
  align-self: start;
  margin: 0;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(216, 168, 77, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.library-detail-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 180ms ease;
}

.library-detail-image.is-loaded {
  opacity: 1;
}

.library-detail-copy {
  min-width: 0;
  padding-right: 32px;
}

.library-detail-copy h2 {
  margin-bottom: 8px;
}

.library-detail-meanings {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.library-detail-meanings div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.library-detail-meanings dt {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.library-detail-meanings dd {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

/* Premium visual system */
:root {
  --bg: #050814;
  --panel: rgba(10, 14, 29, 0.82);
  --panel-strong: rgba(16, 19, 35, 0.94);
  --line: rgba(214, 174, 98, 0.2);
  --line-strong: rgba(231, 191, 116, 0.52);
  --text: #fff4df;
  --muted: #b9ab98;
  --gold: #e8bf75;
  --gold-soft: rgba(232, 191, 117, 0.14);
  --rose: #c88b9a;
  --green: #9ac8b2;
  --blue: #8eb4d6;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  isolation: isolate;
  background: #050814;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(5, 8, 20, 0.22), rgba(5, 8, 20, 0.92)),
    url("/assets/premium-bg.webp") center top / cover no-repeat,
    #050814;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 191, 117, 0.16), transparent 34rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 72px 72px, 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 78%);
}

.tarot-shell {
  width: min(1360px, calc(100% - 40px));
  padding: 30px 0 48px;
}

.tarot-topbar {
  position: relative;
  margin-bottom: 12px;
  padding: 22px 0 26px;
}

.tarot-topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 191, 117, 0.58), transparent);
}

.brand-lockup {
  position: relative;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.brand-lockup::before,
.brand-lockup::after {
  content: "✦";
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--gold);
  opacity: 0.86;
}

h1 {
  color: #fff8e7;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 900;
  line-height: 1.05;
  text-shadow: 0 0 32px rgba(232, 191, 117, 0.18);
}

.brand-tagline {
  margin-top: 12px;
  color: #d9c8ae;
  font-size: 17px;
}

.mode-tabs {
  top: 0;
  margin: 0 auto 16px;
  padding: 12px;
  border: 1px solid rgba(232, 191, 117, 0.18);
  border-radius: 12px;
  background: rgba(6, 9, 20, 0.74);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.32);
}

.mode-tab {
  min-height: 38px;
  padding: 8px 13px;
  border-color: rgba(232, 191, 117, 0.16);
  color: #bcae9b;
  background: rgba(255, 255, 255, 0.035);
}

.mode-tab.is-active {
  border-color: rgba(232, 191, 117, 0.72);
  color: #fff5df;
  background: linear-gradient(180deg, rgba(232, 191, 117, 0.18), rgba(232, 191, 117, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 24px rgba(232, 191, 117, 0.12);
}

.oracle-panel {
  overflow: hidden;
  border: 1px solid rgba(232, 191, 117, 0.22);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 16rem),
    rgba(7, 10, 22, 0.82);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px);
}

[data-panel="library"] {
  background:
    linear-gradient(180deg, rgba(7, 10, 22, 0.62), rgba(7, 10, 22, 0.9)),
    url("/assets/library-pattern.webp") center / cover no-repeat,
    rgba(7, 10, 22, 0.9);
}

.reading-layout {
  grid-template-columns: minmax(310px, 0.62fr) minmax(0, 1.38fr);
  min-height: 680px;
}

.reading-control {
  border-right-color: rgba(232, 191, 117, 0.18);
  background:
    linear-gradient(180deg, rgba(232, 191, 117, 0.08), transparent 18rem),
    rgba(8, 11, 24, 0.78);
}

.section-head .eyebrow,
.eyebrow {
  color: var(--gold);
  font-size: 11px;
}

.section-head h2,
.panel-head-row h2,
.answer-panel h2 {
  color: #fff4df;
  font-size: 26px;
  font-weight: 900;
}

.section-head p:last-child,
.empty-note,
.status-text {
  color: #c6b59d;
}

.question-field,
.reflection-field,
.followup-field,
.draw-method,
.icon-picker {
  padding: 14px;
  border: 1px solid rgba(232, 191, 117, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.question-field span,
.reflection-field span,
.followup-field span,
.draw-method-head span,
.icon-picker-head span {
  color: #ead5b0;
  font-size: 13px;
}

textarea,
input,
select {
  border-color: rgba(232, 191, 117, 0.18);
  background: rgba(2, 5, 15, 0.68);
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(232, 191, 117, 0.78);
  box-shadow: 0 0 0 3px rgba(232, 191, 117, 0.12), 0 0 26px rgba(232, 191, 117, 0.1);
}

.icon-picker-grid {
  gap: 9px;
}

.icon-choice {
  border-color: rgba(232, 191, 117, 0.16);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 15%, rgba(232, 191, 117, 0.12), transparent 56%),
    rgba(7, 10, 22, 0.76);
}

.draw-method-option {
  border-color: rgba(232, 191, 117, 0.16);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 15%, rgba(232, 191, 117, 0.1), transparent 56%),
    rgba(7, 10, 22, 0.76);
}

.draw-method-option:has(input:checked) {
  border-color: rgba(232, 191, 117, 0.86);
  background:
    radial-gradient(circle at 50% 35%, rgba(232, 191, 117, 0.24), transparent 62%),
    rgba(232, 191, 117, 0.1);
}

.icon-choice.is-selected {
  border-color: rgba(232, 191, 117, 0.86);
  background:
    radial-gradient(circle at 50% 35%, rgba(232, 191, 117, 0.28), transparent 62%),
    rgba(232, 191, 117, 0.1);
}

.icon-choice-mark {
  background: linear-gradient(180deg, #f4d992, #bd8430);
}

.primary-action {
  border-color: rgba(232, 191, 117, 0.9);
  color: #160f06;
  background: linear-gradient(180deg, #f5d992, #c48b35 66%, #9d651f);
  box-shadow: 0 10px 30px rgba(196, 139, 53, 0.24);
}

.secondary-action,
.danger-action {
  background: rgba(255, 255, 255, 0.045);
}

.card-stage {
  position: relative;
  background:
    linear-gradient(180deg, rgba(5, 8, 20, 0.18), rgba(5, 8, 20, 0.74)),
    url("/assets/reading-stage.webp") center / cover no-repeat,
    #070b17;
}

.card-stage::before {
  content: "";
  position: absolute;
  inset: 22px;
  pointer-events: none;
  border: 1px solid rgba(232, 191, 117, 0.14);
  border-radius: 12px;
}

.card-spread {
  position: relative;
  z-index: 1;
  max-width: 1160px;
}

.tarot-card {
  border-color: rgba(232, 191, 117, 0.42);
  background: linear-gradient(160deg, rgba(232, 191, 117, 0.1), rgba(255, 255, 255, 0.02)), #090d1b;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.48), 0 0 34px rgba(232, 191, 117, 0.08);
}

.card-inner {
  border-color: rgba(232, 191, 117, 0.38);
  background:
    radial-gradient(circle at 50% 30%, rgba(232, 191, 117, 0.14), transparent 44%),
    linear-gradient(180deg, #17182a, #050814);
}

.answer-panel {
  border-top-color: rgba(232, 191, 117, 0.18);
  background:
    linear-gradient(180deg, rgba(232, 191, 117, 0.06), transparent 18rem),
    rgba(7, 10, 22, 0.86);
}

.reading-summary {
  border-color: rgba(232, 191, 117, 0.28);
  background: linear-gradient(180deg, rgba(232, 191, 117, 0.11), rgba(232, 191, 117, 0.045));
}

.reading-card-note,
.journal-card,
.library-card,
.library-detail-meanings div {
  border-color: rgba(232, 191, 117, 0.18);
  background: rgba(5, 8, 20, 0.52);
}

.journal-card,
.library-card {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.library-card:hover,
.library-card:focus-visible {
  border-color: rgba(232, 191, 117, 0.58);
  background: rgba(232, 191, 117, 0.09);
  transform: translateY(-2px);
}

.library-section-head {
  border-bottom-color: rgba(232, 191, 117, 0.22);
}

.library-section-head h3 {
  color: #fff4df;
  font-size: 20px;
}

.library-image-frame {
  border-color: rgba(232, 191, 117, 0.24);
  background: rgba(3, 6, 16, 0.58);
}

.site-disclaimer {
  justify-content: center;
  margin-top: 22px;
  border-top-color: rgba(232, 191, 117, 0.18);
}

@media (max-width: 940px) {
  .reading-layout {
    min-height: 0;
  }

  .card-stage::before {
    inset: 14px;
  }
}

@media (max-width: 680px) {
  .tarot-shell {
    width: min(100% - 20px, 1360px);
    padding-top: 18px;
  }

  .brand-lockup::before,
  .brand-lockup::after {
    display: none;
  }

  .mode-tabs {
    border-radius: 10px;
  }

  .question-field,
  .reflection-field,
  .followup-field,
  .draw-method,
  .icon-picker {
    padding: 12px;
  }
}

@media (max-width: 940px) {
  .tarot-topbar,
  .panel-head-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .reading-layout {
    grid-template-columns: 1fr;
  }

  .reading-control {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .library-detail-image-frame {
    width: min(280px, 100%);
    justify-self: center;
  }

  .library-detail-copy {
    padding-right: 0;
  }
}

@media (max-width: 680px) {
  .tarot-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 12px;
  }

  h1 {
    font-size: 28px;
  }

  .brand-tagline {
    font-size: 14px;
  }

  .mode-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 12px;
  }

  .mode-tab {
    flex: 0 0 auto;
  }

  .reading-control,
  .card-stage,
  .answer-panel,
  [data-panel="journal"],
  [data-panel="library"] {
    padding: 16px;
  }

  .card-spread {
    grid-template-columns: 1fr;
    max-width: 360px;
  }

  .icon-picker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .draw-method-head,
  .manual-draw-head,
  .manual-draw-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .manual-draw-panel {
    width: 100%;
  }

  .manual-deck-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    max-height: 58vh;
  }

  .manual-card-back {
    min-height: 0;
    padding: 3px;
  }

  .tarot-card {
    min-height: 460px;
  }

  .manual-card-back {
    min-height: 0;
  }

  .panel-actions,
  .library-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .followup-head,
  .followup-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-start;
  }

  .followup-head > span {
    width: fit-content;
  }

  .followup-suggestion {
    max-width: 100%;
    white-space: normal;
    text-align: left;
  }

  .library-tools input {
    width: 100%;
  }

  .library-group-nav {
    margin-inline: -16px;
    padding-inline: 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .library-group-nav a {
    flex: 0 0 auto;
  }

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

@media (max-width: 420px) {
  .manual-deck-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .oracle-panel.is-view-enter,
  .tarot-card.is-flipped .card-inner,
  .card-back:hover .card-inner {
    animation: none;
  }

  .card-back,
  .card-back .card-inner,
  .card-back .card-inner::before,
  .card-back .card-inner::after {
    transition: none;
  }
}
