:root {
  --bg: #120f1e;
  --bg-soft: #1c1730;
  --panel: rgba(19, 16, 35, 0.72);
  --panel-strong: rgba(27, 22, 49, 0.92);
  --line: rgba(255, 232, 208, 0.12);
  --text: #fff6ea;
  --text-soft: #d4c7bc;
  --accent: #ffb870;
  --accent-strong: #ff8f5a;
  --mint: #87dfc3;
  --danger: #ff7f87;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(122, 88, 255, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 157, 103, 0.16), transparent 30%),
    linear-gradient(180deg, #0f0c18 0%, #171224 45%, #120f1e 100%);
  color: var(--text);
  font-family: "Trebuchet MS", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  position: relative;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 184, 112, 0.08), transparent 18%),
    radial-gradient(circle at 82% 30%, rgba(135, 223, 195, 0.07), transparent 20%),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.03), transparent 28%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 6, 14, 0.1), rgba(7, 6, 14, 0.28));
  pointer-events: none;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(12px);
  pointer-events: none;
  opacity: 0.7;
}

.orb-one {
  width: 240px;
  height: 240px;
  left: -70px;
  top: 80px;
  background: radial-gradient(circle, rgba(255, 184, 112, 0.45), rgba(255, 184, 112, 0));
}

.orb-two {
  width: 300px;
  height: 300px;
  right: -100px;
  top: 340px;
  background: radial-gradient(circle, rgba(135, 223, 195, 0.3), rgba(135, 223, 195, 0));
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 590px);
  margin: 0 auto;
  padding: 18px 16px 54px;
}

.glass-panel {
  background: linear-gradient(180deg, rgba(27, 22, 49, 0.94), rgba(17, 14, 31, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 18%);
  pointer-events: none;
}

.hero,
.builder,
.selection,
.result,
.history,
.deck-gallery {
  padding: 22px;
  margin-bottom: 16px;
}

.hero {
  overflow: hidden;
  padding-top: 28px;
  min-height: 332px;
  background:
    radial-gradient(circle at 84% 18%, rgba(255, 184, 112, 0.16), transparent 20%),
    radial-gradient(circle at 78% 62%, rgba(135, 223, 195, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(33, 26, 58, 0.98), rgba(17, 14, 31, 0.94));
}

.hero::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -60px;
  top: -40px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 184, 112, 0.14), rgba(255, 184, 112, 0));
  pointer-events: none;
}

.hero::before {
  content: "";
  position: absolute;
  right: 24px;
  bottom: 26px;
  width: 156px;
  height: 210px;
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.2), transparent 26%),
    linear-gradient(180deg, rgba(47, 29, 86, 0.92), rgba(20, 14, 37, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 24px 50px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transform: rotate(12deg);
  opacity: 0.92;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1,
.section-head h2 {
  margin: 0;
  line-height: 1.18;
  font-family: "Georgia", "STKaiti", serif;
}

.hero h1 {
  font-size: clamp(32px, 7vw, 44px);
  max-width: 10ch;
  position: relative;
  z-index: 1;
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.hero-copy {
  margin: 18px 0 0;
  color: var(--text-soft);
  line-height: 1.8;
  font-size: 15px;
  max-width: 34ch;
  position: relative;
  z-index: 1;
}

.hero-note {
  margin: 22px 0 0;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.7;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 184, 112, 0.11), rgba(255, 184, 112, 0.04));
  border: 1px solid rgba(255, 184, 112, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 1;
  max-width: 31ch;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
  max-width: 300px;
}

.stat-card {
  padding: 16px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--mint);
}

.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-soft);
}

.section-head {
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.section-head h2 {
  font-size: clamp(28px, 6vw, 34px);
}

.section-head.compact {
  margin-bottom: 0;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
}

.gallery-copy {
  margin-top: -2px;
}

.field-tip {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-soft);
}

