:root {
  --bg: #0b1021;
  --bg-soft: #121939;
  --panel: #171f47;
  --text: #f8f6ff;
  --muted: #b8b8d8;
  --line: #313d7d;
  --accent: #c38bff;
  --accent-2: #76ccff;
  --good: #95f7c6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% -10%, #4b2a7d 0%, transparent 35%),
    radial-gradient(circle at 90% -20%, #2a557d 0%, transparent 36%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
  padding: 24px;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.hero,
.panel {
  background: color-mix(in srgb, var(--panel), #04050f 22%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.badge {
  display: inline-block;
  border: 1px solid #8a6abe;
  color: #e8dcff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
}

.hero h1 {
  margin: 8px 0;
}

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

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.field.wide,
.actions {
  grid-column: 1 / -1;
}

label {
  font-weight: 700;
}

textarea,
select,
button {
  font: inherit;
}

textarea,
select {
  width: 100%;
  border: 1px solid #4553a0;
  background: #0f1533;
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button.ghost {
  background: #232d62;
  border: 1px solid #5d6dbb;
}

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

.spread-header {
  margin-bottom: 10px;
}

.spread-header h2,
.summary h2,
.history h2 {
  margin: 0;
}

#reading-meta {
  color: var(--muted);
  margin: 6px 0 0;
}

.spread {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card-slot {
  border: 1px solid #4453a8;
  border-radius: 14px;
  background: #0d1435;
  padding: 12px;
  display: grid;
  gap: 8px;
  animation: pop 0.35s ease;
}

@keyframes pop {
  from { transform: scale(0.97); opacity: 0.5; }
  to { transform: scale(1); opacity: 1; }
}

.position {
  margin: 0;
  color: #d7c2ff;
  font-weight: 700;
}

.card-figure {
  margin: 0;
}

.card-image {
  width: 100%;
  aspect-ratio: 3 / 5;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #5769c1;
  background: #1f295e;
}

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

.card-name {
  margin-top: 8px;
  font-weight: 700;
}

.orientation,
.meaning,
#summary-text,
#advice-list,
.muted,
#history-list {
  color: var(--muted);
}

.orientation {
  margin: 0;
  font-weight: 700;
}

.meaning {
  margin: 0;
  line-height: 1.45;
}

#summary-text {
  margin: 8px 0 10px;
  line-height: 1.6;
}

#advice-list,
#history-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}

.summary-actions {
  margin-top: 14px;
}

.history-item-title {
  color: #ede4ff;
  font-weight: 700;
}

.history-item-sub {
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  body {
    padding: 14px;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
