:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #1f1f1f;
  --panel-border: rgba(255, 255, 255, 0.05);
  --panel-hover: #282828;
  --text-primary: #f3f0e6;
  --text-muted: rgba(243, 240, 230, 0.75);
  --accent: #d8a161;
  --shadow: rgba(0, 0, 0, 0.45);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(216, 161, 97, 0.15), transparent 50%), var(--bg);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 16px 72px;
}

.app-nav {
  width: min(1100px, 100%);
  display: flex;
  justify-content: flex-start;
}

.app-nav__link {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  padding: 10px 18px;
  border: 1px solid rgba(216, 161, 97, 0.4);
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.app-nav__link:hover,
.app-nav__link:focus-visible {
  background: rgba(216, 161, 97, 0.15);
  color: #fff;
  outline: none;
}

.app {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 32px;
  text-align: center;
}

.screen.active {
  display: flex;
}

.screen__header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.screen__title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.5rem, 3.4vw, 3rem);
  letter-spacing: 0.12em;
  margin: 0;
}

.screen__note {
  margin: 0;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow {
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.35em;
  color: var(--accent);
  margin: 0;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.ask-screen__header {
  text-transform: uppercase;
  letter-spacing: 0.4rem;
  color: var(--accent);
}

.ask-screen__header {
  text-transform: uppercase;
  letter-spacing: 0.4rem;
  color: var(--accent);
}

.ask-screen__eyebrow {
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.75rem, 1vw, 1rem);
  margin: 0;
  opacity: 0.8;
}

.ask-screen__title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  margin: 8px 0 0;
  letter-spacing: 0.2em;
}

.ask-screen__input-block {
  width: 100%;
}

.question-input {
  display: flex;
  align-items: stretch;
  background: var(--panel);
  border-radius: 24px;
  padding: 12px 12px 12px 20px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 60px var(--shadow);
}

.question-input textarea {
  flex: 1;
  font: inherit;
  background: transparent;
  color: var(--text-primary);
  border: none;
  resize: none;
  outline: none;
  min-height: 92px;
  line-height: 1.6;
}

.question-input textarea::placeholder {
  color: var(--text-muted);
}

.send-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 1.15rem;
  cursor: pointer;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.send-button:not(:disabled):hover {
  background: var(--accent);
  color: #1a1a1a;
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ask-screen__suggestions {
  width: 100%;
}

.guides {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  padding: 32px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-shadow: 0 20px 60px var(--shadow);
}

.guides__header {
  text-align: left;
}

.guides__title {
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.05em;
  margin: 6px 0;
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
}

.guides__intro {
  color: var(--text-muted);
  margin: 0;
  max-width: 720px;
}

.guides__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.guide-card {
  background: var(--panel);
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-card h3 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.guide-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.guide-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  line-height: 1.4;
}

.guides__steps,
.guides__topics {
  background: rgba(255, 255, 255, 0.015);
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  padding: 24px;
}

.guides__steps h3,
.guides__topics h3 {
  margin: 0 0 12px;
  letter-spacing: 0.15em;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: var(--accent);
}

.guides__steps ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-primary);
  line-height: 1.6;
}

.guides__steps li {
  margin-bottom: 6px;
}

.guides__topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 18px;
  color: var(--text-muted);
}

.guides__topics-grid p {
  margin: 0;
  line-height: 1.4;
}

