:root {
  --ink: #2d1b17;
  --ink-soft: #60473b;
  --cream: #f6f0e7;
  --paper: #fffdf9;
  --line: #dccbbb;
  --copper: #a75c38;
  --copper-deep: #7d3f27;
  --sage: #6d7862;
  --muted: #7a6e66;
  --error: #a63b31;
  --shadow: 0 16px 45px rgb(45 27 23 / 8%);
  --radius: 18px;
  color-scheme: light;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  background: var(--cream);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgb(167 92 56 / 8%), transparent 28rem),
    var(--cream);
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input[type="submit"] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--copper);
  outline-offset: 3px;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header {
  min-height: 78px;
  border-bottom: 1px solid rgb(96 71 59 / 18%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  font-family: Georgia, serif;
  font-size: 0.75rem;
  letter-spacing: -0.08em;
}

.header-note,
.site-footer p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

main {
  display: grid;
  gap: 5.25rem;
  padding: 3.25rem 0 5rem;
}

.hero {
  display: grid;
  align-items: center;
  gap: 2.5rem;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.hero-copy {
  max-width: 35rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--copper-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.19em;
  line-height: 1.3;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
  line-height: 1.15;
}

h1 {
  max-width: 8em;
  margin-bottom: 1.25rem;
  font-size: clamp(2.7rem, 7vw, 5.6rem);
  letter-spacing: -0.055em;
}

h1 em {
  color: var(--copper-deep);
  font-style: normal;
}

h2 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 0.3rem;
  font-size: 1.2rem;
}

.hero-lede,
.section-heading > p:last-child {
  max-width: 40rem;
  margin-bottom: 1.5rem;
  color: var(--ink-soft);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--copper-deep);
  font-weight: 800;
  text-underline-offset: 0.25em;
}

.hero-visual {
  margin: 0;
}

.hero-visual img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 2px 38px 2px 38px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.hero-visual figcaption {
  margin-top: 0.65rem;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 0.84rem;
  font-style: italic;
}

.workspace,
.results,
.presets {
  scroll-margin-top: 1.5rem;
}

.section-heading {
  margin-bottom: 1.6rem;
}

.section-heading h2 {
  margin-bottom: 0.55rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-card,
.timer-panel,
.preset-form,
.saved-presets,
.info-grid details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 253 249 / 75%);
  box-shadow: 0 8px 24px rgb(45 27 23 / 4%);
}

.form-card {
  min-width: 0;
  margin: 0;
  padding: 1.25rem;
}

