:root {
  --tarot-card-ratio: 0.596;
  --night-ink: #101622;
  --night-soft: #1a2333;
  --paper: #efe4d0;
  --paper-soft: #f7f0e2;
  --gold: #c8a95d;
  --gold-soft: #e8d3a0;
  --rose: #b77d86;
  --text-main: #f3ead8;
  --text-dark: #2f2a21;
  --shadow: rgba(7, 10, 16, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Serif SC", "Songti SC", serif;
  background: radial-gradient(circle at 15% 20%, #283852 0%, transparent 40%),
    radial-gradient(circle at 80% 15%, #3d2a47 0%, transparent 35%),
    linear-gradient(155deg, #0d111a 0%, #1a2435 45%, #101622 100%);
  color: var(--text-main);
  line-height: 1.6;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

.sky-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 0.6px, transparent 0.6px);
  background-size: 3px 3px;
  opacity: 0.45;
}

.site-header,
main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
}

.site-header {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(232, 211, 160, 0.3);
  padding-bottom: 16px;
}

.brand-mark {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  font-size: 0.74rem;
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", "Times New Roman", serif;
  letter-spacing: 0.03em;
  margin: 0 0 10px 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(2.1rem, 3.4vw, 3.4rem);
  font-weight: 600;
  color: var(--paper-soft);
}

h2 {
  font-size: clamp(1.7rem, 2.6vw, 2.5rem);
  font-weight: 600;
}

h3 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  color: var(--gold-soft);
}

p {
  margin: 0 0 10px 0;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-btn,
.filter-btn {
  border: 1px solid rgba(232, 211, 160, 0.45);
  background: rgba(22, 30, 44, 0.82);
  color: var(--text-main);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav-btn:hover,
.filter-btn:hover {
  transform: translateY(-1px);
  background: rgba(35, 47, 68, 0.95);
}

.nav-btn.active,
.filter-btn.active {
  background: linear-gradient(120deg, rgba(198, 169, 93, 0.28), rgba(183, 125, 134, 0.25));
  border-color: var(--gold-soft);
}

main {
  display: grid;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: page-rise 0.45s ease both;
}

@keyframes page-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  background: linear-gradient(170deg, rgba(17, 24, 36, 0.88), rgba(12, 16, 25, 0.92));
  border: 1px solid rgba(232, 211, 160, 0.24);
  box-shadow: 0 20px 60px var(--shadow);
  border-radius: 20px;
  padding: clamp(18px, 3vw, 34px);
}

.panel-large {
  min-height: 68vh;
}

.panel-narrow {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px 0;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  color: var(--gold-soft);
}

.intro {
  max-width: 64ch;
  color: #eadfc8;
}

.draw-form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

fieldset {
  border: 1px solid rgba(232, 211, 160, 0.22);
  border-radius: 16px;
  padding: 14px 16px 16px;
}

legend {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  color: var(--gold-soft);
  padding: 0 8px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.option-card {
  border: 1px solid rgba(247, 240, 226, 0.2);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: rgba(19, 25, 36, 0.5);
}

.option-card input {
  accent-color: var(--gold);
}

.question-wrap {
  display: grid;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid rgba(232, 211, 160, 0.35);
  background: rgba(12, 17, 25, 0.88);
  color: var(--text-main);
  padding: 10px 12px;
  font: inherit;
}

textarea:focus {
  outline: 2px solid rgba(200, 169, 93, 0.5);
  outline-offset: 1px;
}

.form-error {
  min-height: 22px;
  margin: 0;
  color: #ffb9b9;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  font: inherit;
}

.btn-primary {
  width: fit-content;
  background: linear-gradient(135deg, #d5b56b, #bd8f52);
  color: #251a0f;
  font-weight: 600;
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(200, 169, 93, 0.23), rgba(183, 125, 134, 0.2));
  border: 1px solid rgba(232, 211, 160, 0.4);
  color: var(--text-main);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(232, 211, 160, 0.35);
  color: var(--text-main);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
}

.draw-stage {
  margin-top: 16px;
  position: relative;
  min-height: 420px;
  border-radius: 16px;
  border: 1px solid rgba(232, 211, 160, 0.2);
  background:
    radial-gradient(circle at 20% 20%, rgba(92, 74, 116, 0.25), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(198, 169, 93, 0.12), transparent 40%),
    rgba(11, 17, 27, 0.64);
  overflow: hidden;
}

.draw-stage.is-results {
  min-height: 0;
  border: none;
  background: transparent;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  overflow: visible;
}

.draw-stage.is-results.is-single {
  grid-template-columns: minmax(700px, 980px);
  justify-content: center;
}

.draw-stage.is-results.is-multi {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.draw-status {
  margin: 14px 0 0;
  color: #f0ddb8;
  letter-spacing: 0.03em;
}

.draw-progress {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.progress-pill {
  border-radius: 999px;
  border: 1px solid rgba(232, 211, 160, 0.32);
  padding: 4px 11px;
  font-size: 0.78rem;
  color: #e8dbc1;
  background: rgba(15, 22, 33, 0.58);
  transition: all 0.25s ease;
}

.progress-pill.is-active {
  border-color: #f2db9f;
  background: rgba(198, 169, 93, 0.24);
  color: #fff0cd;
}

.progress-pill.is-done {
  border-color: rgba(152, 216, 165, 0.8);
  background: rgba(84, 157, 107, 0.24);
  color: #e7ffe8;
}

.pick-preview {
  min-height: 0;
}

.shuffle-stack {
  height: 100%;
  min-height: 420px;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
}

.shuffle-card {
  width: 132px;
  aspect-ratio: var(--tarot-card-ratio);
  border-radius: 14px;
  border: 1px solid rgba(232, 211, 160, 0.36);
  background:
    radial-gradient(circle at 30% 20%, rgba(224, 201, 142, 0.25), transparent 35%),
    linear-gradient(155deg, #24344f, #111b2a);
  position: absolute;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.38);
  animation: shuffle-wave 0.92s ease-in-out infinite;
  overflow: hidden;
}

.shuffle-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  border: 1px solid rgba(232, 211, 160, 0.22);
}

.shuffle-card::before {
  content: "*";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: rgba(232, 211, 160, 0.72);
}

.shuffle-card:nth-child(1) { transform: rotate(-14deg) translateX(-74px); animation-delay: 0ms; }
.shuffle-card:nth-child(2) { transform: rotate(-7deg) translateX(-38px); animation-delay: 100ms; }
.shuffle-card:nth-child(3) { transform: rotate(-1deg) translateX(-2px); animation-delay: 200ms; }
.shuffle-card:nth-child(4) { transform: rotate(6deg) translateX(36px); animation-delay: 300ms; }
.shuffle-card:nth-child(5) { transform: rotate(13deg) translateX(74px); animation-delay: 400ms; }

@keyframes shuffle-wave {
  0%, 100% {
    margin-top: 0;
  }
  50% {
    margin-top: -14px;
  }
}

.fanout-board {
  position: relative;
  min-height: 420px;
  border-radius: 14px;
  padding-top: 34px;
  background:
    radial-gradient(circle at 50% -8%, rgba(200, 169, 93, 0.18), transparent 46%),
    radial-gradient(circle at 50% 84%, rgba(72, 109, 152, 0.16), transparent 44%),
    rgba(7, 11, 18, 0.18);
  transition: opacity 0.38s ease, transform 0.38s ease;
}

.fanout-board.is-exit {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

.fanout-hint {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: #eadab7;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 211, 160, 0.25);
  background: rgba(12, 18, 28, 0.7);
  pointer-events: none;
}

.stage-card {
  position: absolute;
  width: 108px;
  aspect-ratio: var(--tarot-card-ratio);
  border: none;
  padding: 0;
  border-radius: 13px;
  cursor: pointer;
  transform-origin: center;
  transition:
    left 0.44s cubic-bezier(0.2, 0.78, 0.22, 1),
    top 0.44s cubic-bezier(0.2, 0.78, 0.22, 1),
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.2s ease,
    opacity 0.32s ease;
  background: transparent;
  opacity: 0;
}

.stage-card.is-in {
  opacity: 1;
}

.stage-card:hover {
  z-index: 99 !important;
}

.stage-card.is-hover {
  filter: brightness(1.12) drop-shadow(0 14px 24px rgba(0, 0, 0, 0.42));
}

.fanout-board.is-locking .stage-card.is-passive {
  opacity: 0.24;
  filter: saturate(0.72) blur(0.6px);
  pointer-events: none;
}

.stage-card.is-selected {
  z-index: 200 !important;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.5));
}

.stage-card[disabled] {
  cursor: default;
}

.stage-card-back,
.stage-card-front {
  display: grid;
  width: 100%;
  height: 100%;
  border-radius: 13px;
  border: 1px solid rgba(232, 211, 160, 0.4);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.34);
  backface-visibility: hidden;
}

.stage-card-back {
  place-items: center;
  background:
    radial-gradient(circle at 22% 20%, rgba(232, 211, 160, 0.2), transparent 28%),
    linear-gradient(165deg, #26354f, #131c2b 58%, #0f1521 100%);
  overflow: hidden;
  position: relative;
}

.stage-card-back::before {
  content: "";
  position: absolute;
  inset: -26%;
  background: conic-gradient(
    from 180deg at 50% 50%,
    rgba(232, 211, 160, 0.28),
    rgba(232, 211, 160, 0.02),
    rgba(232, 211, 160, 0.2),
    rgba(232, 211, 160, 0.02),
    rgba(232, 211, 160, 0.28)
  );
  animation: stage-back-spin 9s linear infinite;
}

.stage-card-back .frame {
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  border: 1px solid rgba(232, 211, 160, 0.24);
  box-shadow: inset 0 0 0 1px rgba(12, 18, 28, 0.38);
}

.stage-card-back .sigil {
  z-index: 1;
  font-size: 1.4rem;
  color: rgba(232, 211, 160, 0.74);
  text-shadow: 0 1px 10px rgba(8, 12, 18, 0.5);
}

.stage-card.is-used {
  filter: grayscale(0.06);
}

.stage-card.is-muted {
  opacity: 0.34;
  pointer-events: none;
}

.stage-card-front {
  color: #1f170c;
  position: relative;
  overflow: hidden;
  padding: 0;
  grid-template-rows: 1fr;
  animation: card-turn 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage-card-front .stage-top {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  margin: 0;
  border-radius: 6px;
  background: rgba(12, 14, 18, 0.58);
  color: #fff3d4;
  padding: 3px 6px;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 2;
}

.stage-card-front .stage-icon {
  display: none;
}

.stage-card-front .stage-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border: none;
}

.stage-card-front.is-reversed .stage-image {
  transform: rotate(180deg);
}

.stage-card-front .stage-name {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 24px;
  border-radius: 6px;
  background: rgba(12, 14, 18, 0.58);
  color: #fff3d4;
  padding: 3px 6px;
  font-weight: 700;
  line-height: 1.25;
  font-size: 0.72rem;
  z-index: 2;
}

.stage-card-front .stage-sub {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  margin: 0;
  border-radius: 6px;
  background: rgba(12, 14, 18, 0.58);
  color: #efe1c2;
  padding: 2px 6px;
  font-size: 0.62rem;
  z-index: 2;
}

.tone-major { background: linear-gradient(150deg, #f4e7c6, #e5c88d); }
.tone-wands { background: linear-gradient(150deg, #ffd4a0, #e89b55); }
.tone-cups { background: linear-gradient(150deg, #d7ecff, #7cb4f5); }
.tone-swords { background: linear-gradient(150deg, #ebedf1, #b1b9c8); }
.tone-pentacles { background: linear-gradient(150deg, #d5f2cf, #84c184); }

@keyframes stage-back-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes card-turn {
  from {
    opacity: 0;
    transform: rotateY(90deg);
  }
  to {
    opacity: 1;
    transform: rotateY(0);
  }
}

.card-back {
  height: 300px;
  border-radius: 16px;
  border: 1px solid rgba(232, 211, 160, 0.35);
  background: linear-gradient(140deg, #1b2435, #101722);
  position: relative;
  overflow: hidden;
}

.card-back::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(200, 169, 93, 0.25), transparent 80%);
  transform: translateX(-110%);
  animation: card-scan 1.6s ease infinite;
}

@keyframes card-scan {
  to {
    transform: translateX(110%);
  }
}

.tarot-card {
  perspective: 1000px;
  height: 100%;
}

.card-face {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 8px;
  border-radius: 16px;
  background: linear-gradient(145deg, #f7efde 0%, #eadcbd 100%);
  color: var(--text-dark);
  border: 1px solid rgba(63, 48, 29, 0.25);
  padding: 16px;
  transform-origin: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.draw-stage.is-results.is-single .tarot-card {
  height: auto;
}

.draw-stage.is-results.is-single .card-face {
  min-height: 420px;
  display: grid;
  grid-template-columns: clamp(180px, 32%, 250px) 1fr;
  grid-template-areas:
    "image position"
    "image name"
    "image orientation"
    "image keyword"
    "image meaning"
    "image advice";
  column-gap: 16px;
  row-gap: 7px;
  align-items: start;
}

.draw-stage.is-results.is-single .card-image {
  grid-area: image;
  width: 100%;
  height: 100%;
  min-height: 360px;
  aspect-ratio: auto;
}

.draw-stage.is-results.is-single .position-label {
  grid-area: position;
  margin: 0;
}

.draw-stage.is-results.is-single .card-name {
  grid-area: name;
  margin: 0;
}

.draw-stage.is-results.is-single .orientation {
  grid-area: orientation;
  margin: 0;
}

.draw-stage.is-results.is-single .keyword-line {
  grid-area: keyword;
  margin: 0;
}

.draw-stage.is-results.is-single .meaning {
  grid-area: meaning;
  margin: 0;
}

.draw-stage.is-results.is-single .advice-list {
  grid-area: advice;
  margin: 0;
}

.card-image {
  width: 100%;
  aspect-ratio: var(--tarot-card-ratio);
  object-fit: cover;
  object-position: center;
  background: rgba(10, 10, 10, 0.12);
  border-radius: 10px;
  border: 1px solid rgba(63, 48, 29, 0.28);
}

.card-image.is-reversed {
  transform: rotate(180deg);
}

.tarot-card.reveal .card-face {
  animation: flip-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes flip-in {
  from {
    opacity: 0;
    transform: rotateY(75deg) translateY(14px);
  }
  to {
    opacity: 1;
    transform: rotateY(0) translateY(0);
  }
}

.position-label {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #866b39;
}

.card-name {
  margin-top: 4px;
  margin-bottom: 4px;
  color: #342a1d;
}

.orientation {
  margin-bottom: 8px;
  font-weight: 600;
}

.keyword-line {
  font-size: 0.92rem;
  color: #5a4b35;
}

.meaning {
  margin-top: 10px;
}

.advice-list {
  margin: 10px 0 0;
  padding-left: 20px;
  margin-top: auto;
}

.session-meta {
  color: #d8ccb4;
}

.session-reading {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(232, 211, 160, 0.22);
  background: rgba(17, 24, 37, 0.45);
}

.session-detailed {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(200, 169, 93, 0.35);
  background: linear-gradient(160deg, rgba(13, 19, 30, 0.72), rgba(20, 28, 42, 0.8));
}

.ai-reading-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(126, 177, 226, 0.36);
  background: linear-gradient(160deg, rgba(10, 17, 30, 0.84), rgba(18, 31, 52, 0.72));
}

.ai-panel-note {
  margin: 0 0 10px 0;
  color: #d3e4f8;
  font-size: 0.88rem;
}

.ai-generate-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.ai-reading-status {
  font-size: 0.84rem;
  color: #d6e9ff;
}

.ai-reading-status[data-tone="success"] {
  color: #b6f2c0;
}

.ai-reading-status[data-tone="error"] {
  color: #ffb8b8;
}

.ai-reading-content {
  margin-top: 12px;
  border: 1px solid rgba(164, 203, 241, 0.24);
  border-radius: 10px;
  background: rgba(7, 13, 24, 0.56);
  padding: 10px 12px;
  color: #e6f2ff;
  line-height: 1.65;
}

.ai-reading-content p {
  margin: 0;
}

.detailed-cards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.detailed-item {
  border: 1px solid rgba(232, 211, 160, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(9, 14, 23, 0.45);
}

.detailed-item h4 {
  margin: 0 0 6px 0;
  font-size: 1.04rem;
  color: #f0ddb8;
}

.detailed-item p {
  margin: 0;
  color: #ebe0cb;
  font-size: 0.95rem;
}

.detailed-integration {
  margin-top: 12px;
  color: #f4e7ca;
}

.boundary-note {
  margin-top: 12px;
  color: #f0ddb8;
  font-size: 0.95rem;
}

.result-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.history-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.history-item {
  border: 1px solid rgba(232, 211, 160, 0.23);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(15, 21, 32, 0.68);
}

.history-item summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) auto auto;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-mode,
.history-spread {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(232, 211, 160, 0.3);
  font-size: 0.78rem;
  text-align: center;
}

.history-body {
  margin-top: 10px;
  border-top: 1px dashed rgba(232, 211, 160, 0.23);
  padding-top: 10px;
}

.history-cards {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  grid-template-columns: 1fr;
}

.history-card-mini {
  display: grid;
  gap: 10px;
  grid-template-columns: 120px 1fr;
  align-items: start;
  border: 1px solid rgba(232, 211, 160, 0.22);
  border-radius: 10px;
  background: rgba(13, 20, 32, 0.6);
  padding: 8px;
}

.history-card-mini img {
  width: 120px;
  aspect-ratio: var(--tarot-card-ratio);
  object-fit: cover;
  object-position: center;
  background: rgba(10, 10, 10, 0.12);
  border-radius: 6px;
  border: 1px solid rgba(232, 211, 160, 0.18);
}

.history-card-mini img.is-reversed {
  transform: rotate(180deg);
}

.history-card-mini p {
  margin: 0;
  font-size: 0.84rem;
  color: #e7dbc5;
  line-height: 1.5;
}

.history-card-copy {
  display: grid;
  gap: 6px;
  align-content: start;
}

.history-card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: #f3e6cb;
}

.history-card-keywords {
  margin: 0;
  font-size: 0.8rem;
  color: #d9cbaf;
}

.history-card-meaning {
  margin: 0;
  font-size: 0.82rem;
  color: #e7dcc8;
}

.history-card-advice {
  margin: 2px 0 0;
  padding-left: 18px;
  color: #e9dfce;
  font-size: 0.8rem;
  line-height: 1.45;
}

.gallery-toolbar {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

#gallery-search {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(232, 211, 160, 0.34);
  background: rgba(12, 18, 28, 0.82);
  color: #f3ead8;
  padding: 9px 12px;
  font: inherit;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-filter-btn {
  border: 1px solid rgba(232, 211, 160, 0.34);
  border-radius: 999px;
  background: rgba(22, 30, 44, 0.8);
  color: #f3ead8;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
}

.gallery-filter-btn.active {
  background: linear-gradient(120deg, rgba(198, 169, 93, 0.28), rgba(183, 125, 134, 0.23));
  border-color: var(--gold-soft);
}

.gallery-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.gallery-card {
  border: 1px solid rgba(232, 211, 160, 0.25);
  border-radius: 12px;
  background: rgba(13, 20, 31, 0.68);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.gallery-image {
  width: 100%;
  aspect-ratio: var(--tarot-card-ratio);
  object-fit: cover;
  object-position: center;
  background: rgba(10, 10, 10, 0.12);
  border-radius: 8px;
  border: 1px solid rgba(232, 211, 160, 0.18);
}

.gallery-name {
  margin: 0;
  font-size: 1rem;
}

.gallery-meta {
  margin: 0;
  font-size: 0.82rem;
  color: #d9ccb3;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  body {
    padding: 14px;
  }

  .site-header {
    align-items: start;
    flex-direction: column;
  }

  .history-item summary {
    grid-template-columns: 1fr;
  }

  .draw-stage,
  .fanout-board,
  .shuffle-stack {
    min-height: 380px;
  }

  .stage-card {
    width: 62px;
  }

  .draw-stage.is-results.is-single {
    grid-template-columns: minmax(220px, 1fr);
  }

  .draw-stage.is-results.is-single .card-face {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .draw-stage.is-results.is-single .card-image {
    min-height: 0;
    aspect-ratio: var(--tarot-card-ratio);
  }

  .history-card-mini {
    grid-template-columns: 1fr;
  }

  .history-card-mini img {
    width: 100%;
  }
}