.guides__note {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.suggestion-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 18px 20px;
  text-align: left;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 50px var(--shadow);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.suggestion-card:hover,
.suggestion-card:focus-visible {
  background: var(--panel-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.ask-screen__footer {
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.is-hidden {
  display: none !important;
}

.deck {
  padding: 32px;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 12px;
  justify-items: center;
  min-height: 220px;
  position: relative;
  overflow: hidden;
}

.deck.deck--animating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 280px;
  pointer-events: none;
}

.deck.deck--locked {
  pointer-events: none;
  opacity: 0.5;
}

.deck-card {
  width: 66px;
  aspect-ratio: 2.5 / 4.1;
  border-radius: 12px;
  border: none;
  background: #f8f6f1 url('https://tarotreader.me/wp-content/plugins/synastry-core/inc/post-types/tarot/shortcodes/tarot-list/variations/card-back/assets/img/card-back.png')
    center/cover no-repeat;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.deck-card:hover {
  transform: translateY(-6px) scale(1.02);
  filter: brightness(1.05);
}

.deck-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.deck-card.deck-card--selected {
  box-shadow: 0 0 0 3px var(--accent), 0 20px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(-10px) scale(1.03);
}

.shuffle-orbit {
  width: min(420px, 100%);
  height: min(260px, 60vw);
  position: relative;
  perspective: 1200px;
}

.shuffle-orbit__inner {
  --orbit-radius: clamp(140px, 28vw, 240px);
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: orbit-spin 5s cubic-bezier(0.6, 0, 0.2, 1) infinite;
}

.shuffle-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(46px, 7vw, 70px);
  aspect-ratio: 2.5 / 4.1;
  border-radius: 12px;
  background: #f8f6f1 url('https://tarotreader.me/wp-content/plugins/synastry-core/inc/post-types/tarot/shortcodes/tarot-list/variations/card-back/assets/img/card-back.png')
    center/cover no-repeat;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
  transform: rotateX(12deg)
    rotateY(calc(var(--index) * 20deg))
    translateZ(var(--orbit-radius))
    rotateY(calc(var(--index) * -20deg));
  animation: shuffle-bob 1.8s ease-in-out infinite;
  animation-delay: calc(var(--index) * 60ms);
  opacity: 0.95;
}

.shuffle-orbit__caption {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}

@keyframes orbit-spin {
  0% {
    transform: rotateX(18deg) rotateY(0deg);
  }
  60% {
    transform: rotateX(16deg) rotateY(220deg);
  }
  100% {
    transform: rotateX(18deg) rotateY(360deg);
  }
}

@keyframes shuffle-bob {
  0%,
  100% {
    transform: rotateX(12deg)
      rotateY(calc(var(--index) * 20deg))
      translateZ(var(--orbit-radius))
      translateY(0)
      rotateY(calc(var(--index) * -20deg));
  }
  50% {
    transform: rotateX(14deg)
      rotateY(calc(var(--index) * 20deg))
      translateZ(calc(var(--orbit-radius) + 16px))
      translateY(-8px)
      rotateY(calc(var(--index) * -20deg));
  }
}

.deck__status {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.reveal-button,
.restart-button {
  border: none;
  border-radius: 999px;
  padding: 14px 40px;
  background: var(--accent);
  color: #1b1208;
  font-weight: 600;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reveal-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.reveal-button:not(:disabled):hover,
.restart-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.screen--reading {
  gap: 32px;
}

.reading-cards {
  display: flex;
  flex-direction: column;
  gap: 32px;
  text-align: left;
  position: relative;
}

.reading-cards.is-revealing .reading-spread {
  perspective: 1600px;
  transform-style: preserve-3d;
}

.reading-cards.is-revealing .reading-card {
  opacity: 0;
  transform: translateY(30px) rotateX(8deg) scale(0.95);
  animation: tarot-card-reveal 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: calc(var(--card-index, 0) * 160ms);
}

.reading-summary {
  background: linear-gradient(180deg, rgba(20, 17, 13, 0.95), rgba(9, 8, 6, 0.9));
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

.reading-summary__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 18px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.summary-item {
  display: flex;
  gap: 16px;
}

.summary-item__label {
  min-width: 120px;
  color: var(--accent);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin: 0;
}

.summary-item__value {
  flex: 1;
  color: var(--text-primary);
  line-height: 1.6;
}

.summary-text {
  margin: 0;
}

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

.summary-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  color: var(--text-primary);
  opacity: 0.85;
}

.reading-spread {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 24px;
}

.reading-spread > * {
  height: 100%;
}

.ai-panel {
  background: linear-gradient(180deg, rgba(9, 7, 6, 0.95), rgba(4, 4, 4, 0.92));
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-panel__eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.75rem;
  color: var(--accent);
}

.ai-panel__content {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.7;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.ai-panel__content.is-visible {
  opacity: 1;
}

.ai-panel__content p {
  margin: 0 0 12px;
}

.ai-panel__content ul,
.ai-panel__content ol {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--text-muted);
}

.ai-panel__content li {
  margin-bottom: 6px;
}

.ai-panel__status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.ai-panel__status--loading .shimmer {
  width: 60px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.25), rgba(255,255,255,0.05));
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

.ai-panel__status--error {
  color: #ff9b7b;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
 100% { background-position: -200% 0; }
}

.reading-card {
  background: linear-gradient(180deg, rgba(12, 12, 12, 0.95), rgba(5, 5, 5, 0.92));
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 22px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  text-align: left;
}

.reading-card__figure {
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
}

.reading-card__img {
  width: 100%;
  height: auto;
  display: block;
}

.reading-card__img--reversed {
  transform: rotate(180deg);
}

.reading-card__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reading-card__position {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--accent);
}

.reading-card__name {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.reading-card__orientation {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.reading-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@keyframes tarot-card-reveal {
  0% {
    opacity: 0;
    transform: translateY(36px) rotateX(10deg) scale(0.9);
    filter: blur(6px);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) rotateX(2deg) scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scale(1);
  }
}

.reading-field {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.reading-field span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.reading-actions {
  display: flex;
  justify-content: center;
}

.reading-actions {
  display: flex;
  justify-content: center;
}

@media (max-width: 640px) {
  body {
    padding: 24px 12px;
  }

  .app {
    gap: 48px;
  }

  .question-input {
    flex-direction: column;
    gap: 12px;
    border-radius: 18px;
  }

  .send-button {
    align-self: flex-end;
  }

  .deck {
    padding: 18px;
  }
  .deck.deck--animating {
    min-height: 220px;
  }

  .reveal-button,
  .restart-button {
    width: 100%;
  }

  .guides {
    padding: 20px;
    gap: 24px;
  }

  .guides__grid,
  .guides__topics-grid {
    grid-template-columns: 1fr;
  }

  .reading-card {
    padding: 18px;
  }

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