.builder,
.selection {
  background:
    radial-gradient(circle at top right, rgba(255, 184, 112, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(27, 22, 49, 0.95), rgba(14, 12, 27, 0.94));
}

.result,
.history {
  background:
    radial-gradient(circle at top right, rgba(135, 223, 195, 0.08), transparent 22%),
    linear-gradient(180deg, rgba(27, 22, 49, 0.95), rgba(14, 12, 27, 0.94));
}

.builder::after,
.selection::after {
  content: "";
  position: absolute;
  inset: auto 22px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  pointer-events: none;
}

.topic-input {
  width: 100%;
  min-height: 108px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(255, 250, 243, 0.04);
  color: var(--text);
  line-height: 1.7;
  resize: none;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.topic-input::placeholder {
  color: rgba(255, 246, 234, 0.42);
}

.topic-input:focus {
  border-color: rgba(255, 184, 112, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 184, 112, 0.08);
  background: rgba(255, 250, 243, 0.08);
}

.ai-settings-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-settings-panel summary {
  cursor: pointer;
  list-style: none;
  font-size: 15px;
  font-weight: 700;
}

.ai-settings-panel summary::-webkit-details-marker {
  display: none;
}

.ai-settings-copy {
  margin-top: 12px;
}

.ai-settings-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.ai-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 250, 243, 0.06);
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.ai-input:focus {
  border-color: rgba(255, 184, 112, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 184, 112, 0.08);
  background: rgba(255, 250, 243, 0.08);
}

.action-row-compact {
  margin-top: 16px;
}

.ai-settings-status.is-error {
  color: #ffb3b3;
}

.spread-header {
  margin-top: 20px;
}

.spread-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.spread-card {
  width: 100%;
  padding: 18px 18px 17px;
  text-align: left;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.spread-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 999px;
  background: transparent;
  transition: background 180ms ease;
}

.spread-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 184, 112, 0.16), transparent 62%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.spread-card.active {
  background:
    linear-gradient(180deg, rgba(255, 184, 112, 0.19), rgba(255, 143, 90, 0.08)),
    rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 184, 112, 0.42);
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.16);
}

.spread-card.active::before {
  background: linear-gradient(180deg, var(--accent), rgba(255, 143, 90, 0.7));
}

.spread-card.active::after,
.spread-card:hover::after {
  opacity: 1;
}

.spread-title {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

.spread-intro,
.spread-positions {
  display: block;
  margin-top: 8px;
  color: var(--text-soft);
  line-height: 1.6;
  font-size: 13px;
}

.spread-positions {
  color: var(--accent);
}

.action-row {
  display: grid;
  gap: 12px;
  margin-top: 26px;
}

.primary-button,
.ghost-button,
.mini-button {
  min-height: 52px;
  border-radius: 999px;
  transition: transform 180ms ease, opacity 180ms ease, background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #31180b;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(255, 143, 90, 0.22);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.04em;
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 35%);
  pointer-events: none;
}

.ghost-button,
.mini-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.mini-button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
  backdrop-filter: blur(10px);
}

.mini-button.danger {
  color: #ffdfe1;
  border-color: rgba(255, 127, 135, 0.25);
}

.primary-button:active,
.ghost-button:active,
.mini-button:active,
.spread-card:active {
  transform: scale(0.98);
}

.primary-button:hover,
.ghost-button:hover,
.mini-button:hover,
.spread-card:hover,
.pick-card:hover,
.gallery-filter:hover {
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.hidden {
  display: none;
}

.payment-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.payment-modal.hidden {
  display: none;
}

.payment-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 13, 0.68);
  backdrop-filter: blur(14px);
}

.payment-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 22px;
}

.payment-title {
  margin: 0;
  font-family: "Georgia", "STKaiti", serif;
  font-size: clamp(28px, 6vw, 34px);
  line-height: 1.18;
}

.payment-copy,
.payment-note {
  margin: 14px 0 0;
  color: var(--text-soft);
  line-height: 1.8;
  font-size: 14px;
}

.payment-card {
  margin-top: 18px;
  padding: 14px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 30px rgba(0, 0, 0, 0.16);
}

