:root {
  color-scheme: light;
  --ink: #17342f;
  --ink-soft: #536761;
  --deep: #1f3b35;
  --gold: #d7a93e;
  --gold-pale: #f6e9bd;
  --paper: #fffdf8;
  --mist: #edf4f0;
  --line: #d9e3de;
  --white: #ffffff;
  --shadow: 0 18px 55px rgba(31, 59, 53, .12);
}

* { box-sizing: border-box; }

html { background: #e8efeb; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -15%, rgba(246, 233, 189, .95), transparent 40%),
    linear-gradient(180deg, #f6f7f1 0%, #e8efeb 100%);
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  position: relative;
  width: min(100%, 540px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: rgba(255, 253, 248, .88);
  box-shadow: 0 0 80px rgba(31, 59, 53, .07);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: var(--deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: .98rem;
  letter-spacing: .09em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 31px;
  height: 31px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.screen { display: none; }
.screen.is-active { display: flex; animation: appear .38s ease both; }

.intro-screen {
  min-height: calc(100svh - 88px);
  padding: 28px 0 10px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.intro-art {
  display: grid;
  width: 168px;
  height: 168px;
  margin: 8px 0 22px;
  place-items: center;
}

.intro-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 8px;
  color: #86681f;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
}

h1 {
  margin: 0;
  color: var(--deep);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.75rem, 7.2vw, 2.35rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: .04em;
}

h1 span { color: #9c7222; }

.lead {
  max-width: 430px;
  margin: 22px auto 12px;
  color: var(--ink-soft);
  font-size: .98rem;
  text-align: left;
}

.answer-guide {
  margin: 0 0 18px;
  padding: 10px 13px;
  border-radius: 12px;
  color: #5d6f69;
  background: rgba(237, 244, 240, .82);
  font-size: .78rem;
  line-height: 1.6;
  text-align: left;
}

.intro-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 24px;
}

.intro-meta span {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .72);
  font-size: .75rem;
}

.primary-button, .line-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  color: var(--white);
  background: var(--deep);
  box-shadow: 0 12px 26px rgba(31, 59, 53, .19);
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
}

.primary-button:active, .line-button:active { transform: translateY(1px); }

.disclaimer {
  margin: 18px 2px 0;
  color: #70817b;
  font-size: .75rem;
  line-height: 1.65;
  text-align: left;
}

.email-preview-note {
  width: 100%;
  margin: 18px 0 14px;
  padding: 13px 15px;
  border: 1px solid rgba(215, 169, 62, .4);
  border-radius: 14px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .65);
  font-size: .8rem;
  line-height: 1.65;
}

.quiz-screen {
  min-height: calc(100svh - 68px);
  padding: 20px 0 0;
  flex-direction: column;
}

.tie-screen,
.email-screen {
  min-height: calc(100svh - 88px);
  padding: 28px 0 10px;
  flex-direction: column;
  justify-content: center;
}

.tie-screen .progress-block {
  margin-bottom: 26px;
}

.tie-options {
  display: grid;
  gap: 13px;
  margin-top: 25px;
}

.tie-option {
  width: 100%;
  min-height: 74px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, .95);
  font-weight: 700;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(31, 59, 53, .05);
}

.tie-option:active {
  border-color: var(--gold);
  background: #fff9e9;
  transform: scale(.99);
}

.tie-option span {
  display: block;
  margin-bottom: 5px;
  color: #9c7222;
  font-size: .72rem;
}

.tie-option strong {
  display: block;
  color: var(--deep);
  font-size: .96rem;
}

.email-card {
  width: 100%;
  padding: 30px 22px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow);
  text-align: center;
}

.email-complete-mark {
  display: grid;
  width: 50px;
  height: 50px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--deep);
  font-size: 1.25rem;
  font-weight: 800;
}

.email-loader {
  width: 54px;
  height: 54px;
  margin: 2px auto 20px;
  border: 5px solid #e8e1d4;
  border-top-color: #a67521;
  border-radius: 50%;
  animation: email-spin 0.9s linear infinite;
}

