:root {
  color-scheme: light;
  --ink: #281d35;
  --muted: #61576b;
  --night: #241b31;
  --paper: #f6f2fa;
  --white: #fff;
  --stroke: #e2d8e8;
  --purple: #6340a8;
  --purple-light: #f0e7ff;
  --peach: #ffc19d;
  --orange-light: #fff0e5;
  --radius: 1.35rem;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, ol, dl, dd { margin: 0; }
button, input, textarea { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid #8e60d1; outline-offset: 3px; }
h1:focus { outline: none; }

.site-header {
  background: var(--night);
  color: var(--white);
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 3.7rem;
  width: min(calc(100% - 2rem), 54rem);
  margin-inline: auto;
  font-size: .95rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: .06em;
}

.brand-mark {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  border: 2px solid var(--peach);
  border-radius: .34rem;
  color: var(--peach);
  display: grid;
  place-items: center;
  transform: rotate(-12deg);
}

.brand-mark::before { content: "?"; font: 800 .85rem/1 system-ui, sans-serif; }

.layout {
  width: min(calc(100% - 1.5rem), 45rem);
  margin-inline: auto;
  padding-block: 1rem 3rem;
}

.hero, .banner, .score-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--night);
  color: #fff9ff;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(6rem, 36vw, 11rem);
  align-items: center;
  min-height: 15rem;
  padding: 1.25rem;
  background:
    radial-gradient(ellipse at 95% 50%, #513861 0%, transparent 64%),
    var(--night);
}

.hero h1 {
  font-size: clamp(2rem, 9vw, 4.25rem);
  font-weight: 900;
  letter-spacing: .035em;
  line-height: 1.18;
}

.hero h1 span { color: var(--peach); }
.hero p, .banner p {
  margin-top: .9rem;
  color: #eee1f5;
  font-size: .875rem;
  line-height: 1.75;
}

.box-art {
  position: relative;
  margin-left: -.35rem;
  height: clamp(8rem, 36vw, 11rem);
  pointer-events: none;
  container-type: size;
}

.box-art > span { position: absolute; }
.orbit {
  inset: 10% 3%;
  border: 1px dashed #a787b6;
  border-radius: 50%;
  transform: rotate(-20deg);
}
.box-shadow {
  inset: 69% 5% 10% 11%;
  border-radius: 50%;
  background: #180f21;
  filter: blur(8px);
  opacity: .75;
}
.box-front, .box-side, .box-lid { inset: 0; }
.box-front {
  background: #ffa37b;
  clip-path: polygon(21% 42%, 62% 56%, 62% 90%, 21% 74%);
  color: #331b32;
  padding: 50% 38% 0 32%;
  font-size: 1.75rem;
  font-size: clamp(1rem, 23cqw, 4rem);
  font-weight: 900;
  line-height: 1;
}
.box-side {
  background: #d16a62;
  clip-path: polygon(62% 56%, 87% 37%, 87% 70%, 62% 90%);
}
.box-lid {
  background: #ffd5bc;
  clip-path: polygon(21% 42%, 49% 23%, 87% 37%, 62% 56%);
}
.spark { color: var(--peach); line-height: 1; }
.spark-large { top: 9%; right: 5%; font-size: 1.25rem; font-size: clamp(1rem, 18cqw, 2.5rem); }
.spark-small { bottom: 9%; left: 3%; font-size: .9rem; font-size: clamp(.75rem, 12cqw, 1.5rem); }
.box-tag {
  padding: .14em .55em;
  border-radius: .35rem;
  color: #2e1b41;
  font-size: .875rem;
  font-size: clamp(.875rem, 9cqw, 1.125rem);
  font-weight: 800;
  white-space: nowrap;
}
.tag-honne { top: 13%; left: 7%; background: #d8bbff; transform: rotate(-13deg); }
.tag-tatemae { bottom: 13%; right: 0; background: #fdd8bc; transform: rotate(12deg); }

.panel {
  margin-top: .9rem;
  padding: clamp(1rem, 4vw, 1.75rem);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 .3rem 1rem #3c1d5610;
}

.setup-panel { display: grid; gap: .7rem; }
.field-label { display: block; padding: 0; font-weight: 800; }
.field-hint { color: var(--muted); font-size: .875rem; }
.text-input {
  width: 100%;
  min-width: 0;
  min-height: 3.1rem;
  padding: .7rem .85rem;
  border: 1px solid #b9aac5;
  border-radius: .75rem;
  color: var(--ink);
  background: #fdfaff;
  font-size: 1rem;
}
.text-input::placeholder { color: #74647f; }

.mode-field { min-width: 0; margin: .45rem 0 0; padding: 0; border: 0; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: .6rem; }
.mode-choice, .quiz-choice { position: relative; cursor: pointer; }
.mode-choice input, .quiz-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  top: 50%;
  left: .8rem;
  margin: 0;
  opacity: 0;
}
.mode-face, .choice-face {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 3.4rem;
  padding: .65rem;
  border: 2px solid transparent;
  border-radius: .85rem;
  font-weight: 750;
}
.mode-face { justify-content: center; font-size: clamp(.875rem, 3.55vw, 1rem); }
.honne .mode-face { background: var(--purple-light); color: #4a2b86; }
.tatemae .mode-face { background: var(--orange-light); color: #783515; }
.mode-icon { font-size: 1.15rem; line-height: 1; }
.mode-choice input:checked + .mode-face { border-color: currentColor; }
.mode-choice input:focus-visible + .mode-face,
.quiz-choice input:focus-visible + .choice-face {
  outline: 3px solid #8e60d1;
  outline-offset: 2px;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.1rem;
  padding: .65rem .75rem;
  border: 1px solid transparent;
  border-radius: .8rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.primary { background: var(--purple); color: var(--white); }
.primary:disabled { background: #e7ddef; color: #62506f; cursor: default; }
.secondary { border-color: #d6c8e2; background: #f8f3fe; color: #50367a; }
.line { background: #097b46; color: var(--white); }
.setup-panel .button { margin-top: .4rem; }

.banner { padding: 1.35rem 1.25rem; }
.banner h1, .score-panel h1, .notice h1 {
  font-size: clamp(1.65rem, 7.5vw, 2.8rem);
  font-weight: 900;
  line-height: 1.25;
}
.banner p { max-width: 22rem; padding-right: 2.1rem; }
.banner .banner-label {
  position: relative;
  z-index: 1;
  margin: 0 0 .35rem;
  color: var(--peach);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.banner-stamp {
  position: absolute;
  right: clamp(.2rem, 4vw, 2rem);
  top: 50%;
  z-index: -1;
  color: #514060;
  font-size: clamp(5rem, 29vw, 10rem);
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%) rotate(12deg);
}

.progress-panel {
  padding: .9rem 1.05rem 1rem;
  border-radius: 1rem;
  color: #fff9ff;
  background: var(--night);
}
.progress-label { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
#quiz-label { color: #eee1f5; font-size: .875rem; font-weight: 700; }
.progress-count { color: #e8d9ee; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-count strong { color: var(--peach); font-size: 1.3rem; }
progress {
  display: block;
  width: 100%;
  height: .5rem;
  margin-top: .35rem;
  border: 0;
  border-radius: 1rem;
  appearance: none;
  background: #4d3b59;
  color: var(--peach);
}
progress::-webkit-progress-bar { background: #4d3b59; border-radius: 1rem; }
progress::-webkit-progress-value { background: var(--peach); border-radius: 1rem; }
progress::-moz-progress-bar { background: var(--peach); border-radius: 1rem; }
.question-heading h1 { font-size: clamp(1.45rem, 6vw, 2.05rem); font-weight: 850; line-height: 1.35; }
.text-button {
  min-height: 2.75rem;
  margin-top: .2rem;
  padding: .25rem 0;
  border: 0;
  background: transparent;
  color: #563491;
  font-size: .875rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: .25em;
  cursor: pointer;
}

.choices { display: grid; gap: .55rem; margin-top: 1rem; }
.choice-face {
  justify-content: flex-start;
  gap: .75rem;
  min-height: 3.35rem;
  padding-inline: .85rem;
  border: 1px solid #d6c8e2;
  background: #fbf7fd;
}
.choice-face::before {
  content: "";
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border: 1.5px solid #8d779d;
  border-radius: 50%;
}
.quiz-choice input:checked + .choice-face {
  border-color: var(--purple);
  box-shadow: inset 0 0 0 1px var(--purple);
  background: var(--purple-light);
}
.quiz-choice input:checked + .choice-face::before {
  border: 1px solid var(--purple);
  background: var(--purple);
  box-shadow: inset 0 0 0 3px var(--white);
}
.quiz-actions { display: grid; grid-template-columns: 1fr 2fr; gap: .65rem; margin-top: 1.1rem; }

.share-panel { display: grid; gap: .7rem; min-width: 0; }
.share-panel h2, .comparisons h2 { font-size: 1.15rem; }
.share-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.result-actions { display: grid; gap: .6rem; margin-top: .9rem; }
.reply-panel { margin: 0; padding: 0; border-radius: .85rem; }
.reply-panel summary { gap: .65rem; }
.reply-panel summary::-webkit-details-marker { display: none; }
.reply-panel summary::after {
  content: "";
  width: .5rem;
  height: .5rem;
  border-right: 2px solid;
  border-bottom: 2px solid;
  transform: translateY(-.1rem) rotate(45deg);
}
.reply-panel[open] summary::after { transform: translateY(.1rem) rotate(225deg); }
.reply-content { padding: clamp(.85rem, 3vw, 1.25rem); }
.comment-panel { padding: .85rem; border-radius: .8rem; background: #f6f0fb; }
.comment-templates { display: flex; flex-wrap: wrap; gap: .45rem; }
.comment-templates .button { width: auto; min-height: 2.75rem; font-size: .875rem; }
.share-message { overflow-wrap: anywhere; resize: vertical; }
.feedback { color: #365b41; font-size: .875rem; }
.feedback:empty { display: none; }
.card-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--stroke);
  border-radius: .8rem;
  box-shadow: 0 .25rem .7rem #241b3126;
  -webkit-touch-callout: default;
}

.score-panel {
  padding: 1.35rem 1rem 1.55rem;
  background: radial-gradient(ellipse at 50% 70%, #503363 0%, transparent 74%), var(--night);
  text-align: center;
}
.score-panel h1 { font-size: 1.3rem; }
.score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .25rem;
  color: var(--peach);
  font-size: clamp(1.1rem, 4.8vw, 1.65rem);
  font-weight: 800;
  margin-block: .25rem;
}
.score strong { font-size: clamp(3.4rem, 16vw, 5.5rem); line-height: 1.18; }
.reveal { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .45rem; font-weight: 750; }
.reveal strong { padding: .22rem .75rem; border-radius: 2rem; color: var(--ink); background: var(--peach); }
.reveal strong[data-mode="0"] { background: #deccff; }
.result-names { margin-top: .8rem; color: #eeddf5; font-size: .875rem; overflow-wrap: anywhere; }

.comparisons ol { margin-top: .75rem; padding: 0; list-style: none; }
.comparisons li { border-top: 1px solid var(--stroke); padding-block: .85rem; }
.comparisons li:last-child { padding-bottom: 0; }
.comparison-heading { display: flex; align-items: flex-start; gap: .65rem; }
.comparison-heading h3 { flex: 1; font-size: 1rem; line-height: 1.45; }
.verdict {
  flex-shrink: 0;
  padding: .1rem .45rem;
  border-radius: .4rem;
  color: #614652;
  background: #f5eaf0;
  font-size: .875rem;
  font-weight: 750;
}
.verdict.correct { color: #523580; background: var(--purple-light); }
.comparison-details { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.comparison-details > div { min-width: 0; padding: .55rem; border-radius: .55rem; background: #f5eff9; }
.comparison-details dt { color: var(--muted); font-size: .875rem; }
.comparison-details dd { margin-top: .2rem; font-weight: 750; overflow-wrap: anywhere; }
.notice .button { margin-top: .9rem; }
.notice p { margin-top: .65rem; }

@media (min-width: 38rem) {
  .layout { padding-top: 1.8rem; }
  .hero { min-height: 19rem; grid-template-columns: 1fr 17rem; padding: 1.9rem 2rem; }
  .hero p, .banner p { font-size: 1rem; }
  .box-art { height: 15rem; }
  .banner { padding: 1.75rem 2rem; }
  .progress-panel { padding-inline: 1.5rem; }
  .choices, .mode-options { gap: .75rem; }
  .comparison-details > div { padding-inline: .75rem; }
}

@media (hover: hover) {
  .button:not(:disabled):hover { filter: brightness(.94); }
  .mode-choice:hover .mode-face, .quiz-choice:hover .choice-face { border-color: #9d84b4; }
  .mode-choice input:checked + .mode-face { border-color: currentColor; }
}
