:root {
  --ink: #191b19;
  --paper: #f5f2eb;
  --white: #fffefa;
  --green: #0f4c3a;
  --green-dark: #0a382b;
  --green-soft: #dce9e3;
  --gold: #b8821e;
  --wine: #8d2635;
  --line: #d8d1c5;
  --muted: #686c67;
  --danger: #a12a31;
  --shadow: 0 24px 70px rgba(25, 27, 25, 0.09);
  color-scheme: light;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(15, 76, 58, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 76, 58, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  color: var(--ink);
  line-height: 1.7;
}

button,
input,
select {
  font: inherit;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(184, 130, 30, 0.55);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: var(--white);
  transform: translateY(-160%);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0;
  border-bottom: 1px solid rgba(25, 27, 25, 0.16);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: Georgia, serif;
  letter-spacing: 0;
}

.lab-label {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

main,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 72px;
  align-items: center;
  min-height: 540px;
  padding: 70px 0 54px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: clamp(3rem, 7vw, 6.4rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1.02;
}

.hero-lead {
  max-width: 660px;
  margin: 28px 0 24px;
  color: #464a46;
  font-size: clamp(1rem, 1.5vw, 1.14rem);
}

.privacy-note {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #bad0c6;
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.68);
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2d9972;
  box-shadow: 0 0 0 5px rgba(45, 153, 114, 0.13);
}

.hero-visual {
  position: relative;
  min-height: 340px;
  padding: 44px;
  overflow: hidden;
  border-radius: 10px 80px 10px 10px;
  background: var(--green);
  box-shadow: var(--shadow);
}

.hero-visual::before,
.hero-visual::after {
  position: absolute;
  content: "";
}

.hero-visual::before {
  inset: 0;
  opacity: 0.14;
  background:
    linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 30px 30px;
}

.hero-visual::after {
  right: -70px;
  bottom: -100px;
  width: 250px;
  height: 250px;
  border: 55px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.hero-visual > p {
  position: absolute;
  z-index: 2;
  right: 32px;
  bottom: 18px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.truck-outline {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 82%;
  height: 55%;
  transform: translate(-50%, -50%);
}

.truck-cargo {
  position: absolute;
  inset: 0 22% 18% 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 12px;
  border: 3px solid rgba(255,255,255,.84);
}

.truck-cargo span {
  border: 1px solid rgba(255,255,255,.64);
  background: rgba(255,255,255,.13);
}

.truck-cab {
  position: absolute;
  right: 0;
  bottom: 18%;
  width: 24%;
  height: 62%;
  border: 3px solid rgba(255,255,255,.84);
  border-left: 0;
  border-radius: 0 18px 4px 0;
}

.wheel {
  position: absolute;
  bottom: 4%;
  width: 34px;
  height: 34px;
  border: 8px solid rgba(255,255,255,.9);
  border-radius: 50%;
}

.wheel-one { left: 15%; }
.wheel-two { right: 12%; }

.workflow {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  margin: 0 0 42px;
  padding: 22px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 254, 250, 0.72);
}

.workflow-step {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 9px;
  align-items: baseline;
  color: #7c807b;
}

.workflow-step span {
  grid-row: span 2;
  font-family: Georgia, serif;
  font-size: 1.7rem;
}

.workflow-step strong { font-size: 0.86rem; }
.workflow-step small { font-size: 0.67rem; }
.workflow-step.active { color: var(--green); }
.workflow-line { height: 1px; margin: 0 20px; background: var(--line); }

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  gap: 24px;
  align-items: start;
  padding-bottom: 72px;
}

.input-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 16px 45px rgba(25, 27, 25, 0.055);
}

.input-panel { padding: 30px; }
.result-panel { padding: 30px; }

.panel-heading,
.section-title-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
}