.payment-qr-image {
  display: block;
  width: 100%;
  border-radius: 20px;
  background: #ffffff;
}

.result-summary,
.selection-top,
.history-top,
.history-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-topic {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.result-summary {
  padding: 16px 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 28px rgba(0, 0, 0, 0.12);
}

.result-meta,
.history-meta {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-soft);
}

.card-list {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.selection-tip-box {
  position: relative;
  margin-top: 16px;
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at right top, rgba(255, 184, 112, 0.16), transparent 28%),
    linear-gradient(135deg, rgba(255, 184, 112, 0.08), rgba(135, 223, 195, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 30px rgba(0, 0, 0, 0.12);
}

.selection-tip-box::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.selection-tip,
.selection-subtip {
  margin: 0;
  line-height: 1.8;
}

.selection-tip {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  max-width: 24ch;
}

.selection-subtip {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.picked-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.picked-chip {
  padding: 10px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-soft);
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.picked-chip.active {
  color: var(--accent);
  border-color: rgba(255, 184, 112, 0.32);
  background: rgba(255, 184, 112, 0.08);
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
  perspective: 1200px;
}

.pick-card {
  position: relative;
  min-height: 206px;
  overflow: hidden;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(255, 184, 112, 0.24), transparent 42%),
    linear-gradient(180deg, rgba(47, 29, 86, 0.96), rgba(20, 14, 37, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 20px 34px rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, filter 180ms ease;
}

.pick-card::before,
.pick-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pick-card::after {
  inset: auto 18px 18px;
  top: 18px;
  border-radius: 999px;
  border-width: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.pick-card::before {
  inset: 10px;
  border-radius: 22px;
}

.pick-card::after {
  inset: auto 22px 22px;
  top: 22px;
}

.pick-card-glow {
  position: absolute;
  inset: -40% 22%;
  background: radial-gradient(circle, rgba(255, 184, 112, 0.28), transparent 62%);
  filter: blur(18px);
  animation: pulseGlow 5s ease-in-out infinite;
}

.pick-card-star,
.pick-card-label {
  position: relative;
  z-index: 1;
  display: block;
}

.pick-card-star {
  margin-bottom: 12px;
  font-size: 28px;
  color: var(--accent);
}

.pick-card-label {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 246, 234, 0.78);
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pick-card:hover {
  transform: translateY(-6px) rotateX(4deg);
  border-color: rgba(255, 184, 112, 0.32);
  filter: saturate(1.08);
}

.pick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tarot-card {
  position: relative;
  padding: 20px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255, 184, 112, 0.1), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    linear-gradient(145deg, rgba(255, 184, 112, 0.05), transparent 35%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: riseIn 420ms ease both;
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.18);
}

.tarot-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.tarot-card::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 20px;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 184, 112, 0.12), transparent 70%);
  pointer-events: none;
}

.card-visual {
  margin-bottom: 18px;
}

.card-visual-frame {
  position: relative;
  min-height: 150px;
  border-radius: 24px;
  padding: 14px;
  background:
    radial-gradient(circle at top, rgba(255, 184, 112, 0.24), transparent 44%),
    linear-gradient(180deg, rgba(40, 28, 73, 0.98), rgba(24, 18, 43, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card-visual-frame::before,
.card-visual-frame::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-visual-frame::after {
  inset: 18px;
  border-style: dashed;
  opacity: 0.45;
}

.card-sigil,
.card-visual-name {
  position: relative;
  z-index: 1;
}

.card-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: contain;
  border-radius: 16px;
  position: relative;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(244, 236, 228, 0.96));
  padding: 8px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.card-sigil {
  position: absolute;
  top: 24px;
  right: 22px;
  font-size: 34px;
  color: var(--accent);
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

.card-visual-name {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 246, 234, 0.8);
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.72);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.card-position,
.history-spread {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-name,
.history-topic {
  margin: 6px 0 0;
  font-family: "Georgia", "STKaiti", serif;
  font-size: 24px;
}

.card-arcana {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-soft);
}

.card-direction {
  display: inline-flex;
  align-items: center;
  padding: 9px 11px;
  border-radius: 999px;
  background: rgba(135, 223, 195, 0.14);
  color: var(--mint);
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid rgba(135, 223, 195, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card-direction.reversed {
  background: rgba(255, 127, 135, 0.14);
  color: #ffb2b7;
  border-color: rgba(255, 127, 135, 0.18);
}

.card-keywords,
.card-meaning,
.history-summary,
.insight-copy,
.empty-copy {
  line-height: 1.8;
  color: var(--text-soft);
}

.card-keywords {
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.card-meaning {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.card-advice-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 184, 112, 0.1), rgba(255, 184, 112, 0.04));
  border: 1px solid rgba(255, 184, 112, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card-advice-title {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-advice {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.7;
  font-size: 14px;
}

.insight-box {
  margin-top: 18px;
  padding: 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(135, 223, 195, 0.08), rgba(255, 184, 112, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 28px rgba(0, 0, 0, 0.12);
}

.insight-box-ai {
  background:
    radial-gradient(circle at top right, rgba(114, 201, 255, 0.12), transparent 26%),
    linear-gradient(135deg, rgba(255, 184, 112, 0.1), rgba(114, 201, 255, 0.08));
}

.insight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.insight-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--accent);
  background: rgba(255, 184, 112, 0.12);
  border: 1px solid rgba(255, 184, 112, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.insight-generate-button {
  margin-top: 2px;
  margin-bottom: 2px;
}

.mini-button:disabled,
.ghost-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.insight-title,
.empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.insight-copy {
  margin: 0;
  font-size: 15px;
  line-height: 1.85;
}

.history-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.gallery-filter {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  font-size: 13px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.gallery-filter.active {
  background: linear-gradient(135deg, rgba(255, 184, 112, 0.2), rgba(255, 143, 90, 0.12));
  border-color: rgba(255, 184, 112, 0.32);
  color: var(--text);
}

.deck-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.deck-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.gallery-card {
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.gallery-card-face {
  position: relative;
  min-height: 188px;
  padding: 12px;
  background:
    radial-gradient(circle at top, rgba(255, 184, 112, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(41, 31, 76, 0.98), rgba(20, 14, 38, 0.98));
}

.gallery-card-face::before,
.gallery-card-face::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-card-face::after {
  inset: 18px;
  opacity: 0.48;
  border-style: dashed;
}

.gallery-card-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 188px;
  object-fit: contain;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(244, 236, 228, 0.96));
  padding: 8px;
}

.gallery-card-arcana {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 246, 234, 0.62);
}

.gallery-card-name {
  margin: 8px 0 0;
  font-family: "Georgia", "STKaiti", serif;
  font-size: 22px;
  line-height: 1.25;
}

.gallery-card-body {
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.gallery-card-keywords {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-soft);
}

.summary-tile {
  padding: 16px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.summary-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.summary-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

.gallery-filter-hint {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-soft);
}

.history-card {
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 184, 112, 0.08), transparent 24%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 14px 28px rgba(0, 0, 0, 0.1);
}

.history-summary {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.8;
}

.history-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tag {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.empty-state {
  padding: 26px 8px 10px;
  text-align: center;
}

.empty-copy {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.8;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

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

@keyframes pulseGlow {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.72;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 28px;
  }

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

   .hero {
    min-height: 356px;
  }

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

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

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

@media (max-width: 420px) {
  .hero,
  .builder,
  .selection,
  .result,
  .history,
  .deck-gallery {
    padding: 20px 18px;
  }

  .hero {
    min-height: 0;
  }

  .hero::before {
    right: -6px;
    bottom: 72px;
    width: 120px;
    height: 166px;
    opacity: 0.8;
  }

  .hero-copy,
  .hero-note {
    max-width: 100%;
  }

  .selection-top {
    flex-direction: column;
    align-items: stretch;
  }

  .selection-tip {
    max-width: none;
  }

  .pick-card {
    min-height: 188px;
  }
}
