:root {
  --ink: #f8f2e5;
  --muted: #cabfae;
  --paper: rgba(8, 31, 35, 0.78);
  --paper-strong: rgba(9, 41, 44, 0.9);
  --line: rgba(236, 204, 128, 0.32);
  --gold: #e4bd67;
  --teal: #1bb7a8;
  --magenta: #bd5f86;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #031216;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(3, 18, 22, 0.94) 0%, rgba(3, 18, 22, 0.86) 38%, rgba(3, 18, 22, 0.5) 70%, rgba(3, 18, 22, 0.34) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0.48)),
    url("./assets/mystic-table.png") center right / cover no-repeat fixed;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(360px, 1fr);
  align-items: center;
  gap: 34px;
  padding: 44px 0 24px;
}

.intro {
  display: grid;
  gap: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  max-width: 8em;
  margin-bottom: 0;
  font-size: 3.25rem;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.28;
  letter-spacing: 0;
}

.lead {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 1.08rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.form-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.person-block {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(248, 242, 229, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.22);
  outline: none;
}

.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(228, 189, 103, 0.18);
}

.mood-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.mood-field legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  border: 1px solid rgba(248, 242, 229, 0.16);
  border-radius: 8px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.segmented-three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented label {
  min-width: 0;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.segmented input:checked + span {
  color: #07181a;
  background: linear-gradient(135deg, var(--gold), #f6e0a4);
}

.segmented input:focus-visible + span {
  outline: 3px solid rgba(27, 183, 168, 0.48);
  outline-offset: 2px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0;
}

.primary,
.reroll {
  color: #061b1d;
  background: linear-gradient(135deg, var(--gold), #f7df9f);
}

.ghost {
  min-width: 72px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible {
  outline: 3px solid rgba(27, 183, 168, 0.52);
  outline-offset: 3px;
}

.reading-panel {
  display: grid;
  gap: 22px;
  padding: 28px;
  background: var(--paper-strong);
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.score-ring {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background:
    radial-gradient(circle at center, rgba(6, 27, 29, 0.94) 58%, transparent 60%),
    conic-gradient(var(--gold) var(--score-angle), rgba(255, 255, 255, 0.14) 0);
  border: 1px solid rgba(228, 189, 103, 0.34);
}

.score-ring span {
  font-size: 1.88rem;
  font-weight: 950;
  line-height: 1;
}

.score-ring small {
  margin-top: -22px;
  color: var(--muted);
  font-size: 0.72rem;
}

.oracle-card {
  min-height: 178px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(228, 189, 103, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(228, 189, 103, 0.2), rgba(27, 183, 168, 0.12)),
    rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
}

.oracle-card::before,
.oracle-card::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(248, 242, 229, 0.24);
  border-radius: 6px;
  pointer-events: none;
}

.oracle-card::after {
  inset: 28px;
  border-color: rgba(228, 189, 103, 0.22);
}

.card-symbol {
  z-index: 1;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #07181a;
  background: var(--gold);
  font-size: 1.38rem;
  font-weight: 950;
}

.oracle-card p {
  z-index: 1;
  margin: -16px 0 0;
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 900;
}

.message {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.82;
}

.compatibility-card {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(27, 183, 168, 0.24);
  border-radius: 8px;
  padding: 16px;
  background: rgba(27, 183, 168, 0.08);
}

.compatibility-card div {
  display: grid;
  place-items: center;
  min-height: 78px;
  border-radius: 8px;
  color: #061b1d;
  background: linear-gradient(135deg, var(--teal), #c8f1dd);
}

.compatibility-card span {
  font-size: 0.78rem;
  font-weight: 900;
}

.compatibility-card strong {
  font-size: 1.1rem;
  line-height: 1;
}

.compatibility-card p {
  margin: 0;
  color: var(--ink);
  line-height: 1.72;
}

.fortune-lines {
  display: grid;
  gap: 12px;
}

.fortune-line {
  display: grid;
  grid-template-columns: 82px 1fr 42px;
  align-items: center;
  gap: 12px;
}

.fortune-line span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
}

.bar i {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--magenta));
}

.fortune-line strong {
  text-align: right;
  font-size: 0.94rem;
}

.reading-story {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(248, 242, 229, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.reading-story p {
  margin: 0;
  color: var(--ink);
  line-height: 1.85;
}

.lucky-area {
  display: grid;
  border-top: 1px solid rgba(248, 242, 229, 0.14);
  border-bottom: 1px solid rgba(248, 242, 229, 0.14);
}

.lucky-row {
  display: grid;
  grid-template-columns: 128px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border-top: 1px solid rgba(248, 242, 229, 0.12);
}

.lucky-row:first-child {
  border-top: 0;
}

.lucky-row span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.lucky-row strong {
  overflow-wrap: anywhere;
}

.color-chip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.58);
  background: var(--chip, #e4bd67);
}

.reroll {
  width: 100%;
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: -16px auto 20px;
  color: rgba(248, 242, 229, 0.7);
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  body {
    background:
      linear-gradient(180deg, rgba(3, 18, 22, 0.92), rgba(3, 18, 22, 0.78)),
      url("./assets/mystic-table.png") center top / cover no-repeat fixed;
  }

  .app-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 28px;
  }

  h1 {
    max-width: none;
    font-size: 2.35rem;
  }

  .reading-panel {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  .app-shell,
  footer {
    width: min(calc(100% - 24px), 1180px);
  }

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

  .form-panel,
  .reading-panel {
    padding: 18px;
  }

  .segmented {
    grid-template-columns: repeat(2, 1fr);
  }

  .segmented-three {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .ghost {
    width: 100%;
  }

  .result-head {
    align-items: flex-start;
    gap: 12px;
  }

  .result-head h2 {
    font-size: 1.16rem;
  }

  .score-ring {
    width: 76px;
    height: 76px;
  }

  .score-ring span {
    font-size: 1.48rem;
  }

  .oracle-card {
    min-height: 156px;
  }

  .compatibility-card {
    grid-template-columns: 1fr;
  }

  .compatibility-card div {
    min-height: 64px;
  }

  .fortune-line {
    grid-template-columns: 72px 1fr 38px;
    gap: 8px;
  }

  .lucky-row {
    grid-template-columns: 1fr auto;
    padding: 10px 0;
  }

  .lucky-row span {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  button:hover {
    transform: none;
  }
}
