:root {
  --ink: #f8f1de;
  --muted: #b9ae98;
  --coal: #050506;
  --wine: #2a0d14;
  --red: #721827;
  --gold: #d9a441;
  --teal: #1d5b57;
  --emerald: #102f2c;
  --paper: #16110f;
  --shadow: rgba(0, 0, 0, 0.48);
  font: 16px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--coal);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(5, 5, 6, 0.94), rgba(31, 8, 14, 0.84)),
    radial-gradient(circle at 50% 10%, rgba(232, 219, 189, 0.2), transparent 18%),
    radial-gradient(circle at 76% 18%, rgba(90, 24, 39, 0.3), transparent 26%),
    radial-gradient(circle at 12% 82%, rgba(217, 164, 65, 0.12), transparent 26%),
    #050506;
}

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

button {
  min-height: 42px;
  border: 1px solid rgba(217, 164, 65, 0.42);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(10, 9, 9, 0.88);
  cursor: pointer;
}

button:hover,
button:focus-visible {
  border-color: rgba(248, 225, 173, 0.86);
  background: rgba(61, 16, 27, 0.92);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #f6d98a;
  outline-offset: 3px;
}

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

.app-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 18px;
  padding: clamp(14px, 3vw, 28px);
}

.reading-panel,
.oracle-panel {
  min-width: 0;
}

.reading-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid rgba(217, 190, 135, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(9, 8, 8, 0.76), rgba(3, 3, 3, 0.82)),
    #050506;
  box-shadow: 0 24px 70px var(--shadow);
  overflow: hidden;
}

.top-bar,
.section-heading,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #d9c08a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4.4vw, 60px);
  line-height: 0.95;
}

h2 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.05;
}

.reading-count {
  width: 108px;
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 190, 135, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(35, 13, 19, 0.9), rgba(5, 5, 6, 0.92)),
    #090909;
}

.reading-count span {
  display: block;
  color: #ffe6a6;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.reading-count small {
  color: #c8bd9f;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.spread-tabs,
.category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.spread-tab,
.category-tab {
  min-width: 0;
  padding: 0 10px;
  white-space: nowrap;
}

.spread-tab.is-active,
.category-tab.is-active {
  color: #130d08;
  background: linear-gradient(180deg, #f4e3bd, #a87532);
  border-color: #ffe7a3;
  font-weight: 900;
}

.category-tabs {
  padding: 8px;
  border: 1px solid rgba(217, 190, 135, 0.22);
  border-radius: 8px;
  background: rgba(3, 3, 3, 0.44);
}

.fate-prompt {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 190, 135, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(42, 13, 20, 0.68), rgba(5, 5, 6, 0.82)),
    #090909;
}

.birth-field {
  display: grid;
  gap: 6px;
}

.birth-field label,
.focus-check {
  color: #f4e3bd;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.focus-check {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(217, 190, 135, 0.22);
  border-radius: 6px;
  background: rgba(3, 3, 3, 0.46);
  cursor: pointer;
}

.focus-check input {
  width: 18px;
  height: 18px;
  accent-color: #d9a441;
}

.focus-check span {
  min-width: 0;
}

.birth-field label {
  white-space: nowrap;
}

.zodiac-field {
  grid-column: 1 / -1;
}

.birth-field input,
.birth-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(217, 190, 135, 0.36);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(3, 3, 3, 0.72);
}

.birth-field select {
  cursor: pointer;
}

.fate-prompt p {
  grid-column: 1 / -1;
  min-height: 17px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(217, 190, 135, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 5, 6, 0.08), rgba(5, 5, 6, 0.74)),
    #050506;
}

.table-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.96;
}

.spread-board {
  position: relative;
  z-index: 1;
  width: min(100%, 900px);
  min-height: 450px;
  display: grid;
  gap: 18px;
  place-items: center;
  padding: 96px 24px 30px;
}

.spread-single {
  grid-template-columns: minmax(170px, 220px);
}

.spread-three {
  grid-template-columns: repeat(3, minmax(140px, 190px));
}

.spread-cross {
  grid-template-columns: repeat(3, minmax(120px, 170px));
  grid-template-rows: repeat(3, auto);
}

.deck-button {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  width: 96px;
  min-height: 132px;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 8px;
  border-color: rgba(248, 225, 173, 0.66);
  background:
    linear-gradient(180deg, rgba(10, 9, 9, 0.92), rgba(31, 8, 14, 0.88)),
    #070607;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

.deck-card {
  width: 58px;
  height: 82px;
  border-radius: 6px;
  background: url("./assets/card-back.svg") center / cover no-repeat;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.42);
}