.form-card legend {
  padding: 0 0.45rem;
  color: var(--copper-deep);
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.field-stack {
  display: grid;
  gap: 1rem;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 0.38rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 1px solid #bfa999;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.35;
  padding: 0.65rem 0.75rem;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgb(166 59 49 / 12%);
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix input {
  padding-right: 3.1rem;
}

.input-with-suffix > span {
  position: absolute;
  top: 50%;
  right: 0.85rem;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.field-help,
.field-error {
  margin: 0.38rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.field-error {
  min-height: 0;
  color: var(--error);
  font-weight: 700;
}

.field-error:not(:empty) {
  min-height: 1.2em;
}

.error-summary {
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgb(166 59 49 / 42%);
  border-left: 5px solid var(--error);
  border-radius: 10px;
  background: #fff6f3;
  color: #6c241e;
  font-weight: 700;
}

.stages-editor {
  margin-top: 1rem;
}

.stage-inputs {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 1rem;
}

.stage-input {
  min-width: 0;
}

.stage-input label {
  font-size: 0.86rem;
}

.stage-input input {
  min-width: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.button {
  min-height: 46px;
  padding: 0.65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1.2;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.button-primary {
  background: var(--ink);
  color: var(--paper);
}

.button-primary:hover:not(:disabled) {
  background: var(--copper-deep);
}

.button-quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button-quiet:hover:not(:disabled) {
  border-color: var(--copper);
  background: rgb(167 92 56 / 8%);
}

.results {
  position: relative;
}

.results::before {
  display: block;
  width: 100%;
  height: 1px;
  margin-bottom: 4.2rem;
  background: var(--line);
  content: "";
}

.results-heading {
  margin-bottom: 1.5rem;
}

.results-heading > p:last-child {
  margin-bottom: 0;
}

.summary-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.summary-card {
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.summary-card-accent {
  border-color: var(--copper);
  background: var(--ink);
  color: var(--paper);
}

.summary-card p,
.summary-card span {
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-card-accent p,
.summary-card-accent span {
  color: #d7bda9;
}

.summary-card strong {
  display: block;
  margin-bottom: 0.3rem;
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.timer-panel {
  display: grid;
  align-items: center;
  gap: 1rem 1.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 1rem 0 1.25rem;
  padding: 1.35rem;
  background: #eadbcc;
}

.timer-copy h2 {
  margin-bottom: 0.35rem;
  font-size: 1.45rem;
}

.timer-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.timer-readout {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  justify-self: end;
  white-space: nowrap;
}

.timer-readout time {
  font-family: Georgia, serif;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-readout span {
  color: var(--muted);
  font-family: Georgia, serif;
}

.timer-panel progress {
  width: 100%;
  height: 9px;
  accent-color: var(--copper-deep);
  grid-column: 1 / -1;
}

.timer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  grid-column: 1 / -1;
}

.timer-actions .button {
  min-height: 44px;
}

.steps {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.step {
  position: relative;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 3.25rem minmax(0, 1fr) auto;
  min-width: 0;
  padding: 1.1rem 0 1.35rem;
  border-bottom: 1px solid var(--line);
}

.step::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1.5rem;
  z-index: 0;
  width: 2px;
  background: var(--line);
  content: "";
}

.step:first-child {
  padding-top: 0.5rem;
}

.step:last-child {
  padding-bottom: 0.6rem;
  border-bottom: 0;
}

.step-badge {
  position: relative;
  z-index: 1;
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--cream);
  color: var(--muted);
  font-family: Georgia, serif;
  font-weight: 700;
}

.step-content,
.step-target {
  min-width: 0;
}

.step-content h3 {
  margin-bottom: 0.3rem;
  font-size: 1.2rem;
}

.step-content p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.step-target {
  align-self: center;
  text-align: right;
}

.step-target strong {
  display: block;
  color: var(--copper-deep);
  font-family: Georgia, serif;
  font-size: 1.45rem;
  line-height: 1;
}

.step-target span {
  color: var(--muted);
  font-size: 0.78rem;
}

.step.is-active .step-badge {
  border-color: var(--copper);
  background: var(--copper);
  color: var(--paper);
  box-shadow: 0 0 0 5px rgb(167 92 56 / 15%);
}

.step.is-active .step-content h3,
.step.is-active .step-target strong {
  color: var(--copper-deep);
}

.step.is-complete .step-badge {
  border-color: var(--sage);
  color: var(--sage);
}

.preset-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
}

.preset-form,
.saved-presets {
  min-width: 0;
  padding: 1.25rem;
}

.preset-form {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.preset-form .field-help {
  margin-top: 0.4rem;
}

.saved-presets-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.saved-presets-heading h3 {
  margin-bottom: 0;
}

.text-button {
  min-height: 44px;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--copper-deep);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.text-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.delete-confirm {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  border: 1px solid rgb(166 59 49 / 42%);
  border-radius: 12px;
  background: #fff6f3;
}

.delete-confirm p {
  margin: 0 0 0.75rem;
  color: #6c241e;
  font-size: 0.86rem;
  font-weight: 700;
}

.delete-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.button-danger {
  background: var(--error);
  color: #fff;
}

.button-danger:hover:not(:disabled) {
  background: #7c2822;
}

.status-message {
  min-height: 1.5em;
  margin: 0.5rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.preset-list {
  display: grid;
  gap: 0.75rem;
}

.preset-empty {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.preset-item {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
}

.preset-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.preset-item h4 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-family: Georgia, serif;
  font-size: 1.05rem;
}

.preset-item time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
}

.preset-item p {
  margin: 0.5rem 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.preset-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.preset-item-actions button {
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
}

.preset-item-actions button:hover {
  border-color: var(--copper);
}

.info-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-grid details {
  min-width: 0;
  padding: 1rem 1.1rem;
}

.info-grid summary {
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.info-grid details[open] summary {
  margin-bottom: 0.7rem;
  color: var(--copper-deep);
}

.info-grid p,
.info-grid ol {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.info-grid p + p {
  margin-top: 0.75rem;
}

.info-grid ol {
  padding-left: 1.15rem;
}

.info-grid li + li {
  margin-top: 0.5rem;
}

.site-footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid rgb(96 71 59 / 18%);
}

.site-footer p:first-child {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-family: Georgia, serif;
  font-weight: 700;
}

@media (max-width: 800px) {
  main {
    gap: 4rem;
    padding-top: 2rem;
  }

  .hero,
  .preset-layout {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 9em;
  }

  .hero-visual {
    max-width: 42rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .page-shell {
    width: min(100% - 1.25rem, 1180px);
  }

  .header-note {
    display: none;
  }

  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .stage-inputs {
    grid-template-columns: 1fr;
  }

  .timer-panel {
    grid-template-columns: 1fr;
  }

  .timer-readout {
    justify-self: start;
  }

  .step {
    grid-template-columns: 3rem minmax(0, 1fr);
  }

  .step-badge {
    width: 2.75rem;
    height: 2.75rem;
  }

  .step::before {
    left: 1.34rem;
  }

  .step-target {
    grid-column: 2;
    justify-self: start;
    margin-top: -0.35rem;
    text-align: left;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 2.45rem;
  }

  .form-card,
  .preset-form,
  .saved-presets,
  .timer-panel {
    padding: 1rem;
  }

  .stage-inputs {
    gap: 0.55rem;
  }

  .form-actions,
  .form-actions .button,
  .timer-actions,
  .timer-actions .button {
    width: 100%;
  }

  .button {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  :root {
    background: #fff;
    color: #000;
  }

  body {
    background: #fff;
  }

  .page-shell {
    width: 100%;
  }

  main {
    display: block;
    padding: 0;
  }

  .no-print,
  .hero,
  .workspace,
  .timer-actions,
  .timer-panel progress,
  .results::before {
    display: none !important;
  }

  .results {
    display: block;
    padding: 0;
  }

  .results-heading {
    padding-top: 0;
  }

  .summary-card,
  .timer-panel {
    box-shadow: none;
  }

  .summary-card-accent {
    background: #fff;
    color: #000;
  }

  .summary-card-accent p,
  .summary-card-accent span {
    color: #444;
  }

  .timer-panel {
    display: grid;
    border-color: #999;
    background: #fff;
  }

  .step {
    break-inside: avoid;
  }
}


/* SOU100 Stage A: first-view hierarchy */
.stage-a-hero { min-width: 0; min-height: 0 !important; height: auto; grid-template-columns: minmax(0, 1.15fr) minmax(200px, .85fr); align-items: center; gap: clamp(1rem, 2.5vw, 2.5rem); padding-block: clamp(1.25rem, 3vw, 2.5rem) !important; }
.stage-a-hero .hero-copy, .stage-a-hero .intro-copy { min-width: 0; min-height: 0 !important; padding: clamp(1rem, 2.7vw, 2.25rem) !important; }
.stage-a-hero h1 { max-width: none !important; margin: 0 0 .75rem !important; font-size: clamp(2rem, 4vw, 3.35rem) !important; line-height: 1.14 !important; letter-spacing: -.035em; word-break: auto-phrase; }
.stage-a-lede { max-width: 52rem; margin: .25rem 0 0 !important; color: inherit; font-size: clamp(1rem, 1.25vw, 1.15rem) !important; line-height: 1.55 !important; }
.stage-a-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem 1rem; margin: .8rem 0 0; padding-left: 1.35rem; font-size: .92rem; line-height: 1.45; }
.stage-a-steps li { min-width: 0; padding-left: .12rem; }
.stage-a-extras { margin-top: .7rem; font-size: .8rem; }
.stage-a-extras > * { margin-top: .35rem !important; margin-bottom: 0 !important; }
.stage-a-cta { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; margin-top: .9rem; padding: .7rem 1.1rem; border: 2px solid #fff; border-radius: 999px; background: #17412f; color: #fff !important; font-weight: 800; line-height: 1.25; text-align: center; text-decoration: none; }
.stage-a-cta:hover { background: #0f3324; color: #fff !important; }
.stage-a-cta:focus-visible { outline: 3px solid #005fcc; outline-offset: 3px; box-shadow: 0 0 0 6px #fff; }
.stage-a-hero :is(.hero-visual, .hero-art, .hero-image) { width: 100%; min-width: 0; min-height: 0 !important; height: min(24vw, 280px); max-height: 280px; margin: 0; align-self: center; }
.stage-a-hero :is(.hero-visual, .hero-art, .hero-image) img { display: block; width: 100%; height: 100%; max-height: 280px; object-fit: cover; }

@media (max-width: 640px) {
  .stage-a-hero { display: block; min-height: 0 !important; height: auto !important; padding: 0 !important; }
  .stage-a-hero .hero-copy, .stage-a-hero .intro-copy { min-height: 0 !important; padding: 1.1rem 1rem 1.2rem !important; }
  .stage-a-hero h1 { margin-bottom: .55rem !important; font-size: clamp(1.8rem, 8vw, 2.35rem) !important; line-height: 1.18 !important; }
  .stage-a-lede { font-size: .94rem !important; line-height: 1.5 !important; }
  .stage-a-steps { grid-template-columns: 1fr; gap: .12rem; margin-top: .55rem; font-size: .87rem; }
  .stage-a-extras { margin-top: .55rem; font-size: .74rem; }
  .stage-a-cta { min-height: 46px; margin-top: .7rem; padding: .62rem 1rem; }
  .stage-a-hero :is(.hero-visual, .hero-art, .hero-image) { display: none !important; }
  #calculator .section-heading { gap: .45rem !important; margin-bottom: .8rem !important; }
  #calculator .section-heading .eyebrow { display: none !important; }
  #calculator .section-heading h2 { margin: 0 !important; font-size: clamp(1.2rem, 5.5vw, 1.55rem) !important; line-height: 1.25 !important; letter-spacing: 0 !important; }
  #calculator .section-heading p { margin: .35rem 0 0 !important; font-size: .86rem !important; line-height: 1.45 !important; }
  #calculator { padding-top: 1.2rem !important; }
}

/* Stage A desktop top-position adjustment */

@media (min-width: 641px) {
  .stage-a-hero { padding-block: 1.25rem !important; }
  .stage-a-hero .hero-copy { padding-block: 1.25rem !important; }
}
