:root {
  color-scheme: dark;
  --c-navy: #1F2A4A;
  --c-navy-deep: #141C33;
  --c-cream: #FFF6DC;
  --c-cream-dim: #D9CFB4;
  --c-gold: #F4C542;
  --c-gold-soft: rgba(244,197,66,.6);
  --c-hint-heading: #6B5310;
  --f-serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", serif;
  --fs-hero: 2.25rem;
  --fs-heading: 1.75rem;
  --fs-body: 1rem;
  --fs-small: .8125rem;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --r-panel: 20px;
  --r-button: 999px;
  font-family: var(--f-serif);
  font-size: 100%;
  line-height: 1.8;
  color: var(--c-cream);
  background: var(--c-navy);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
p, h1, h2 { margin: 0; }

body {
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(120% 60% at 50% 0%, #2B3A64 0%, var(--c-navy) 55%, var(--c-navy-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: url("./stars.svg") top center / 390px auto repeat-y;
  opacity: .8;
}

.page {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-6) var(--sp-8);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  letter-spacing: .08em;
}

.moon { width: 22px; height: 22px; flex-shrink: 0; }
.introduction { margin-top: var(--sp-6); text-align: center; }

h1 {
  margin-bottom: var(--sp-4);
  font-size: var(--fs-hero);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .06em;
}

h1 span { color: var(--c-gold); }
.lead { font-size: var(--fs-body); }

button, .line-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  max-width: 100%;
  padding: 14px 40px;
  border: 0;
  border-radius: var(--r-button);
  font: 700 1.0625rem/1 var(--f-serif);
  letter-spacing: .1em;
  text-decoration: none;
  cursor: pointer;
}

button {
  margin-top: var(--sp-6);
  background: var(--c-gold);
  color: var(--c-navy);
  box-shadow: 0 0 0 1px var(--c-gold), 0 6px 24px rgba(244,197,66,.25);
}

button.is-secondary { background: transparent; color: var(--c-gold); }
button:hover:enabled { box-shadow: 0 0 0 2px var(--c-gold), 0 6px 24px rgba(244,197,66,.25); }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, .line-button:focus-visible { outline: 3px solid var(--c-cream); outline-offset: 3px; }
.line-button:focus-visible { outline-color: var(--c-navy); }

.status {
  margin-top: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--c-cream-dim);
  overflow-wrap: anywhere;
}

.card-stage { display: grid; gap: var(--sp-6); margin-top: var(--sp-6); }

.tarot-card {
  min-width: 0;
  padding: var(--sp-6);
  border: 1px solid var(--c-gold-soft);
  border-radius: var(--r-panel);
  background: rgba(255,246,220,.06);
  text-align: center;
}

.tarot-card.is-unopened { padding: 0; border: 0; background: transparent; }

.card-art {
  position: relative;
  width: 60%;
  max-width: 240px;
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: var(--c-navy);
  box-shadow: 0 0 0 2px var(--c-gold-soft), 0 10px 30px rgba(0,0,0,.4);
}

.card-art img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; }
.card-front .card-art { margin-bottom: var(--sp-4); }

.card-art .name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5%;
  padding: 10px 8px;
  background: rgba(31,42,74,.85);
  color: var(--c-cream);
  font: 700 20px/1.4 var(--f-serif);
  letter-spacing: .08em;
  text-align: center;
  overflow-wrap: anywhere;
}

.deck-note { margin-top: var(--sp-3); font-size: var(--fs-small); color: var(--c-cream-dim); }
.card-keyword { color: var(--c-gold); font-size: var(--fs-small); letter-spacing: .12em; }

h2 {
  margin: var(--sp-1) 0 var(--sp-3);
  font-size: var(--fs-heading);
  font-weight: 700;
  line-height: 1.4;
}

.card-keyword, h2, .card-message, .card-hint { overflow-wrap: anywhere; white-space: pre-wrap; }
.card-message { margin-top: var(--sp-2); text-align: left; }

.card-hint-section {
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 14px;
  color: var(--c-navy);
  background: var(--c-cream);
  text-align: left;
}

.card-hint-label { color: var(--c-hint-heading); font-size: var(--fs-small); font-weight: 700; line-height: 1.6; }

/* Keep 310px for the unchanged copy at a 390px viewport. */
.line-cta {
  min-width: 0;
  padding: var(--sp-6) var(--sp-4);
  border-radius: var(--r-panel);
  color: var(--c-navy);
  background: var(--c-cream);
  text-align: center;
  overflow-wrap: anywhere;
}

.line-cta p { letter-spacing: 0; text-wrap: pretty; }

.line-button {
  width: 100%;
  margin-top: var(--sp-4);
  padding-right: var(--sp-3);
  padding-left: var(--sp-3);
  background: var(--c-navy);
  color: var(--c-cream);
  box-shadow: 0 0 0 2px var(--c-gold);
}

.line-button:hover { text-decoration: underline; text-underline-offset: .2em; }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1) var(--sp-3);
  margin-top: var(--sp-8);
  color: var(--c-cream-dim);
  font-size: var(--fs-small);
  text-align: center;
}

.is-revealing { animation: reveal-card .6s ease-out; }

@keyframes reveal-card {
  from { transform: perspective(800px) rotateY(90deg); opacity: 0; }
  to { transform: perspective(800px) rotateY(0deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .is-revealing { animation: none; }
}
