:root {
  color-scheme: light;
  --paper: #f7f1e8;
  --paper-2: #fffaf2;
  --ink: #201a17;
  --muted: #786b63;
  --line: #ded0c0;
  --blue: #6f8fa1;
  --red: #8f2f2f;
  --red-deep: #5d1f25;
  --gold: #b88a3c;
  --purple: #4c3b59;
  --shadow: 0 18px 50px rgba(49, 35, 28, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  background:
    radial-gradient(circle at 18% 8%, rgba(111, 143, 161, 0.18), transparent 26rem),
    linear-gradient(180deg, #fbf5ec 0%, #f3eadf 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100svh;
  margin: 0 auto;
  padding: 22px 18px calc(28px + env(safe-area-inset-bottom));
}

.screen {
  min-height: calc(100svh - 50px);
  display: flex;
  flex-direction: column;
}

.brand-row,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(32, 26, 23, 0.12);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 250, 242, 0.68);
}

.hero {
  display: grid;
  gap: 18px;
  padding-top: 20px;
}

.hero-visual {
  position: relative;
  overflow: visible;
}

.hero-visual img {
  display: block;
  width: min(108%, 560px);
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 26px rgba(49, 35, 28, 0.1));
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(27px, 7.2vw, 42px);
  font-weight: 520;
  line-height: 1.12;
  letter-spacing: 0;
}

.hero-copy h1 span {
  color: var(--red-deep);
  font-size: 1.18em;
  font-weight: 520;
}

.hero-copy h1 em {
  font-style: normal;
}

.hero-copy .lead {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.68;
}

.hero-copy p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.72;
}

.hero-copy .sublead {
  margin-top: 22px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 54px;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-button {
  color: #fffaf2;
  background: linear-gradient(135deg, var(--red-deep), var(--red));
  box-shadow: var(--shadow);
}

.secondary-button {
  color: var(--ink);
  background: rgba(255, 250, 242, 0.78);
  border: 1px solid var(--line);
}

.button-stack {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.notice {
  margin-top: auto;
  padding-top: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}

.progress-wrap {
  margin: 26px 0 34px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 26, 23, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--red));
  transition: width 180ms ease;
}

.question {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.question h1 {
  margin: 0 0 28px;
  font-size: 25px;
  line-height: 1.48;
  letter-spacing: 0;
}

.options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.option-button {
  min-height: 64px;
  padding: 7px 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 250, 242, 0.82);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.28;
  word-break: keep-all;
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    background 130ms ease;
}

.option-button.active {
  color: #fffaf2;
  border-color: transparent;
  background: var(--red-deep);
}

.option-button strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0 auto 4px;
  border-radius: 999px;
  color: var(--red-deep);
  background: rgba(143, 47, 47, 0.09);
  font-size: 15px;
}

.option-button span {
  display: block;
  white-space: nowrap;
}

.option-button.active strong {
  color: var(--red-deep);
  background: #fffaf2;
}

.scale-hints {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.option-button:active,
.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: scale(0.985);
}

.loading {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.seal {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 24px;
  border: 3px solid var(--red);
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
  transform: rotate(-8deg);
}

.loading h1 {
  margin: 0;
  font-size: 24px;
}

.result-card,
.gallery-card,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 242, 0.84);
  box-shadow: var(--shadow);
}

.result-card {
  margin-top: 18px;
  padding: 16px;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.result-code {
  margin: 0;
  color: var(--red-deep);
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.result-hero {
  text-align: center;
}

.code-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.code-hero div {
  display: grid;
  min-height: 62px;
  place-items: center;
  padding: 6px 4px;
  border: 1px solid color-mix(in srgb, var(--result-accent, var(--red-deep)) 32%, transparent);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(243, 234, 223, 0.72));
}

.code-hero strong {
  color: var(--result-accent, var(--red-deep));
  font-size: 42px;
  font-weight: 950;
  line-height: 0.94;
}

.result-title {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: clamp(38px, 10.5vw, 60px);
  line-height: 1.16;
  letter-spacing: 0;
}

.result-code-big {
  display: block;
  margin: 8px 0 0;
  color: var(--result-accent, var(--red-deep));
  font-size: 30px;
  font-weight: 950;
  letter-spacing: 0.04em;
  line-height: 1;
}

.result-summary {
  margin: 8px auto 0;
  color: var(--gold);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--gold);
  font-size: 15px;
  font-weight: 800;
}

.result-character {
  display: block;
  width: min(100%, 236px);
  margin: 4px auto 2px;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(49, 35, 28, 0.12));
}

.copy-block {
  margin-top: 16px;
}

.copy-block h2 {
  margin: 0 0 8px;
  color: var(--red-deep);
  font-size: 15px;
}

.copy-block p {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.68;
  white-space: pre-line;
}

.result-notes {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-notes div {
  padding: 2px 0 0;
}

.result-notes h2 {
  margin: 0 0 7px;
  color: var(--red-deep);
  font-size: 14px;
}

.result-notes p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.58;
}

.danger-note {
  margin-top: 8px;
}

.meter-list {
  display: grid;
  gap: 14px;
  width: min(100%, 92%);
  margin: 22px auto 0;
}

.meter-row {
  display: grid;
  gap: 7px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.meter-end {
  display: flex;
  gap: 6px;
  align-items: baseline;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.meter-end strong {
  color: var(--result-accent, var(--red-deep));
  font-size: 21px;
  font-weight: 650;
  line-height: 1;
}

.meter-end-right {
  text-align: right;
}

.meter-track {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(32, 26, 23, 0.08);
}

.meter-mid {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 18px;
  border-radius: 999px;
  background: rgba(32, 26, 23, 0.2);
  transform: translate(-50%, -50%);
}

.meter-track span {
  position: absolute;
  top: 0;
  z-index: 1;
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--result-accent, var(--red-deep));
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.poster-screen {
  max-width: 520px;
}

.poster-page {
  margin-top: 14px;
}

.poster-page img {
  display: block;
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 16px 42px rgba(49, 35, 28, 0.16);
  -webkit-touch-callout: default;
  user-select: auto;
}

.poster-tip {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.download-link {
  display: grid;
  place-items: center;
  min-height: 48px;
  margin-top: 12px;
  border-radius: var(--radius);
  color: #fffaf2;
  background: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

@media (max-width: 380px) {
  .option-button {
    min-height: 58px;
    font-size: 10px;
  }

  .option-button strong {
    width: 25px;
    height: 25px;
    font-size: 13px;
  }

  .code-hero strong {
    font-size: 38px;
  }

  .result-character {
    width: min(100%, 224px);
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 34px;
  }

  .hero {
    padding-top: 42px;
  }

  .result-character {
    width: min(100%, 330px);
    margin-top: 22px;
  }

  .result-card {
    margin-top: 24px;
    padding: 20px;
  }

  .code-hero div {
    min-height: 72px;
  }

  .code-hero strong {
    font-size: 48px;
  }

  .result-title {
    margin-top: 10px;
    font-size: clamp(42px, 12vw, 64px);
  }

  .result-code-big {
    margin-top: 10px;
    font-size: 34px;
  }

  .copy-block {
    margin-top: 22px;
  }
}
