:root {
  --bg: #eef2f0;
  --surface: #ffffff;
  --ink: #14211c;
  --soft: #3d5249;
  --muted: #5f736b;
  --line: #e3e9e6;
  --line-strong: #d3ddd8;
  --teal: #0f6e56;
  --teal-deep: #0b5644;
  --teal-soft: #e7f5f0;
  --amber: #9a6700;
  --amber-soft: #fff6e5;
  --rose: #b42318;
  --rose-soft: #fdeceb;
  --shadow: 0 1px 2px rgba(20, 33, 28, 0.04), 0 12px 32px rgba(20, 33, 28, 0.06);
  --sans: "Be Vietnam Pro", "Segoe UI", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(15, 110, 86, 0.08), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(20, 33, 28, 0.05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #cfe8df;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.8rem;
  top: 0.8rem;
  transform: translateY(-160%);
  background: var(--surface);
  color: var(--ink);
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  z-index: 3;
}

.skip:focus {
  transform: none;
}

a {
  color: var(--teal);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--teal-deep);
}

main {
  padding: 1.5rem 0 2.5rem;
}

h1,
h2,
h3 {
  font-weight: 650;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.15;
}

h2 {
  margin: 0.15rem 0 0.35rem;
  font-size: clamp(1.45rem, 2vw, 1.85rem);
}

h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.sheet {
  width: min(1080px, calc(100% - 1.5rem));
  margin: 0 auto;
}

.sheet-narrow {
  width: min(680px, calc(100% - 1.5rem));
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.mark {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--teal);
  color: #f4fffb;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.kicker {
  margin: 0 0 0.1rem;
  color: var(--teal);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede,
.hint,
.plate-intro,
.subject,
.hero-reading,
.line-detail,
.prose p {
  color: var(--soft);
}

.lede {
  max-width: 42rem;
  margin: 0.85rem 0 0;
  font-size: 1.02rem;
}

fieldset {
  margin: 0;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-inline-size: 0;
}

fieldset + fieldset {
  margin-top: 0.85rem;
}

legend {
  padding: 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.hint {
  margin: 0.15rem 0 0.9rem;
  font-size: 0.92rem;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
  cursor: pointer;
}

.choice-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.choice-head input {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  accent-color: var(--teal);
  cursor: pointer;
}

.choice-head strong {
  display: block;
  font-size: 0.95rem;
}

.choice-head small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.choice select {
  padding: 0.45rem 1.4rem 0.45rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--teal) 50%),
    linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-size: 0.82rem;
}

