:root {
  color-scheme: light;
  font-family: "Noto Sans JP", sans-serif;
  color: #50383E;
  background: #FFF9F7;
}

* { box-sizing: border-box; }

body, h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid #B85570; outline-offset: 3px; }
h1:focus { outline: none; }
h1 { font-weight: 700; overflow-wrap: anywhere; }
h2 { font-size: 16px; }
svg { display: block; }
.character { display: block; width: 100%; object-fit: contain; }

.shell {
  --inset: 28px;
  --brand: #B85570;
  --brand-size: 29px;
  --header-top: 52px;
  position: relative;
  max-width: 390px;
  min-height: 100vh;
  margin-inline: auto;
  padding: 0 var(--inset) 28px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--header-top);
  color: var(--brand);
}

.wordmark {
  border: 0;
  padding: 0;
  background: transparent;
  font: 700 var(--brand-size)/1.4 Nunito, sans-serif;
}

[data-page="home"] .site-header {
  display: grid;
  grid-template-columns: min(166px, 50%) max-content;
  justify-content: start;
  justify-items: start;
}

.home-badge { display: none; }
[data-page="home"] .home-badge {
  display: block;
  padding: 6px 12px;
  border-radius: 30px;
  color: #AD5B70;
  background: #F9E4E8;
  font-size: 11px;
  font-weight: 700;
}

