:root {
  --ink: #2a2438;
  --ink-soft: #6a5f72;
  --navy: #2f4570;
  --navy-deep: #24365a;
  --blush: #d4a0a8;
  --blush-soft: #f0d5d9;
  --gold: #c4a574;
  --gold-soft: #e8d7b8;
  --ivory: #faf6f1;
  --ivory-deep: #f1e8df;
  --line: rgba(47, 69, 112, 0.14);
  --gold-line: rgba(196, 165, 116, 0.55);
  --shadow: 0 14px 36px rgba(42, 36, 56, 0.08);
  --radius: 6px;
  --font-display: 'Shippori Mincho', 'Hiragino Mincho ProN', serif;
  --font-body: 'Zen Kaku Gothic New', 'Hiragino Sans', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.75;
  background:
    radial-gradient(ellipse 85% 55% at 12% 0%, rgba(232, 215, 184, 0.55), transparent 52%),
    radial-gradient(ellipse 70% 50% at 95% 8%, rgba(240, 213, 217, 0.5), transparent 48%),
    radial-gradient(ellipse 60% 45% at 50% 100%, rgba(47, 69, 112, 0.06), transparent 50%),
    linear-gradient(180deg, #fbf7f2 0%, #f4ebe4 55%, #eef2f6 100%);
  background-attachment: fixed;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--navy-deep);
  transition: color 0.3s ease;
}

.brand-mark:hover {
  color: var(--navy);
}

.brand-mark span {
  color: var(--gold);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.main-home {
  max-width: none;
  padding: 0 0 2rem;
}

.site-footer {
  padding: 2rem 1.25rem 2.25rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(232, 215, 184, 0.22));
}

.operator {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: min(100%, 36rem);
  margin: 0 auto;
}

.operator-mascot {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: contain;
}

.operator-copy {
  text-align: left;
}