.picker {
  margin-bottom: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem 0.9rem;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

.lbl {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0 0.75rem;
  background: #f7faf8;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.control:focus-within {
  background: #fff;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 110, 86, 0.15);
}

.control i {
  flex: none;
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
  color: inherit;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 0.7rem 0;
  background: transparent;
  border: 0;
}

input:focus,
select:focus {
  outline: none;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input.input-validation-error,
select.input-validation-error {
  color: var(--rose);
}

.control:has(.input-validation-error) {
  border-color: #e7b4af;
  background: var(--rose-soft);
}

::placeholder {
  color: #9aada6;
  opacity: 1;
}

select {
  cursor: pointer;
  padding-right: 1.2rem;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--teal) 50%),
    linear-gradient(135deg, var(--teal) 50%, transparent 50%);
  background-position: calc(100% - 10px) 55%, calc(100% - 5px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.stamp-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.28rem;
  background: #f7faf8;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.stamp {
  position: relative;
  cursor: pointer;
}

.stamp input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.stamp span {
  display: block;
  text-align: center;
  padding: 0.55rem 0.4rem;
  border-radius: 9px;
  color: var(--soft);
  font-size: 0.92rem;
  font-weight: 600;
  user-select: none;
}

.stamp:hover span {
  background: rgba(15, 110, 86, 0.06);
}

.stamp input:checked + span {
  background: var(--teal);
  color: #f4fffb;
}

.stamp input:focus-visible + span {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.field-error {
  display: block;
  margin-top: 0.3rem;
  color: var(--rose);
  font-size: 0.8rem;
}

.field-error:empty,
.field-validation-valid {
  display: none;
}

.validation-summary-valid {
  display: none;
}

.validation-summary-errors {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--rose-soft);
  color: var(--rose);
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.submit-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1rem;
}

.press {
  min-width: 168px;
  padding: 0.78rem 1.25rem;
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: #f4fffb;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 110, 86, 0.22);
}

.press:hover {
  background: var(--teal-deep);
}

.press:active {
  transform: translateY(1px);
}

.text-btn {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.text-btn:hover {
  color: var(--ink);
}

.prospectus,
.results {
  padding: 1.15rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.results {
  animation: rise 0.35s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.subject {
  margin: 0 0 1rem;
  font-weight: 500;
}

.note-banner {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: var(--amber-soft);
  color: #6d4a08;
}

.heroes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.hero {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1rem 1rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfb;
}

.hero.forest { background: linear-gradient(180deg, #f3faf7, #fbfcfb 42%); }
.hero.gold { background: linear-gradient(180deg, #fff8ee, #fbfcfb 46%); }
.hero.wine { background: linear-gradient(180deg, #fff5f4, #fbfcfb 46%); }

.hero-value {
  margin: 0.15rem 0 0.25rem;
  font-size: clamp(2.15rem, 3.4vw, 2.85rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
}

.hero-value small {
  margin-left: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

.hero-reading,
.hero-note,
.line-formula {
  margin: 0.28rem 0 0;
}

.hero-note {
  color: var(--soft);
}

.line-formula {
  color: var(--muted);
  font-size: 0.8rem;
}

.key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin: 0.9rem 0 0.85rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.key li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.plate {
  min-width: 0;
  padding: 0.95rem 1rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfcfb;
}

.plate.wide,
.plate:not(.wide):has(+ .plate.wide),
.plate.wide + .plate:not(.wide):last-child {
  grid-column: 1 / -1;
}

.plate header {
  margin-bottom: 0.35rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}

.plate-intro {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
}

.lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lines li + li {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.plate.wide .lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1.25rem;
}

.plate.wide .lines li {
  margin: 0;
  padding: 0.65rem 0;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.line-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: baseline;
}

.line-label {
  font-weight: 600;
}

.line-value {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: right;
}

.line-detail,
.lines .line-formula {
  margin: 0.15rem 0 0 1rem;
}

.line-detail {
  font-size: 0.9rem;
}

.dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--ink);
}

.dot.forest { background: var(--teal); }
.dot.gold { background: #d3920a; }
.dot.wine { background: var(--rose); }
.dot.ink { background: #8aa097; }

.footnotes {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footnotes li + li {
  margin-top: 0.25rem;
}

.toc {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0.7rem 0 0;
  padding: 0;
}

.toc li {
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
}

.toc strong {
  display: block;
  font-size: 0.98rem;
}

.toc p {
  margin: 0.2rem 0 0;
  color: var(--soft);
  font-size: 0.9rem;
}

.teaser {
  margin: 0.95rem 0 0;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: 0.95rem;
}

.colophon {
  color: var(--muted);
  font-size: 0.88rem;
}

.colophon p {
  margin: 0.3rem 0;
  max-width: 46rem;
}

.prose p {
  max-width: 38rem;
}

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92em;
}

@media (max-width: 800px) {
  .choices {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .heroes,
  .plates,
  .toc,
  .plate.wide .lines {
    grid-template-columns: 1fr;
  }

  .plate.wide {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .span-3,
  .span-4 {
    grid-column: span 2;
  }
}

@media (max-width: 560px) {
  main {
    padding-top: 0.75rem;
  }

  .sheet {
    width: calc(100% - 0.8rem);
  }

  .form-grid,
  .stamp-pair {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3,
  .span-4 {
    grid-column: auto;
  }

  .submit-row {
    flex-direction: column;
    align-items: stretch;
  }

  .press {
    width: 100%;
  }

  .line-top {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .line-value {
    grid-column: 2;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .results {
    animation: none;
  }

  .press:active {
    transform: none;
  }
}

@media print {
  body {
    background: white;
  }

  .press,
  .text-btn,
  .skip {
    display: none;
  }

  .sheet-inner,
  .prospectus,
  .results,
  fieldset,
  .plate,
  .hero {
    box-shadow: none;
  }
}
