:root {
  color-scheme: dark;
  --black: #100d0e;
  --ink: #f8f1ed;
  --muted: #b0a1a3;
  --line: #3c2c30;
  --red: #ed293e;
  --bright: #ff6977;
  --ui: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Heiti SC", sans-serif;
  --display: "Arial Black", var(--ui);
  --numbers: "Bahnschrift", "Roboto", "Arial", sans-serif;
  background: #120a0c;
  color: var(--ink);
  font-family: var(--ui);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: repeating-linear-gradient(143deg, #fe354605 0 1px, transparent 1px 68px), radial-gradient(ellipse at 52% 22%, #340e16, #120a0c 65%);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled, button[aria-disabled="true"] { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1:focus { outline: none; }

.app {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  max-width: 500px;
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  overflow: hidden;
  background: var(--black);
  box-shadow: 0 0 100px #080406bf;
}

.masthead {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: calc(59px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 23px 0;
  background: var(--black);
  border-bottom: 1px solid #ffffff10;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 900; letter-spacing: .05em; }
.brand small { padding-left: 9px; margin-left: 8px; border-left: 1px solid #6c5659; color: var(--muted); font-size: 10px; font-weight: 600; }
.brand-mark { height: 22px; width: 24px; background: var(--red); clip-path: polygon(45% 0, 100% 0, 67% 36%, 93% 36%, 19% 100%, 40% 57%, 0 57%); }
.brand-en { color: var(--muted); font: 700 10px/1.2 var(--numbers); letter-spacing: .14em; text-align: right; }

.hero {
  position: relative;
  isolation: isolate;
  min-height: clamp(284px, 49svh, 480px);
  overflow: hidden;
  background: #2f0d14;
  clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%);
}
.hero-art {
  position: absolute;
  z-index: -2;
  inset: 0;
  background: url("./assets/hero.webp") 65% 41% / cover no-repeat;
  animation: hero-appear .65s cubic-bezier(.16,.9,.33,1) both;
}
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #090607b5, #09060716 59%, transparent), linear-gradient(0deg, #110709 0%, #10070b99 18%, transparent 68%);
}
.hero-copy { position: absolute; inset: auto 16px 13% 23px; }
.hero h1 {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  font-family: var(--display);
  font-weight: 950;
  line-height: 1.02;
  transform: skew(-6deg) rotate(-4deg);
  animation: title-appear .55s .075s cubic-bezier(.16,.9,.33,1) both;
}
.hero-prefix {
  position: relative;
  display: inline-block;
  margin: 0 0 8px 5px;
  padding: 4px 12px 6px;
  background: var(--red);
  color: #fff;
  font-size: clamp(17px, 4.4vw, 23px);
  letter-spacing: .06em;
  clip-path: polygon(5% 0, 100% 0, 94% 100%, 0% 100%);
}
.hero-name { font-size: clamp(50px, 13.9vw, 74px); letter-spacing: -.045em; white-space: nowrap; text-shadow: 4px 5px 0 #a71527, 0 1px 28px #050305; }
.hero-question { padding: 8px 0 0 4px; font-size: clamp(24px, 6.3vw, 34px); letter-spacing: .07em; text-shadow: 2px 3px 0 #090509; }
.hero-question span { color: #ff5969; }
.hero-slash { position: absolute; z-index: 2; inset: auto 0 0; height: 8%; background: #ee2940; clip-path: polygon(0 95%, 100% 0, 100% 20%, 0 100%); }
.hero-credit { position: absolute; right: 11px; bottom: 12%; color: #ffe9e6; font: 800 9px/1 var(--numbers); letter-spacing: .20em; writing-mode: vertical-rl; transform: rotate(180deg); opacity: .8; }

.mode-select { display: grid; gap: 10px; padding: clamp(13px, 3svh, 27px) 23px 0; }
.section-head { display: flex; align-items: center; gap: 12px; }
.section-head h2 { font-size: 15px; letter-spacing: .09em; font-weight: 850; white-space: nowrap; }
.section-head h2::before { display: inline-block; vertical-align: -1px; width: 5px; height: 13px; margin-right: 8px; background: var(--red); transform: skew(-12deg); content: ""; }
.section-head > span { height: 1px; flex: 1; background: var(--line); }
.mode {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  gap: 13px;
  min-height: clamp(64px, 9.4svh, 83px);
  padding: 8px 14px;
  text-align: left;
  border: 1px solid transparent;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: filter .16s, transform .16s;
}
.mode-quick { background: linear-gradient(117deg, #d51a32, #b70f28); }
.mode-full { background: linear-gradient(117deg, #2d1a20, #21151a); border-color: #65323a; }
.mode:hover { filter: brightness(1.16); }
.mode:active { transform: scale(.98); }
.mode:focus-visible { outline-offset: -5px; }
.mode-icon { flex: 0 0 40px; height: 40px; display: grid; place-items: center; background: #16060b54; color: #fff8f6; transform: skewX(-8deg); }
.mode-icon svg { width: 22px; transform: skewX(8deg); }
.mode-full .mode-icon { color: var(--bright); background: #ed293e18; }
.mode-copy { display: grid; gap: 4px; margin-right: auto; }
.mode-copy strong { font-size: clamp(18px, 5.2vw, 24px); line-height: 1.05; letter-spacing: .04em; font-weight: 900; white-space: nowrap; }
.mode-copy small { font-size: 11px; color: #ffe0e1; white-space: nowrap; }
.mode-full .mode-copy small { color: var(--muted); }
.mode-lock { display: inline-flex; align-items: center; gap: 4px; color: #ff9aa3; font-size: 10px; white-space: nowrap; }
.mode-lock svg { width: 13px; height: 13px; }
.mode-arrow { display: flex; width: 24px; flex-shrink: 0; }
.mode-arrow svg { width: 21px; }
.home-footer { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding: clamp(15px, 3.6svh, 31px) 24px max(15px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 10px; letter-spacing: .025em; }

.app[data-page="quiz"] { background: radial-gradient(ellipse at 100% 5%, #2c1119, transparent 50%), var(--black); }
.text-button { padding: 7px 0 7px 8px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; background: transparent; border: 0; }
.text-button svg { width: 15px; height: 15px; }
.quiz-inner { flex: 1; display: flex; flex-direction: column; padding: clamp(15px, 4svh, 36px) 23px max(19px, env(safe-area-inset-bottom)); }
.progress-meta { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 12px; letter-spacing: .08em; color: #d5c3c6; }
.progress-meta > span:last-child { font-family: var(--numbers); font-size: 13px; }
.progress-meta b { color: var(--bright); font-size: 23px; margin-right: 1px; }
.progress { height: 4px; margin-top: 7px; border-radius: 4px; overflow: hidden; background: #3a272d; }
.progress i { display: block; height: 100%; width: var(--progress); background: var(--red); border-radius: inherit; }
.question-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 0 auto;
  min-height: clamp(127px, 24svh, 250px);
  max-height: 350px;
  margin: clamp(12px, 2.5svh, 24px) 0;
  padding: clamp(16px, 4svh, 31px) 20px;
  border-left: 3px solid var(--red);
  background: linear-gradient(140deg, #291820, #211319 85%);
  clip-path: polygon(0 0, calc(100% - 21px) 0, 100% 21px, 100% 100%, 0 100%);
  animation: question-appear .22s ease-out both;
}
.question-card::after { content: ""; position: absolute; inset: 0; z-index: -1; background: repeating-linear-gradient(133deg, #ff28460b 0 1px, transparent 1px 14px); mask-image: linear-gradient(90deg, transparent, black); }
.question-meta { color: var(--bright); font-size: 11px; font-weight: 800; letter-spacing: .13em; margin-bottom: 7px; }
.question-card h1 { font-size: clamp(19px, 5.3vw, 27px); font-weight: 800; line-height: 1.47; overflow-wrap: anywhere; }
.answer-list { display: grid; gap: clamp(7px, 1.35svh, 12px); min-width: 0; margin: 0; padding: 0; border: 0; }
.answer { display: grid; grid-template-columns: 30px 1fr 17px; gap: 11px; align-items: center; min-height: clamp(42px, 7.1svh, 62px); padding: 5px 13px; border: 1px solid var(--line); background: #1d1519; font-size: 14px; font-weight: 700; text-align: left; touch-action: manipulation; transition: background .16s, border-color .16s; }
.answer:hover { border-color: #a04c58; }
.letter { display: grid; place-items: center; width: 26px; height: 26px; background: #39232b; color: #ffc2c8; font: 800 12px/1 var(--numbers); transform: skew(-7deg); }
.radio-ring { width: 15px; height: 15px; border: 1px solid #80656a; border-radius: 50%; }
.answer[aria-pressed="true"] { border-color: var(--bright); background: #461923; }
.answer[aria-pressed="true"] .letter { background: #e3213a; color: #fff; }
.answer[aria-pressed="true"] .radio-ring { border-color: var(--bright); box-shadow: inset 0 0 0 3px #461923; background: var(--bright); }
.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: clamp(13px, 3svh, 27px); }
.quiz-nav .button { min-width: 105px; }
.quiz-nav > span { color: var(--muted); font-size: 12px; text-align: right; }
.button { position: relative; min-height: 47px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-align: center; text-decoration: none; border: 1px solid transparent; font-size: 14px; font-weight: 800; color: var(--ink); transition: filter .16s, background .16s; }
.button svg { width: 18px; height: 18px; flex: 0 0 auto; }
.button:hover:not(:disabled) { filter: brightness(1.17); }
.button:active:not(:disabled) { filter: brightness(.88); }
.button:disabled, .button[aria-busy="true"], .mode[aria-busy="true"] { opacity: .55; }
.primary { background: #ce1931; color: white; }
.outlined { background: #311821; border-color: #69313b; }
.ghost { background: #171015; border-color: var(--line); color: #e8dadd; }

.result-hero { position: relative; isolation: isolate; height: clamp(340px, 58svh, 500px); overflow: hidden; border-bottom: 3px solid var(--red); background: #2f1219; }
.result-hero img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; object-position: center 27%; animation: hero-appear .6s ease-out both; }
.result-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, #100d0e 0, #100d0ea0 32%, #100d0e00 73%), linear-gradient(90deg, #100d0e60, transparent 70%); }
.result-hero-copy { position: absolute; inset: auto 24px 22px; display: flex; flex-direction: column; align-items: flex-start; }
.result-kicker { display: inline-block; padding: 4px 10px; margin-bottom: 8px; background: #d21a31; font-size: 12px; font-weight: 800; letter-spacing: .12em; transform: skew(-5deg); }
.result-hero h1 { color: #fff6ef; font-family: var(--display); font-size: clamp(41px, 11.4vw, 64px); font-weight: 950; line-height: 1.1; letter-spacing: -.03em; text-shadow: 3px 3px #a9132a; }
.result-en { font: 800 12px/1.2 var(--numbers); margin: 7px 0 10px; letter-spacing: .14em; }
.result-label { color: #ff8691; font-size: 13px; font-weight: 750; letter-spacing: .11em; }
.result-body { display: grid; gap: 22px; padding: 25px 23px max(23px, env(safe-area-inset-bottom)); }
.result-text { display: grid; gap: 15px; }
.result-text h3 { color: #ff98a2; font-size: 12px; letter-spacing: .08em; }
.result-text p { color: #e6d7d9; line-height: 1.82; font-size: 14px; margin-top: 5px; }
.result-stats { padding: 14px; background: #1b1217; border: 1px solid var(--line); }
#radar { display: block; margin: 5px auto 1px; width: min(100%, 290px); height: auto; }
.scores { display: grid; gap: 12px; margin: 0; padding: 0 2px 4px; list-style: none; }
.scores li { display: grid; grid-template-columns: 49px 1fr 59px; align-items: center; gap: 9px; font-size: 12px; }
.scores b { font: 800 16px/1 var(--numbers); text-align: right; color: var(--bright); }
.scores small { color: var(--muted); font-size: 10px; }
.score-track { height: 4px; background: #402c32; }
.score-track i { display: block; width: var(--score); height: 100%; background: var(--red); transform-origin: left; animation: fill .55s ease-out both; }
.result-actions { display: grid; gap: 9px; }
.button-lock { display: flex; color: #ffbbc0; position: absolute; right: 11px; }
.button-lock svg { width: 15px; }
.result-footer { color: var(--muted); font-size: 10px; text-align: center; }

dialog {
  width: calc(100% - 46px);
  max-width: 353px;
  max-height: calc(100% - 26px);
  color: var(--ink);
  background: #25171d;
  border: 1px solid #73404a;
  border-top: 4px solid var(--red);
  padding: 19px;
  box-shadow: 0 20px 70px #000c;
}
dialog::backdrop { background: #0d080be0; }
.dialog-icon { display: grid; place-items: center; margin-bottom: 10px; width: 38px; height: 38px; background: #551e2b; color: #ff929d; }
dialog h2 { font-size: 21px; }
dialog p { margin: 9px 0 15px; color: #e3d1d5; font-size: 14px; line-height: 1.65; }
dialog .button { width: 100%; display: flex; margin-top: 8px; }
.toast { position: fixed; z-index: 3; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 10px); width: max-content; max-width: 90vw; padding: 9px 14px; color: #fff; background: #2c1b21; border: 1px solid #81414d; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes hero-appear { from { transform: scale(1.07); opacity: .72; } to { transform: scale(1); opacity: 1; } }
@keyframes title-appear { from { transform: translateX(-17px) skew(-6deg) rotate(-4deg); opacity: 0; } }
@keyframes question-appear { from { transform: translateX(7px); opacity: .55; } }
@keyframes fill { from { transform: scaleX(0); } }

@media (max-width: 355px) {
  .masthead, .mode-select, .quiz-inner, .result-body { padding-inline: 16px; }
  .home-footer { padding-inline: 16px; }
  .hero-copy { left: 18px; }
  .mode { gap: 9px; padding-inline: 9px; }
  .mode-icon { flex-basis: 34px; height: 34px; }
  .mode-arrow { width: 17px; }
  .mode-arrow svg { width: 17px; }
}

@media (max-height: 680px) {
  .masthead { min-height: calc(47px + env(safe-area-inset-top)); }
  .hero { min-height: clamp(230px, 46svh, 308px); }
  .home-footer { padding-block: 12px max(12px, env(safe-area-inset-bottom)); }
  .quiz-inner { padding-top: 12px; }
  .question-card { min-height: 120px; margin-block: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
