:root {
  --indigo: #4a3b85;       /* ボタンなどの色（夜空の紫） */
  --indigo-2: #5d4c9c;
  --night: #241d4a;
  --gold: #c9a24b;
  --gold-soft: #f6eedb;
  --ink: #23243a;
  --ink-2: #5c5e72;
  --paper: #f8f6fb;
  --card: #ffffff;
  --line: #e6e1ee;
  --line-green: #06c755;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', 'Meiryo', sans-serif;
  font-size: 17px;
  line-height: 1.75;
}
main { max-width: 560px; margin: 0 auto; padding: 0 16px 48px; }
[hidden] { display: none !important; }

h1, h2, h3 { line-height: 1.4; margin: 0; }
h2 { font-size: 19px; margin: 4px 0 8px; }
h3 { font-size: 14px; color: var(--ink-2); margin: 12px 0 4px; }
p { margin: 0 0 8px; }

.hero {
  margin: 0 -16px 16px;
  padding: 44px 24px 30px;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 235, 180, .6) 0 2px, transparent 3px),
    radial-gradient(circle at 18% 40%, rgba(255, 255, 255, .45) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 60% 70%, rgba(255, 255, 255, .35) 0 1px, transparent 2px),
    linear-gradient(165deg, #241d4a 0%, #3b2f6b 45%, #6b4f8f 75%, #d9b26a 100%); /* 夜空の紫から、金色へ */
}
.hero h1 { font-size: 30px; letter-spacing: .08em; margin: 6px 0 10px; }
.eyebrow { font-size: 13px; letter-spacing: .12em; opacity: .85; margin: 0; }
.lead { font-size: 16px; opacity: .95; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 14px;
}

.field { display: block; }
.field span { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.field input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--indigo); color: #fff; }
.btn.ghost { background: #fff; color: var(--indigo); border-color: var(--indigo); }
.btn.line { background: var(--line-green); color: #fff; }
.btn.text { background: none; color: var(--indigo-2); font-weight: 400; min-height: 40px; text-decoration: underline; }

.note { color: var(--ink-2); font-size: 13px; line-height: 1.7; }
.note.small { font-size: 12px; margin-top: 8px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.tag { font-size: 13px; padding: 2px 10px; border-radius: 99px; background: var(--gold-soft); color: #7a5b16; }
.advice { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); }
.advice h3 { color: #7a5b16; margin-top: 0; }
.advice p:last-child { margin-bottom: 0; }

.about p { font-size: 15px; color: var(--ink-2); }
.about p:last-child { margin-bottom: 0; }

/* 占い方の一覧 */
.spreads { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.spreads button {
  width: 100%; height: 100%; min-height: 64px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font: inherit; color: var(--ink); padding: 8px 10px; cursor: pointer; line-height: 1.4;
}
.spreads b { display: block; font-size: 15px; }
.spreads small { display: block; font-size: 11px; color: var(--ink-2); }
.spreads .cnt { color: var(--indigo); font-weight: 700; font-size: 12px; }
.spreads button.on { border-color: var(--indigo); background: #f0edf9; box-shadow: inset 0 0 0 1px var(--indigo); }
.spread-detail { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sd-name { font-size: 20px; color: var(--indigo); margin: 0; }
.sd-meta { font-weight: 700; color: #7a5b16; font-size: 14px; }
.positions { margin: 4px 0 0; padding-left: 1.6em; font-size: 14px; }
.positions li { margin-bottom: 2px; }
.positions small { color: var(--ink-2); }

/* カードの並べ方 */
.layout { position: relative; margin: 8px auto; }
.slot {
  position: absolute; border: none; padding: 0; background: none; cursor: pointer; font: inherit;
}
.slot .inner { position: absolute; inset: 0; }
.slot .face, .slot .back {
  position: absolute; inset: 0; border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(30, 20, 60, .3);
}
.slot .back {
  background:
    radial-gradient(circle at 50% 50%, #e8c983 0 6%, transparent 7%),
    repeating-linear-gradient(45deg, rgba(232, 201, 131, .35) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-45deg, rgba(232, 201, 131, .35) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #2b2257, #4a3b85);
  border: 2px solid #e8c983;
}
.slot .face { display: none; background: #fff; }
.slot.open .face { display: block; }
.slot.open .back { display: none; }
.slot .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.rev .face img { transform: rotate(180deg); }
.slot .num {
  position: absolute; left: -4px; top: -6px; z-index: 2; min-width: 20px; height: 20px; padding: 0 4px;
  border-radius: 99px; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}
.slot.cross { z-index: 1; }
.layout.mini .slot { cursor: default; }
.layout.mini .back { border-width: 1px; background: linear-gradient(160deg, #ece8f6, #f7f1e3); box-shadow: none; border-color: #cfc5e6; }
.layout.mini .num { left: 50%; top: 22%; transform: translate(-50%, -50%); }
.layout.mini .cross .num { top: 50%; transform: translate(-50%, -50%) rotate(-90deg) scale(1.4); }

.table-card { background: linear-gradient(170deg, #ffffff, #f3effa); }
.r-question { font-weight: 700; color: #7a5b16; margin: 0; }

/* 読み */
.readings { list-style: none; padding: 0; margin: 0; }
.readings li { border-top: 1px solid var(--line); padding: 14px 0; }
.readings li:first-child { border-top: none; padding-top: 4px; }
.rd-pos { font-weight: 800; color: var(--indigo); }
.rd-pos small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12px; }
.rd-row { display: grid; grid-template-columns: 76px 1fr; gap: 12px; margin-top: 6px; }
.rd-row img { width: 76px; border-radius: 6px; display: block; box-shadow: 0 1px 3px rgba(30, 20, 60, .3); }
.rd-row img.rev { transform: rotate(180deg); }
.rd-name { font-size: 17px; font-weight: 800; margin: 0; }
.rd-name .ori { font-size: 13px; margin-left: 4px; padding: 1px 8px; border-radius: 99px; background: #ece8f6; color: var(--indigo); vertical-align: 2px; }
.rd-name .ori.r { background: #fbeee0; color: #9a5a12; }
.rd-sub { font-size: 12px; color: var(--ink-2); margin: 0; }
.rd-text { font-size: 15px; margin: 4px 0 0; }

.summary-card { border: 2px solid #eadfc4; }
#r-summary p { font-size: 15px; }

#image-box img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; margin-top: 8px; }

dialog { border: none; border-radius: 18px; padding: 20px; max-width: 520px; width: calc(100% - 32px); max-height: calc(100% - 32px); }
dialog::backdrop { background: rgba(20, 16, 40, .55); }
.cd-img { display: block; width: 60%; max-width: 240px; margin: 0 auto 10px; border-radius: 10px; box-shadow: 0 2px 8px rgba(30, 20, 60, .3); }
.cd-img.rev { transform: rotate(180deg); }
#cd-body h2 { text-align: center; }
#cd-body .rd-sub { text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(30, 24, 60, .92); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 10;
}

/* 混ぜているときの動き */
.shuffling .slot .inner { animation: shake .5s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  30% { transform: translate(-6px, -4px) rotate(-6deg); }
  60% { transform: translate(6px, 3px) rotate(5deg); }
}
.slot.open .inner { animation: flip .35s ease-out; }
@keyframes flip {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .shuffling .slot .inner, .slot.open .inner { animation: none; }
}
