:root {
  color-scheme: light;
  --rose: #c94d78;
  --rose-deep: #8f3159;
  --blush: #f8dfe6;
  --sage: #6e8f79;
  --sage-deep: #416452;
  --gold: #d8a84f;
  --cream: #fff9f2;
  --paper: rgba(255, 255, 255, 0.82);
  --ink: #282421;
  --muted: #746c66;
  --line: rgba(40, 36, 33, 0.12);
  --shadow: 0 24px 68px rgba(70, 45, 42, 0.14);
  --soft-shadow: 0 16px 36px rgba(80, 55, 50, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background:
    linear-gradient(120deg, rgba(255, 249, 242, 0.94), rgba(250, 237, 229, 0.76)),
    radial-gradient(circle at 12% 18%, rgba(248, 223, 230, 0.9), transparent 24rem),
    radial-gradient(circle at 82% 10%, rgba(216, 168, 79, 0.25), transparent 22rem),
    radial-gradient(circle at 75% 88%, rgba(110, 143, 121, 0.2), transparent 28rem);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 72%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.85rem 0;
  backdrop-filter: blur(18px);
}

.brand-mark,
.top-actions {
  display: inline-flex;
  align-items: center;
}

.brand-mark {
  gap: 0.55rem;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-dot {
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--gold));
  box-shadow: 0 0 0 6px rgba(201, 77, 120, 0.12);
}

.top-actions {
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.top-actions a {
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.top-actions a:hover {
  color: var(--rose-deep);
  background: rgba(248, 223, 230, 0.7);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 24rem);
  gap: 2rem;
  width: min(1180px, calc(100% - 2rem));
  min-height: calc(100vh - 4.5rem);
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.reading-space {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 1.1rem;
}

.intro {
  padding-top: clamp(0.5rem, 3vw, 2rem);
}

.kicker,
.section-label {
  margin: 0 0 0.45rem;
  color: var(--rose);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
li {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 12em;
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 4rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.lead {
  max-width: 43rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.8;
}

.question-panel,
.message-box,
.history-box,
.ritual-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.question-panel {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
}

.panel-head,
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.question-panel label {
  font-size: 1.08rem;
  font-weight: 900;
}

.mini-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(216, 168, 79, 0.38);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  color: #8a6326;
  font-size: 0.78rem;
  font-weight: 900;
  background: rgba(255, 247, 225, 0.86);
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.prompt-chips button {
  min-height: 2.25rem;
  border: 1px solid rgba(201, 77, 120, 0.18);
  border-radius: 999px;
  padding: 0 0.75rem;
  color: var(--rose-deep);
  font-size: 0.86rem;
  font-weight: 800;
  background: rgba(255, 244, 247, 0.9);
}

.prompt-chips button:hover,
.prompt-chips button.is-selected {
  color: #fff;
  background: var(--rose);
}

textarea {
  width: 100%;
  min-height: 6.2rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

textarea:focus {
  border-color: rgba(201, 77, 120, 0.7);
  box-shadow: 0 0 0 4px rgba(201, 77, 120, 0.12);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(7rem, 1fr));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.78);
}

.mode-button,
.draw-button,
#clearHistory {
  min-height: 2.75rem;
  border: 0;
  border-radius: 999px;
  padding: 0 1rem;
  color: var(--ink);
  background: transparent;
}

.mode-button {
  font-weight: 850;
}

.mode-button.is-active {
  color: #fff;
  background: var(--sage-deep);
  box-shadow: 0 8px 18px rgba(65, 100, 82, 0.18);
}

.draw-button {
  min-width: 10rem;
  color: #fff;
  font-weight: 950;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep) 58%, var(--gold));
  box-shadow: 0 14px 28px rgba(143, 49, 89, 0.22);
}

.draw-button:hover {
  filter: saturate(1.05) brightness(1.02);
  transform: translateY(-1px);
}

.draw-button:active {
  transform: translateY(1px);
}

.deck-stage {
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) 1fr;
  align-items: center;
  gap: 1.25rem;
  min-height: 25.5rem;
}

.deck-preview {
  position: relative;
  aspect-ratio: 573 / 345;
  border-radius: 8px;
  transform: rotate(-4deg);
  box-shadow: 0 28px 50px rgba(67, 45, 33, 0.2);
}

.deck-preview img,
.flip-side img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.deck-note {
  position: absolute;
  right: -0.8rem;
  bottom: -4.1rem;
  display: grid;
  gap: 0.2rem;
  width: min(15.5rem, 78vw);
  border: 1px solid rgba(216, 168, 79, 0.24);
  border-radius: 8px;
  padding: 0.85rem;
  color: var(--muted);
  background: rgba(255, 252, 246, 0.9);
  box-shadow: var(--soft-shadow);
}

.deck-note strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.deck-note span {
  font-size: 0.84rem;
  line-height: 1.55;
}

.spread {
  display: grid;
  grid-template-columns: repeat(var(--spread-count, 1), minmax(12rem, 1fr));
  gap: 1rem;
  align-items: start;
}