.operator-label {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.operator-name {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: var(--navy-deep);
}

.operator-text {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.75;
}

@media (max-width: 560px) {
  .operator {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .operator-copy {
    text-align: center;
  }
}

/* Buttons — invitation / letter style */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #f8f4ee;
  border: 1px solid var(--gold-line);
  box-shadow:
    inset 0 0 0 1px rgba(232, 215, 184, 0.18),
    0 10px 26px rgba(36, 54, 90, 0.24);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(232, 215, 184, 0.28),
    0 14px 32px rgba(36, 54, 90, 0.3);
}

.btn-ghost {
  border: 1px solid var(--gold-line);
  background: rgba(250, 246, 241, 0.78);
  color: var(--navy-deep);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: #fff;
  border-color: var(--gold);
  color: var(--navy);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Motion */
.fade-in {
  animation: fadeUp 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.fade-in-delay {
  animation: fadeUp 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.14s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroReveal {
  from {
    opacity: 0;
    transform: scale(1.04);
    filter: saturate(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: saturate(1);
  }
}

@keyframes goldSettle {
  from {
    opacity: 0;
    letter-spacing: 0.28em;
    text-shadow: 0 0 0 transparent;
  }
  to {
    opacity: 1;
    letter-spacing: 0.16em;
    text-shadow: 0 0 24px rgba(196, 165, 116, 0.35);
  }
}

@keyframes softLift {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Home */
.hero {
  display: grid;
  gap: 1.5rem;
  padding-bottom: 0.5rem;
}

.hero-bleed {
  width: 100%;
  overflow: hidden;
  background: #1c2438;
  box-shadow: 0 18px 40px rgba(36, 54, 90, 0.18);
}

.hero-image {
  width: 100%;
  height: min(52vh, 520px);
  object-fit: cover;
  object-position: center 20%;
  animation: heroReveal 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-copy {
  width: min(100% - 2.5rem, 720px);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 0;
  text-align: center;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  color: var(--gold);
  line-height: 1.6;
}

.hero-kicker::before,
.hero-kicker::after {
  content: '';
  width: 1.75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

.hero-brand {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.14em;
  color: var(--navy-deep);
}

.hero-brand em {
  font-style: normal;
  color: var(--gold);
}

.hero-brand::after {
  content: '';
  display: block;
  width: 3.5rem;
  height: 1px;
  margin: 0.9rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.hero-lead {
  margin: 1rem auto 1.6rem;
  max-width: 26rem;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 1.02rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* Levels */
.page-title {
  position: relative;
  margin: 0.5rem 0 0.85rem;
  padding-bottom: 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.25rem);
  letter-spacing: 0.14em;
  color: var(--navy-deep);
}

.page-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 4.25rem;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.page-lead {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

.level-list {
  display: grid;
  gap: 1rem;
}

.level-item {
  display: grid;
  gap: 0.75rem;
  padding: 1.35rem 1.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 246, 241, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(196, 165, 116, 0.12),
    var(--shadow);
  text-align: left;
  animation: softLift 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.35s ease,
    box-shadow 0.4s ease,
    background 0.35s ease;
}

.level-item:hover {
  transform: translateY(-3px);
  border-color: var(--gold-line);
  background: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(196, 165, 116, 0.28),
    0 18px 40px rgba(42, 36, 56, 0.1);
}

.level-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.level-name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  color: var(--navy-deep);
}

.level-meta {
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.level-desc {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.65rem;
  border-radius: 3px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
}

.badge-pass {
  background: rgba(196, 165, 116, 0.18);
  border-color: rgba(196, 165, 116, 0.35);
  color: #7a6238;
}

.badge-lock {
  background: rgba(47, 69, 112, 0.06);
  border-color: var(--line);
  color: var(--ink-soft);
}

/* Quiz */
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.quiz-level {
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  color: var(--navy-deep);
}

.quiz-count {
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.progress-track {
  position: relative;
  height: 4px;
  margin-bottom: 1.65rem;
  border-radius: 2px;
  background: rgba(47, 69, 112, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(42, 36, 56, 0.06);
}

.progress-track::before,
.progress-track::after {
  content: '';
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 6px;
  height: 6px;
  border: 1px solid var(--gold-line);
  background: var(--ivory);
  transform: translateY(-50%) rotate(45deg);
}

.progress-track::before {
  left: 0;
}

.progress-track::after {
  right: 0;
}

.progress-bar {
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-soft) 45%, var(--blush) 100%);
  box-shadow: 0 0 10px rgba(196, 165, 116, 0.35);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.question-panel {
  padding: 1.7rem 1.5rem 1.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 246, 241, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(196, 165, 116, 0.1),
    var(--shadow);
}

.question-theme {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.9rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.84rem;
  letter-spacing: 0.18em;
}

.question-theme::before,
.question-theme::after {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--gold);
  opacity: 0.65;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.question-text {
  margin: 0 0 1.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 4vw, 1.55rem);
  font-weight: 600;
  line-height: 1.75;
  letter-spacing: 0.045em;
  color: var(--navy-deep);
}

.choices {
  display: grid;
  gap: 0.8rem;
}

.choice {
  width: 100%;
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  font-family: var(--font-body);
  text-align: left;
  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.choice:hover {
  border-color: var(--gold-line);
  background: #fff;
  transform: translateX(3px);
}

.choice.is-selected {
  border-color: var(--gold);
  background: rgba(240, 213, 217, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(196, 165, 116, 0.45),
    0 6px 18px rgba(196, 165, 116, 0.12);
}

.choice-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-right: 0.75rem;
  border-radius: 3px;
  border: 1px solid rgba(196, 165, 116, 0.4);
  background: rgba(196, 165, 116, 0.16);
  color: #7a6238;
  font-family: var(--font-display);
  font-size: 0.78rem;
  vertical-align: middle;
}

.choice.is-selected .choice-label {
  background: rgba(196, 165, 116, 0.32);
  border-color: var(--gold);
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

/* Result */
.result-hero {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.result-status {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  letter-spacing: 0.16em;
}

.result-status.pass {
  color: var(--navy-deep);
  animation: goldSettle 1.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result-status.fail {
  color: var(--ink-soft);
  animation: fadeUp 0.8s ease both;
}

.result-status.pass::after {
  content: '';
  display: block;
  width: 5rem;
  height: 1px;
  margin: 0.85rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: fadeUp 1s ease 0.2s both;
}

.result-score {
  margin: 0 0 0.35rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.result-note {
  margin: 0 auto 1.5rem;
  max-width: 28rem;
  color: var(--ink-soft);
  font-family: var(--font-body);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.review-list {
  display: grid;
  gap: 1rem;
}

.review-item {
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 0 0 1px rgba(196, 165, 116, 0.08);
}

.review-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0 0 0.45rem;
}

.review-theme {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
}

.review-theme::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--gold);
  opacity: 0.7;
  transform: rotate(45deg);
}

.review-verdict {
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
}

.review-verdict.is-correct {
  color: var(--navy);
}

.review-verdict.is-wrong {
  color: #8a4a58;
}

.review-q {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--navy-deep);
}

.review-choices {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.review-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.65rem;
  align-items: start;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
}

.review-choice.is-answer {
  border-color: rgba(42, 67, 101, 0.28);
  background: rgba(42, 67, 101, 0.06);
}

.review-choice.is-selected:not(.is-answer) {
  border-color: rgba(138, 74, 88, 0.28);
  background: rgba(138, 74, 88, 0.06);
}

.review-choice-label {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--gold);
}

.review-choice-text {
  min-width: 0;
}

.review-choice-marks {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.review-choice-mark {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  font-family: var(--font-display);
}

.review-choice-mark.mark-correct {
  color: var(--navy);
}

.review-choice-mark.mark-selected {
  color: #8a4a58;
}

.review-choice.is-answer .review-choice-mark.mark-selected {
  color: var(--navy);
}

.review-explain {
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1rem;
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-size: 1.05rem;
  color: var(--navy-deep);
}

.section-label::before,
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .fade-in-delay,
  .hero-image,
  .level-item,
  .result-status.pass,
  .result-status.fail,
  .result-status.pass::after {
    animation: none !important;
  }

  .btn,
  .level-item,
  .choice,
  .progress-bar {
    transition: none !important;
  }
}