.panel-heading h2,
.section-title-row h3,
.notice-section h2 {
  margin: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.panel-heading h2 { font-size: 2rem; }
.text-button {
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 24px;
}

.preset-row > span {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.preset-row button,
.result-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 0.73rem;
  font-weight: 700;
}

.preset-row button { padding: 7px 11px; }
.preset-row button:hover,
.result-actions button:hover { border-color: var(--green); color: var(--green); }

.preset-caution {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.error-summary {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid #e6a7aa;
  border-left: 5px solid var(--danger);
  background: #fff2f2;
  color: #711c22;
  font-size: 0.82rem;
}

.error-summary ul { margin: 6px 0 0; padding-left: 20px; }
.error-summary a { color: inherit; }

fieldset {
  min-width: 0;
  margin: 28px 0 0;
  padding: 0;
  border: 0;
}

legend {
  width: 100%;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  font-weight: 800;
}

legend span {
  display: inline-grid;
  width: 25px;
  height: 25px;
  margin-right: 8px;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: white;
  font-family: Georgia, serif;
}

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

.field-grid label { display: grid; gap: 6px; }
.field-grid label > span { font-size: 0.76rem; font-weight: 800; }
.field-grid label small { color: var(--muted); font-weight: 500; }
.span-two { grid-column: span 2; }

input[type="number"],
select {
  width: 100%;
  border: 1px solid #c8c4ba;
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--ink);
}

input[type="number"] {
  min-height: 48px;
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

input[aria-invalid="true"] { border-color: var(--danger); background: #fff6f6; }

.toggle-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 26px 0 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f5;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-control {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #a7aaa5;
  transition: background .2s ease;
}

.toggle-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform .2s ease;
}

.toggle-row input:checked + .toggle-control { background: var(--green); }
.toggle-row input:checked + .toggle-control::after { transform: translateX(18px); }
.toggle-row input:focus-visible + .toggle-control { outline: 3px solid rgba(184,130,30,.55); outline-offset: 3px; }
.toggle-row strong,
.toggle-row small { display: block; }
.toggle-row strong { font-size: 0.8rem; }
.toggle-row small { color: var(--muted); font-size: 0.68rem; }

.calculate-button {
  width: 100%;
  min-height: 54px;
  padding: 12px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.calculate-button:hover { background: var(--green-dark); }

.result-heading { align-items: center; }
.result-status {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.7rem;
  font-weight: 800;
}

.capacity-alert {
  margin-top: 20px;
  padding: 14px;
  border-left: 4px solid var(--danger);
  background: #fff2f2;
  color: #711c22;
  font-size: 0.82rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 26px 0 30px;
}

.metric {
  display: flex;
  min-height: 132px;
  padding: 16px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f5;
}

.metric-primary { border-color: var(--green); background: var(--green); color: white; }
.metric > span { font-size: 0.7rem; font-weight: 800; }
.metric > strong {
  margin: auto 0 0;
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 500;
  line-height: 1;
}
.metric > .metric-word { font-family: inherit; font-size: 1.1rem; font-weight: 800; }
.metric > small { margin-top: 5px; color: inherit; font-size: 0.66rem; opacity: .75; }

.utilization-section,
.layout-section {
  margin-top: 22px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-title-row h3 { font-size: 1.35rem; }
.section-title-row > span { color: var(--muted); font-size: 0.68rem; }

.utilization-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.utilization-grid article { padding: 15px; border-radius: 9px; background: #f7f5ef; }
.utilization-grid article > div:first-child { display: flex; justify-content: space-between; font-size: 0.8rem; }
.bar { height: 6px; margin-top: 12px; overflow: hidden; border-radius: 99px; background: #dedbd2; }
.bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .35s ease; }

.layout-selector {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.67rem;
}

.layout-selector select { min-width: 120px; padding: 6px 28px 6px 9px; color: var(--ink); font-size: 0.76rem; }

.cargo-caption {
  display: flex;
  justify-content: space-between;
  margin: 18px 4px 7px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
}

.cargo-viewport {
  min-width: 0;
  max-width: 100%;
  padding: 18px;
  overflow: auto;
  border-radius: 12px;
  background: #26342f;
}

.cargo-floor {
  position: relative;
  width: 100%;
  min-width: 420px;
  max-height: 310px;
  border: 2px solid rgba(255,255,255,.85);
  background:
    linear-gradient(rgba(255,255,255,.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.065) 1px, transparent 1px),
    #18231f;
  background-size: 20px 20px;
}

.pallet {
  position: absolute;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid #f4c766;
  background: rgba(184, 130, 30, 0.58);
  color: white;
  font-size: clamp(0.48rem, 1vw, 0.72rem);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}

.pallet-rotated { border-color: #8cd4b7; background: rgba(45, 153, 114, 0.62); }

.layout-legend { display: flex; gap: 18px; margin-top: 10px; color: var(--muted); font-size: 0.68rem; }
.layout-legend span { display: inline-flex; gap: 6px; align-items: center; }
.layout-legend i { width: 12px; height: 12px; border: 2px solid #b8821e; background: rgba(184,130,30,.45); }
.layout-legend .legend-rotated { border-color: #2d9972; background: rgba(45,153,114,.45); }

.basis {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf9f5;
}

.basis summary { padding: 13px 16px; font-size: 0.8rem; font-weight: 800; cursor: pointer; }
.basis dl { display: grid; grid-template-columns: 100px 1fr; margin: 0; padding: 0 16px 16px; font-size: 0.73rem; }
.basis dt,
.basis dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--line); }
.basis dt { font-weight: 800; }
.basis dd { color: #545853; }

.result-actions { display: flex; gap: 10px; margin-top: 18px; }
.result-actions button { padding: 10px 15px; }
.copy-status { min-height: 1.4em; margin: 6px 0 0; color: var(--green); font-size: 0.7rem; }

.notice-section {
  display: grid;
  grid-template-columns: .7fr 1.3fr;
  gap: 60px;
  margin-bottom: 70px;
  padding: 42px;
  border-radius: 16px;
  background: var(--ink);
  color: white;
}

.notice-section .eyebrow { color: #d5ad5e; }
.notice-section h2 { font-size: 2rem; }
.notice-copy p { margin: 0 0 12px; color: rgba(255,255,255,.75); font-size: 0.86rem; }

footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 0 36px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .08em;
}

[hidden] { display: none !important; }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-top: 54px; }
  .hero-visual { min-height: 300px; }
  .workspace { grid-template-columns: 1fr; }
  .workflow { overflow-x: auto; }
  .workflow-step { min-width: max-content; }
}

@media (max-width: 680px) {
  .site-header,
  main,
  footer { width: min(100% - 24px, 1180px); }
  .site-header { padding: 14px 0; }
  .brand { font-size: .7rem; letter-spacing: .08em; }
  .brand-mark { width: 34px; height: 34px; }
  .lab-label { display: none; }
  .hero { min-height: 0; padding: 46px 0 36px; }
  .hero h1 { font-size: clamp(3rem, 16vw, 4.5rem); }
  .hero-visual { min-height: 230px; padding: 24px; border-radius: 8px 45px 8px 8px; }
  .workflow { margin-bottom: 16px; padding: 16px; }
  .workflow-line { min-width: 30px; margin: 0 10px; }
  .input-panel,
  .result-panel { padding: 20px; border-radius: 12px; }
  .field-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 120px; }
  .utilization-grid { grid-template-columns: 1fr; }
  .section-title-row { align-items: flex-end; }
  .section-title-row > span { display: none; }
  .cargo-viewport { padding: 12px; }
  .basis dl { grid-template-columns: 1fr; }
  .basis dt { padding-bottom: 0; }
  .basis dd { padding-top: 2px; border-top: 0; }
  .notice-section { grid-template-columns: 1fr; gap: 20px; padding: 28px 22px; }
  footer { flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  @page { margin: 12mm; }
  body { background: white; color: black; }
  .site-header,
  .hero,
  .workflow,
  .input-panel,
  .result-actions,
  .copy-status,
  .notice-section,
  footer { display: none !important; }
  main { width: 100%; }
  .workspace { display: block; padding: 0; }
  .result-panel { border: 0; box-shadow: none; padding: 0; }
  .cargo-viewport { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .basis { break-inside: avoid; }
}