.tarot-card {
  width: 100%;
  max-width: 190px;
  aspect-ratio: 2.35 / 3.45;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(217, 190, 135, 0.7);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(244, 227, 189, 0.12), transparent 18%),
    radial-gradient(circle at 50% 35%, rgba(217, 190, 135, 0.14), transparent 35%),
    #111;
  box-shadow:
    inset 0 0 0 1px rgba(244, 227, 189, 0.18),
    inset 0 0 0 7px #050506,
    0 24px 42px rgba(0, 0, 0, 0.5);
  transform: translateY(0);
  animation: cardIn 420ms ease both;
}

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

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

.card-label {
  min-height: 20px;
  color: #d9c08a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.card-inner {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 190, 135, 0.42);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 34%, rgba(244, 239, 227, 0.28), transparent 20%),
    radial-gradient(circle at 50% 54%, rgba(0, 0, 0, 0.62), transparent 42%),
    linear-gradient(135deg, var(--card-a), #050506);
  background:
    radial-gradient(circle at 50% 34%, rgba(244, 239, 227, 0.28), transparent 20%),
    radial-gradient(circle at 50% 54%, rgba(0, 0, 0, 0.62), transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--card-a) 42%, #050506), color-mix(in srgb, var(--card-b) 36%, #050506));
  overflow: hidden;
}

.card-inner::before,
.card-inner::after {
  content: "";
  position: absolute;
  width: 45%;
  height: 54%;
  bottom: 12%;
  background: #020202;
  opacity: 0.82;
}

.card-inner::before {
  left: 5%;
  clip-path: polygon(100% 0, 72% 26%, 100% 35%, 62% 50%, 100% 62%, 54% 78%, 100% 100%, 0 78%, 24% 48%, 0 24%);
}

.card-inner::after {
  right: 5%;
  clip-path: polygon(0 0, 28% 26%, 0 35%, 38% 50%, 0 62%, 46% 78%, 0 100%, 100% 78%, 76% 48%, 100% 24%);
}

.card-symbol {
  position: relative;
  z-index: 1;
  color: #f4e3bd;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 8vw, 74px);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.38);
}

.card-name {
  min-height: 38px;
  display: grid;
  align-items: center;
  margin: 0;
  color: #f4e3bd;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.controls {
  flex-wrap: wrap;
}

.controls button {
  min-width: 132px;
  padding: 0 16px;
  font-weight: 900;
}

.primary-action {
  color: #130d08;
  background: linear-gradient(180deg, #f4e3bd, #a87532);
  border-color: #ffe7a3;
}

.oracle-panel {
  display: grid;
  gap: 14px;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.reader-note,
.payment-box,
.card-list,
.journal-box {
  border: 1px solid rgba(217, 190, 135, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 12, 11, 0.86), rgba(5, 5, 6, 0.86)),
    #080808;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

.reader-note {
  padding: 16px;
}

.reader-note p:last-child,
.payment-box p {
  margin-bottom: 0;
  color: var(--muted);
}

.payment-box {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.payment-box .primary-action {
  width: 100%;
}

.card-list {
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
}

.section-heading span {
  color: #d9c08a;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.card-details {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-card {
  padding: 12px;
  border: 1px solid rgba(217, 190, 135, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(42, 13, 20, 0.7), rgba(5, 5, 6, 0.76)),
    #090909;
}

.detail-card h3 {
  margin: 0 0 4px;
  color: #f4e3bd;
  font-size: 15px;
}

.detail-card p {
  margin: 0;
  color: #d8d1bf;
  font-size: 14px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.journal-box {
  padding: 14px;
}

.journal-box .section-heading {
  margin-bottom: 10px;
}

.journal-box .section-heading button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 900;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 116px;
  border: 1px solid rgba(217, 190, 135, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(4, 4, 5, 0.72);
}

.save-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: #d9c08a;
  font-size: 12px;
  font-weight: 800;
}

@keyframes cardIn {
  from {
    opacity: 0;
    translate: 0 18px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .oracle-panel {
    grid-template-rows: auto;
  }

  .spread-board {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .reading-count {
    width: 100%;
  }

  .spread-tabs,
  .category-tabs {
    grid-template-columns: 1fr;
  }

  .fate-prompt {
    grid-template-columns: 1fr;
  }

  .spread-board,
  .spread-three,
  .spread-cross {
    grid-template-columns: minmax(150px, 210px);
    min-height: auto;
    padding: 142px 14px 22px;
  }

  .deck-button {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .controls button {
    width: 100%;
  }
}