.hero { padding-top: calc(108px - 52px - 29px * 1.4); }
.hero h1 { font-size: 25px; line-height: 1.4; }
.eyebrow { font-weight: 700; letter-spacing: 1.5px; }
.hero .eyebrow { margin-top: 15px; color: #C38695; font-size: 10px; line-height: 14px; }

.parade {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  height: 160px;
  margin-top: 10px;
  border: 1px solid #F0D8DF;
  border-radius: 20px;
  background: #FBEAED;
}

.hero .intro { min-height: 22px; color: #644A50; font-size: 11px; line-height: 22px; }
.discover h2, .saved h2 { line-height: 1.4; }
.discover ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: calc(432px - 399px - 16px * 1.4) 0 0;
  padding: 0;
  list-style: none;
}

.discover li {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 7px;
  height: 89px;
  border-radius: 16px;
  background: #FFFFFF;
  color: #644A50;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.discover svg { width: 19px; height: 19px; color: #D17C91; }
.saved { margin-top: 26px; }
.saved button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  margin-top: calc(578px - 547px - 16px * 1.4);
  padding: 12px 14px;
  border: 0;
  border-radius: 16px;
  background: #FFFFFF;
  text-align: left;
}

.saved-icon {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  border-radius: 14px;
  background: #FBE9ED;
  color: #C66D83;
}

.saved-icon svg { width: 20px; height: 20px; }
.saved-copy { display: grid; flex: 1; gap: 3px; font-size: 14px; }
.saved-copy small, .saved-copy strong span { color: #A88A91; font-size: 10px; font-weight: 700; }
.saved button > svg { width: 18px; height: 18px; color: #C69AA5; }

.primary, .secondary, .text-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  border: 0;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.primary { min-height: 52px; border-radius: 26px; background: #D77890; color: #FFFFFF; }
.secondary { background: #FFFFFF; }
.text-button { padding: 6px 10px; background: transparent; color: #B86C80; font-size: 12px; }
.hero .primary { margin-top: 32px; min-height: 58px; border-radius: 29px; font-size: 16px; }
.hero .caption { margin-top: 12px; color: #9D7C84; font-size: 12px; font-weight: 500; text-align: center; }

[data-page="quiz"] {
  --inset: 26px;
  --brand: #C6788E;
  --brand-size: 13px;
  --header-top: 75px;
  background: #FFFAF8;
}

[data-page="quiz"] .site-header { position: absolute; right: 26px; }
.quiz-header {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  padding-top: 72px;
  color: #57474C;
  font-size: 16px;
  text-align: center;
}

.quiz-header button { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; }
.quiz-progress { display: flex; justify-content: space-between; align-items: baseline; margin-top: 40px; line-height: 20px; }
.quiz-progress .eyebrow { color: #B88794; font-size: 10px; }
.question-count { color: #A66F7D; font-size: 13px; font-weight: 700; }
progress {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 10px;
  border: 0;
  border-radius: 3px;
  background: #F2E3E4;
  accent-color: #E8A5B4;
  overflow: hidden;
}

progress::-webkit-progress-bar { background: #F2E3E4; }
progress::-webkit-progress-value { border-radius: 3px; background: #E8A5B4; }
progress::-moz-progress-bar { border-radius: 3px; background: #E8A5B4; }
.question-number { margin-top: 49px; line-height: 16px; color: #C77F91; font-size: 11px; }
.quiz h1 { min-height: calc(23px * 1.55 * 2); margin-top: 13px; color: #493A3F; font-size: 23px; line-height: 1.55; }
.quiz-instruction, .quiz-hint { font-size: 13px; line-height: 19px; font-weight: 500; }
.quiz-instruction { margin-top: calc(345px - 250px - 23px * 1.55 * 2); color: #9E898D; }
.choices { display: grid; gap: 16px; margin-top: 28px; }
.choice {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  padding: 0 18px;
  border: 1px solid #F0DEDF;
  border-radius: 20px;
  background: #FFFFFF;
  color: #554348;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
}

.choice-icon { display: grid; place-items: center; flex: 0 0 50px; height: 50px; border-radius: 16px; background: #FCECEF; color: #D48398; }
.choice-icon svg { width: 24px; height: 24px; }
.choice-copy { display: grid; flex: 1; gap: 5px; }
.choice-copy small { color: #C98596; font-size: 11px; }
.choice::after { content: ""; flex: 0 0 20px; height: 20px; box-sizing: border-box; border: 1.5px solid #DFC9CD; border-radius: 50%; }
.choice:active { background: #FCECEF; }
.quiz-hint { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 111px; color: #A78D93; }
.quiz-hint svg { width: 16px; height: 16px; color: #D096A3; }

[data-page="result"] { --inset: 24px; --brand: #C46D83; --brand-size: 20px; --header-top: 43px; background: #FFF9F6; }
[data-page="result"] .site-header { padding-inline: 2px; }
[data-page="result"] .site-header::after,
[data-page="oshi-input"] .site-header::after {
  content: "";
  position: absolute;
  left: var(--inset);
  right: var(--inset);
  top: var(--progress-top);
  height: var(--progress-height);
  border-radius: var(--progress-radius);
  background: linear-gradient(to right, var(--progress-fill) var(--progress-value), var(--progress-track) var(--progress-value));
}
[data-page="result"] {
  --progress-top: 77px;
  --progress-height: 3px;
  --progress-radius: 3px;
  --progress-fill: #D98298;
  --progress-track: #F3E4E5;
  --progress-value: calc(127 / 338 * 100%);
}
.result { padding-top: 25px; text-align: center; }
.result-heading { color: #8D6E77; font-size: 12px; font-weight: 500; }
.portrait { display: grid; justify-items: center; }
.portrait .character { width: min(100%, 208px); height: 208px; margin-top: 10px; border-radius: 22px; background: #F8E7E8; }
.portrait strong, .portrait h2 { margin-top: 32px; color: #513C43; font-size: 24px; }
.portrait .type-code-letters { margin-top: 8px; color: #C45178; font-size: 20px; font-weight: 800; letter-spacing: 6px; }
.type-codes { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.type-codes .code { white-space: nowrap; }
.code { font-weight: 700; }
.portrait .code { padding: 6px 10px; border-radius: 16px; background: #F8E9EA; color: #A45D70; font-size: 10px; font-weight: 600; }
.description { margin: 13px 8px 0; color: #745E64; font-size: 11px; line-height: 1.7; text-align: left; }
.axis-list {
  display: grid;
  gap: 7px;
  min-height: 188px;
  margin: 16px 0 18px;
  padding: 15px 20px;
  border-radius: 18px;
  background: #FFFFFF;
}
.axis-list h2 { color: #59434A; font-size: 13px; }
.axis-labels { display: flex; justify-content: space-between; color: #745E64; font-size: 11px; }
.axis-bar { position: relative; height: 8px; border-radius: 8px; background: #F2E6E8; }
.axis-bar::after { content: ""; position: absolute; top: 0; left: var(--position); width: 8px; height: 8px; transform: translateX(-50%); border-radius: 50%; background: #D78599; }
.result .primary { background: #D77F96; font-size: 13px; }
.result .text-button { min-height: 30px; margin-top: 17px; font-weight: 600; }

[data-page="oshi-input"] {
  --inset: 24px;
  --brand: #C7778B;
  --brand-size: 18px;
  --header-top: 53px;
  --progress-top: 87px;
  --progress-height: 4px;
  --progress-radius: 2px;
  --progress-fill: #D88FA1;
  --progress-track: #F4E5E7;
  --progress-value: 50%;
}
[data-page="oshi-input"] .site-header, [data-page="share"] .site-header, [data-page="gallery"] .site-header { justify-content: center; }
[data-page="oshi-input"] main { padding-top: calc(127px - 53px - 18px * 1.4); }
[data-page="oshi-input"] h1 { color: #503C42; font-size: 24px; }
[data-page="oshi-input"] .intro { color: #826D72; font-size: 12px; line-height: 19px; }
#oshi-form { display: grid; gap: 13px; margin-top: 14px; }
#oshi-form > label, legend { color: #58444A; font-size: 13px; font-weight: 700; }
#oshi-form small { color: #AB9298; font-size: 10px; font-weight: 400; }
input[type="text"], textarea {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 5px;
  padding: 10px 13px;
  border: 1px solid #EFDFE1;
  border-radius: 10px;
  background: #FFFFFF;
  color: #58444A;
  font-size: 12px;
  font-weight: 400;
}
textarea { height: 59px; resize: vertical; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; margin-bottom: 9px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { position: relative; cursor: pointer; }
.tag input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tag span { display: grid; place-items: center; min-height: 29px; padding: 0 10px; border: 1px solid #EBDDE0; border-radius: 15px; background: #FFFFFF; color: #806D72; font-size: 11px; }
.tag input:checked + span { border-color: #E5A8B6; background: #F8E3E8; color: #AD6175; font-weight: 700; }
.tag input:focus-visible + span { outline: 2px solid #B85570; outline-offset: 2px; }
#oshi-form .primary { margin-top: 10px; background: #D9879B; font-size: 14px; }
.error { color: #AD6175; font-size: 13px; }

[data-page="judging"] {
  --inset: 24px;
  --brand: #D77992;
  --brand-size: 22px;
  --header-top: 65px;
  background: #FFF9F8;
}
[data-page="judging"] .site-header { padding-inline: 4px; }
.judging { padding-top: calc(132px - 65px - 22px * 1.4); text-align: center; }
.reading-progress {
  position: absolute;
  inset: 105px 28px auto;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: #F4E4E7;
}
.reading-progress::before {
  content: "";
  display: block;
  width: var(--reading-completed, 0%);
  height: 100%;
  border-radius: inherit;
  background: #E79BAE;
  animation: reading-progress var(--reading-duration) linear both;
}
.reading-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 186px;
  height: 186px;
  margin-inline: auto;
  padding-bottom: 24px;
}
.reading-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, #F7C3D0 0%, transparent 70%);
  animation: reading-glow 1.2s ease-in-out infinite alternate;
}
.reading-heart { position: relative; width: 88px; color: #E99BB0; animation: reading-pulse 1.2s ease-in-out infinite; }
.reading-heart svg { width: 100%; fill: currentColor; }
.reading-sparkle { position: absolute; color: #E8A9B7; animation: reading-twinkle 1s ease-in-out infinite alternate; }
.reading-sparkle:nth-of-type(2) { top: 45px; left: 17px; font-size: 20px; }
.reading-sparkle:nth-of-type(3) { top: 72px; right: 10px; font-size: 25px; animation-delay: -450ms; }
.reading-sparkle:nth-of-type(4) { top: 21px; right: 31px; color: #EDC1C9; font-size: 12px; animation-delay: -700ms; }
.judging h1 { margin-top: -23px; color: #554047; font-size: 23px; }
.reading-description { margin-top: 7px; color: #8C757C; font-size: 13px; font-weight: 500; line-height: 1.6; }
.steps { margin: 25px 0 0; padding: 10px 18px; border-radius: 20px; background: #FFFFFF; list-style: none; text-align: left; }
.steps li { display: flex; align-items: center; gap: 12px; min-height: 50px; color: #B9A9AD; font-size: 12px; font-weight: 600; }
.step-icon { display: grid; place-items: center; flex: 0 0 21px; height: 21px; border: 1px solid #CDBFC2; border-radius: 50%; }
.steps li:is([aria-current="step"], .is-complete) { color: #655057; }
.steps [aria-current="step"] .step-icon {
  border: 2px solid #F5DCE3;
  border-top-color: #D98CA1;
  animation: reading-spin .65s linear infinite;
}
.steps .is-complete .step-icon { border-color: #D98CA1; background: #D98CA1; color: #FFFFFF; }
.steps .is-complete .step-icon::before { content: "✓"; }
.reading-episode { min-height: 116px; margin-top: 20px; padding: 18px 20px; border-radius: 18px; background: #FCEFF1; text-align: left; }
.reading-episode h2 { color: #C27F91; font-size: 11px; }
.reading-episode blockquote { margin: 10px 0 0; color: #705B61; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.reading-note { margin-top: 40px; color: #A59096; font-size: 11px; font-weight: 500; }

@keyframes reading-progress { from { width: 0; } to { width: 100%; } }
@keyframes reading-glow { from { opacity: .4; } to { opacity: .85; } }
@keyframes reading-pulse { 50% { transform: scale(1.12); } }
@keyframes reading-twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes reading-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .reading-progress::before,
  .reading-visual::before,
  .reading-heart,
  .reading-sparkle,
  .steps [aria-current="step"] .step-icon { animation: none; }
  .reading-visual::before { opacity: .65; }
}

[data-page="compatibility"] { --inset: 20px; --brand: #C64D75; --brand-size: 19px; --header-top: 41px; background: #FFF9F8; }
[data-page="compatibility"] .wordmark { margin-left: 4px; font-weight: 800; }
.compatibility { padding-top: calc(84px - 41px - 19px * 1.4); text-align: center; }
.compatibility h1 { color: #493640; font-size: 20px; }
.pair {
  display: grid;
  grid-template-columns: minmax(0, 110px) minmax(max-content, 1fr) minmax(0, 110px);
  min-height: 204px;
  margin-top: 29px;
  padding: 15px;
  border: 1px solid #F6E7E9;
  border-radius: 22px;
  background: #FFFFFF;
}
.pair > div { display: grid; align-content: start; justify-items: center; }
.pair .character { height: 96px; border: 1px solid #EEDCE0; border-radius: 16px; background: #FCF1F3; }
.pair small { margin-top: 8px; color: #A47A88; font-size: 10px; font-weight: 700; }
.pair .code { color: #C45178; font-size: 14px; font-weight: 800; }
.pair > div > strong { color: #59434B; font-size: 10px; font-weight: 600; }
.score { padding-top: 12px; }
.score span { color: #E48CA6; font-size: 18px; font-weight: 700; }
.score > strong[aria-label] { color: #C94370; font-size: 38px; font-weight: 800; line-height: 1.2; }
.score small { margin-top: 0; color: #C590A1; font-size: 8px; }
.match-list { margin: 16px 5px 24px; padding: 0; list-style: none; text-align: left; }
.match-list li { display: grid; grid-template-columns: 91px 62px 1fr; align-items: center; min-height: 44px; color: #59434B; font-size: 12px; font-weight: 700; }
.match-list .wavering { margin-left: 10px; color: #B9A0A7; font-size: 10px; font-weight: 500; }
.match-list li + li { border-top: 1px solid #F3E7E9; }
.match-list strong { display: grid; place-items: center; height: 21px; border-radius: 11px; font-size: 10px; }
.match-list .same { background: #FBE2E9; color: #C45178; }
.match-list .different { background: #F8EEDC; color: #96734E; }
.note-main { justify-content: flex-start; gap: 12px; min-height: 79px; padding: 16px 17px; border-radius: 19px; background: #C94070; font-size: 14px; text-align: left; }
.note-main small { display: block; color: #FFE7EF; font-size: 11px; font-weight: 600; }
.note-icon { display: grid; place-items: center; flex: 0 0 47px; height: 47px; border-radius: 12px; background: #FFFFFF; }
.note-icon img { width: 32px; height: 32px; }
.compatibility .secondary { min-height: 46px; margin-top: 11px; border: 1px solid #EBCDD7; border-radius: 14px; background: #F7DDE5; color: #A73F63; font-size: 12px; }

[data-page="share"] { --inset: 36px; --brand: #C46F8A; --brand-size: 17px; --header-top: 54px; }
.share { padding-top: calc(92px - 54px - 17px * 1.4); text-align: center; }
.share h1 { color: #503642; font-size: 22px; }
.share-preview { display: grid; place-items: center; max-width: 274px; min-height: 472px; margin: 39px auto 19px; overflow: hidden; border: 1px solid #F4DCE3; border-radius: 20px; background: #FFFDFB; }
.share canvas { display: block; width: 100%; height: auto; }
.share .error { margin-bottom: 12px; }
.share-actions { display: flex; justify-content: center; gap: 14px; margin-top: 18px; }
.share-actions .icon-btn { display: grid; place-items: center; width: 56px; height: 56px; padding: 0; border: 1px solid #EAC9D4; border-radius: 50%; background: #FFFFFF; color: #503642; cursor: pointer; }
.share-actions .icon-btn svg { width: 25px; height: 25px; }
.share-actions .icon-btn:disabled { opacity: 0.45; cursor: default; }
.share-actions #share-instagram { color: #C13584; }

[data-page="gallery"] { --inset: 18px; --brand: #B96E80; --brand-size: 20px; --header-top: 44px; background: #FFF9F6; }
[data-page="gallery"] .site-header { min-height: 98px; }
.gallery { text-align: center; }
.gallery-intro { display: grid; gap: 5px; padding: 12px 10px 18px; }
.gallery h1 { color: #513D42; font-size: 24px; }
.gallery .intro { color: #8B7477; font-size: 11px; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 7px; }
.tile { display: grid; align-content: start; justify-items: center; gap: 3px; min-height: 122px; padding: 5px 4px; border: 1px solid #F1E7E5; border-radius: 12px; background: #FFFFFF; color: #5D4A4D; font-size: 9px; }
.tile strong { font-weight: 600; }
.tile .code { color: #B9687C; font-size: 11px; letter-spacing: .5px; }
.tile .character { height: 69px; border-radius: 8px; background: #FBE8EA; }
.tile:is([data-code="WCPG"], [data-code="WIPD"], [data-code="ACSG"], [data-code="AISD"]) .character { background: #F9EDE5; }
.tile:is([data-code="WCSD"], [data-code="WIPG"], [data-code="ACPD"], [data-code="AISG"]) .character { background: #F6EDEB; }
.tile:is([data-code="WCSG"], [data-code="WISD"], [data-code="ACPG"], [data-code="AIPD"]) .character { background: #FBE9EE; }
.gallery-end { padding-top: 21px; color: #9A777E; font-size: 12px; font-weight: 600; }

dialog { width: min(342px, calc(100% - 48px)); max-height: calc(100% - 48px); padding: 15px 20px; border: 1px solid #F1E7E5; border-radius: 18px; background: #FFFFFF; color: #513D42; }
dialog::backdrop { background: rgb(81 61 66 / 50%); }
dialog form { display: flex; justify-content: end; }
dialog .portrait .code { margin-top: 6px; }
dialog .portrait h2 { margin-top: 6px; }
.close { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: #FBE9EE; color: #B27380; font-size: 24px; }

#toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 15px;
  background: #50383E;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}
#toast:empty { display: none; }