.oracle-card {
  display: grid;
  gap: 0.8rem;
  animation: riseIn 420ms ease both;
}

.card-face {
  border: 0;
  padding: 0;
  background: transparent;
  perspective: 1200px;
}

.position-label {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  margin-bottom: 0.45rem;
  border-radius: 999px;
  padding: 0 0.65rem;
  color: var(--sage-deep);
  font-size: 0.82rem;
  font-weight: 950;
  background: rgba(231, 239, 234, 0.9);
}

.flip-card {
  position: relative;
  display: block;
  aspect-ratio: 573 / 345;
  transform-style: preserve-3d;
  transition: transform 720ms cubic-bezier(0.2, 0.75, 0.2, 1);
}

.oracle-card.is-revealed .flip-card {
  transform: rotateY(180deg);
}

.flip-side {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  backface-visibility: hidden;
  box-shadow: 0 18px 40px rgba(67, 45, 33, 0.2);
}

.flip-side.front {
  transform: rotateY(180deg);
}

.card-copy {
  min-height: 9.2rem;
  border-left: 4px solid var(--gold);
  padding: 0.1rem 0 0.1rem 0.85rem;
}

.card-number {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.card-copy h3 {
  margin: 0 0 0.45rem;
  font-size: 1.14rem;
  line-height: 1.35;
}

.card-guidance {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.68;
}

.article-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.85rem;
  border-bottom: 1px solid currentColor;
  color: var(--rose);
  font-weight: 800;
  line-height: 1.45;
  text-decoration: none;
}

.article-link::after {
  content: " →";
  margin-left: 0.25rem;
}

.article-link:hover,
.article-link:focus-visible {
  color: var(--ink);
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
  padding-top: clamp(0.5rem, 3vw, 2rem);
}

.message-box,
.history-box,
.ritual-box {
  padding: 1rem;
}

.message-box h2,
.history-box h2,
.ritual-box h2 {
  margin: 0 0 0.75rem;
  font-size: 1.28rem;
  line-height: 1.4;
}

.message-box p:last-of-type {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.74;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.result-actions span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.result-actions strong {
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  color: var(--rose-deep);
  background: rgba(248, 223, 230, 0.75);
}

.ritual-box ul {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.65;
}

#clearHistory {
  min-height: 2.2rem;
  color: var(--rose);
  font-weight: 850;
}

#clearHistory:hover {
  background: rgba(248, 223, 230, 0.75);
}

#historyList {
  display: grid;
  gap: 0.65rem;
  max-height: 18rem;
  margin: 0;
  padding-left: 1.2rem;
  overflow: auto;
}

#historyList li {
  color: var(--muted);
  line-height: 1.55;
}

.history-card-links {
  display: grid;
  gap: 0.28rem;
}

.history-card-links a,
#historyList strong {
  color: var(--ink);
  font-weight: 800;
}

.history-card-links a {
  text-decoration-color: rgba(166, 83, 85, 0.45);
  text-underline-offset: 0.24em;
}

.history-card-links a:hover,
.history-card-links a:focus-visible {
  color: var(--rose);
}

#historyList p {
  margin: 0.25rem 0 0;
  font-size: 0.84rem;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(0.8rem);
  }

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

@media (max-width: 920px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  .reading-space,
  .side-panel {
    width: 100%;
    min-width: 0;
  }

  .reading-space {
    display: flex;
    flex-direction: column;
  }

  .side-panel {
    position: static;
    z-index: auto;
    clear: both;
    padding-top: 0;
  }

  .deck-stage {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    width: 100%;
    min-height: 0;
  }

  .deck-preview {
    width: min(18rem, 70vw);
    margin: 0 auto 3.8rem;
  }

  .deck-note {
    right: 50%;
    transform: translateX(50%);
  }

  .message-box,
  .history-box,
  .ritual-box {
    width: 100%;
    background: #fffaf4;
    backdrop-filter: none;
  }
}

@media (max-width: 680px) {
  .top-bar,
  .app-shell {
    width: min(100% - 1rem, 42rem);
  }

  .top-actions a {
    padding: 0.42rem 0.62rem;
  }

  .app-shell {
    padding: 0.5rem 0 1rem;
  }

  h1 {
    font-size: clamp(2rem, 9vw, 2.75rem);
  }

  .panel-head,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .mini-badge {
    width: fit-content;
  }

  .segmented,
  .draw-button {
    width: 100%;
  }

  .prompt-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .prompt-chips button {
    padding: 0 0.55rem;
  }

  .spread {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .oracle-card,
  .question-panel,
  .deck-preview,
  .card-face,
  .flip-card {
    min-width: 0;
    max-width: 100%;
  }

  .side-panel {
    display: flex;
    flex-direction: column;
  }

  .message-box {
    order: 1;
  }

  .ritual-box {
    order: 2;
  }

  .history-box {
    order: 3;
  }

  #historyList {
    max-height: none;
  }

  .history-card-links a,
  #historyList strong {
    overflow-wrap: anywhere;
  }
}