@keyframes email-spin {
  to { transform: rotate(360deg); }
}

.email-card h2 {
  margin: 7px 0 10px;
  color: var(--deep);
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(1.55rem, 7vw, 2rem);
  line-height: 1.45;
}

.email-card > p:not(.eyebrow):not(.email-usage) {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: .92rem;
}

#email-form {
  display: grid;
  gap: 9px;
  text-align: left;
}

#email-form label {
  color: var(--deep);
  font-size: .84rem;
  font-weight: 800;
}

#email-address {
  width: 100%;
  height: 56px;
  padding: 0 15px;
  border: 1px solid #bdcbc5;
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  font-size: 1rem;
}

#email-address:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(215, 169, 62, .17);
}

.email-honeypot {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.form-error {
  min-height: 1.4em;
  margin: 0;
  color: #a54839;
  font-size: .78rem;
}

#email-submit {
  width: 100%;
  margin-top: 2px;
}

#email-submit:disabled {
  cursor: wait;
  opacity: .68;
}

.email-usage {
  margin: 18px 0 0;
  color: #6a7b75;
  font-size: .72rem;
  line-height: 1.7;
  text-align: left;
}

.mail-status {
  display: none;
  width: 100%;
  margin: 5px 0 18px;
  padding: 10px 13px;
  border-radius: 12px;
  color: #526b62;
  background: #edf6f1;
  font-size: .78rem;
}

.mail-status.is-visible { display: block; }
.mail-status.is-warning { color: #88562a; background: #fff5df; }

.progress-block { margin-bottom: 18px; }

.progress-copy {
  display: flex;
  margin-bottom: 8px;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 700;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e3;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #edcd75);
  transition: width .35s ease;
}

.question-card {
  display: flex;
  min-height: min(640px, calc(100svh - 165px));
  padding: 28px 20px 22px;
  flex-direction: column;
  border: 1px solid rgba(217, 227, 222, .9);
  border-radius: 26px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.question-number {
  margin: 0 0 10px;
  color: #9c7222;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
}

.question-card h2 {
  min-height: 112px;
  margin: 0 0 22px;
  color: var(--deep);
  font-size: clamp(1.18rem, 5vw, 1.5rem);
  line-height: 1.65;
  letter-spacing: .02em;
}

.answers {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.answer-button {
  position: relative;
  width: 100%;
  min-height: 54px;
  padding: 13px 44px 13px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  font-size: .94rem;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.answer-button::after {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 15px;
  height: 15px;
  border: 1.5px solid #9caca5;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
}

.answer-button:hover, .answer-button:focus-visible {
  border-color: var(--gold);
  background: #fffaf0;
  outline: none;
}

.answer-button.is-selected {
  border-color: var(--gold);
  background: var(--gold-pale);
  transform: scale(.99);
}

.answer-button.is-selected::after {
  border: 4px solid var(--deep);
  background: var(--gold-pale);
}

.back-button {
  align-self: center;
  margin: 17px 0 0;
  padding: 8px 14px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: .84rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.back-button:disabled { visibility: hidden; }

.result-screen {
  padding: 30px 0 18px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.result-characters {
  display: flex;
  min-height: 222px;
  margin: 4px 0 18px;
  align-items: center;
  justify-content: center;
}

.legacy-emblem { display: none; }

.result-character {
  position: relative;
  z-index: 1;
  width: 214px;
  height: 200px;
  filter: drop-shadow(0 16px 22px rgba(31, 59, 53, .15));
}

.result-character::before {
  position: absolute;
  inset: -7px -10px -4px -8px;
  z-index: -1;
  border-radius: 63% 37% 54% 46% / 42% 58% 43% 57%;
  background: rgba(215, 169, 62, .16);
  content: "";
  transform: rotate(-5deg);
}

.result-character-clip {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 58% 42% 61% 39% / 44% 62% 38% 56%;
}

.result-character img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-characters.is-dual {
  min-height: 184px;
}

.result-characters.is-dual .result-character {
  width: 168px;
  height: 158px;
  margin: 0 -9px;
}

.result-characters.is-dual .result-character:first-child {
  z-index: 2;
  transform: rotate(-3deg);
}

.result-characters.is-dual .result-character:last-child {
  transform: translateY(8px) rotate(4deg);
}

.result-characters.is-dual .result-character:last-child .result-character-clip {
  border-radius: 41% 59% 38% 62% / 60% 43% 57% 40%;
}

.result-characters.is-dual .result-character:last-child::before {
  background: rgba(126, 171, 158, .17);
  transform: rotate(7deg);
}

.result-prefix {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: .86rem;
}

.result-screen h2 {
  margin: 0;
  color: var(--deep);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.8rem, 8vw, 2.45rem);
  font-weight: 600;
  line-height: 1.35;
}

.result-catch {
  margin: 10px 0 24px;
  color: #9c7222;
  font-weight: 700;
}

.result-details {
  display: grid;
  width: 100%;
  gap: 12px;
}

.result-copy-card,
.result-type-details {
  width: 100%;
  padding: 24px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  text-align: left;
}

.result-copy-card h3,
.result-type-body h3 {
  margin: 0 0 6px;
  color: var(--deep);
  font-size: .98rem;
}

.result-copy-card h3:not(:first-child),
.result-type-body h3:not(:first-child) { margin-top: 24px; }

.result-copy-card p,
.result-type-body p {
  margin: 0;
  color: var(--ink-soft);
}

.result-copy-card p + p,
.result-type-body p + p { margin-top: 12px; }

.result-copy-card ul,
.result-type-body ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.25em;
  color: var(--ink-soft);
}

.result-copy-card li::marker,
.result-type-body li::marker { color: var(--gold); }

.result-type-details {
  padding: 0;
  overflow: hidden;
}

.result-type-details summary {
  display: grid;
  position: relative;
  gap: 2px;
  padding: 18px 46px 18px 18px;
  color: var(--deep);
  cursor: pointer;
  list-style: none;
}

.result-type-details summary::-webkit-details-marker { display: none; }

.result-type-details summary::after {
  position: absolute;
  top: 50%;
  right: 19px;
  content: "＋";
  color: #9c7222;
  font-size: 1.25rem;
  transform: translateY(-50%);
}

.result-type-details[open] summary::after { content: "−"; }

.result-type-details summary span {
  color: var(--ink-soft);
  font-size: .78rem;
}

.result-type-details[open] summary { border-bottom: 1px solid var(--line); }

.result-type-body { padding: 22px 20px 24px; }

.result-note {
  margin: 20px 3px;
  color: #667872;
  font-size: .8rem;
  text-align: left;
}

.line-prompt {
  width: 100%;
  margin: 0 0 14px;
  padding: 18px 16px;
  border: 1px solid #b7daca;
  border-radius: 18px;
  background: #edf8f2;
  text-align: center;
}

.line-prompt span {
  display: block;
  color: #168349;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.line-prompt .line-guide {
  display: block;
  margin: 5px 0 0;
  color: var(--deep);
  font-size: 1.08rem;
  line-height: 1.55;
}

.line-prompt p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: .84rem;
}

.result-actions { display: grid; width: 100%; gap: 10px; }

.line-button { background: #168349; }

.secondary-button {
  min-height: 52px;
  border: 1px solid var(--deep);
  border-radius: 15px;
  color: var(--deep);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.restart-button {
  margin-top: 23px;
  padding: 8px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: .82rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 10;
  padding: 11px 18px;
  border-radius: 999px;
  color: var(--white);
  background: rgba(23, 52, 47, .94);
  font-size: .82rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  transition: .25s ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

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

@media (min-width: 541px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border-radius: 30px; }
}

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