/* 2026 brand edition — ivory, rose gold and quiet editorial spacing */
:root {
  --rose: #a5655f;
  --rose-deep: #70433f;
  --blush: #f2e1d9;
  --sage: #7c8d7b;
  --sage-deep: #4f6254;
  --gold: #bd8c68;
  --cream: #f8f1e8;
  --paper: rgba(255, 252, 247, 0.9);
  --ink: #322a25;
  --muted: #776b62;
  --line: rgba(113, 76, 56, 0.16);
  --shadow: 0 26px 70px rgba(91, 66, 50, 0.11);
  --soft-shadow: 0 16px 38px rgba(91, 66, 50, 0.1);
}

body {
  background:
    radial-gradient(circle at 8% 12%, rgba(212, 174, 148, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 48%, rgba(170, 133, 105, 0.1), transparent 32rem),
    linear-gradient(135deg, #fbf6ef 0%, #f5ede3 52%, #fbf7f1 100%);
}

body::before {
  opacity: 0.38;
  background-image: radial-gradient(rgba(120, 84, 63, 0.2) 0.55px, transparent 0.55px);
  background-size: 7px 7px;
}

.top-bar {
  width: min(1280px, calc(100% - 3rem));
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  gap: 0;
  letter-spacing: 0.08em;
}

.brand-name {
  display: grid;
  gap: 0.1rem;
}

.brand-name b {
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.brand-name small {
  color: var(--muted);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.19em;
}

.top-actions {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.top-actions a {
  border-radius: 0;
  border-bottom: 1px solid transparent;
  font-weight: 600;
}

.top-actions a:hover {
  border-bottom-color: var(--gold);
  color: var(--rose-deep);
  background: transparent;
}

.app-shell {
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 23rem);
  gap: clamp(2rem, 4vw, 4.5rem);
  width: min(1280px, calc(100% - 3rem));
  padding-top: 2.2rem;
}

.brand-hero {
  display: grid;
  grid-template-columns: minmax(18rem, 1.08fr) minmax(18rem, 0.92fr);
  align-items: center;
  gap: clamp(1.6rem, 4vw, 3.8rem);
  min-height: 29rem;
  padding-top: 0;
}

.logo-stage {
  position: relative;
  margin: 0;
  padding: clamp(0.5rem, 2vw, 1.5rem);
}

.logo-stage::before {
  position: absolute;
  inset: 8% -5% -8% 7%;
  z-index: -1;
  border: 0;
  content: none;
}

.logo-stage img {
  display: block;
  width: 100%;
  border: 0;
  filter: drop-shadow(0 18px 24px rgba(117, 77, 52, 0.11));
}

.intro-copy {
  padding: 2rem 0;
}

.intro-copy .kicker {
  color: var(--gold);
  letter-spacing: 0.22em;
}

.intro-copy h1 {
  max-width: none;
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: clamp(2.6rem, 4.4vw, 4.7rem);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: 0.06em;
}

.intro-copy .lead {
  max-width: 33rem;
  font-size: 1rem;
  line-height: 2;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.35rem;
  border-bottom: 1px solid var(--gold);
  padding: 0.55rem 0;
  color: var(--rose-deep);
  font-family: "Noto Serif TC", "PMingLiU", serif;
  letter-spacing: 0.12em;
}

.hero-cta span {
  color: var(--gold);
}

.question-panel,
.message-box,
.history-box,
.ritual-box {
  border-radius: 0;
  box-shadow: var(--soft-shadow);
}

.question-panel {
  padding: clamp(1.2rem, 2.5vw, 2rem);
}

.question-panel label,
.message-box h2,
.history-box h2,
.ritual-box h2 {
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-weight: 600;
}

.prompt-chips button,
.segmented,
.mode-button,
.draw-button,
.mini-badge,
.result-actions strong,
#clearHistory {
  border-radius: 2px;
}

.prompt-chips button {
  border-color: rgba(165, 101, 95, 0.22);
  color: var(--rose-deep);
  background: #fbf6f0;
}

.draw-button {
  background: linear-gradient(135deg, #6b4a3e, #9b6755 62%, #bd8c68);
}

.deck-preview,
.deck-preview img,
.flip-side,
.flip-side img,
.deck-note,
textarea {
  border-radius: 2px;
}

@media (max-width: 920px) {
  .brand-hero {
    grid-template-columns: 1fr 0.9fr;
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .top-bar,
  .app-shell {
    width: min(100% - 1.25rem, 42rem);
  }

  .brand-name small {
    display: none;
  }

  .top-actions a {
    padding-inline: 0.45rem;
  }

  .brand-hero {
    grid-template-columns: 1fr;
    gap: 1.8rem;
    padding: 0.5rem 0 1rem;
  }

  .logo-stage {
    width: calc(100% - 1.5rem);
    margin-inline: auto;
  }

  .intro-copy {
    padding: 0 0.5rem;
    text-align: center;
  }

  .intro-copy h1 {
    font-size: clamp(2.25rem, 11vw, 3.25rem);
  }

  .intro-copy .lead {
    margin-inline: auto;
  }
}
