:root {
  color-scheme: light;
  --blue-950: #005f3b;
  --blue-800: #008b4d;
  --blue-700: #74b900;
  --blue-100: #e7f4c7;
  --blue-50: #f7fbe9;
  --ink: #142033;
  --muted: #607087;
  --line: #d8e1ec;
  --warning: #b54708;
  --warning-bg: #fff5e8;
  --white: #ffffff;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(126, 190, 0, .16), transparent 28rem),
    linear-gradient(180deg, #fbfdf8 0%, #eff6e7 100%);
}

button, input, select { font: inherit; }

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.official-logo {
  display: block;
  width: min(390px, 72vw);
  height: auto;
}

.topbar h1 {
  margin-left: auto;
  color: var(--blue-950);
  font-size: clamp(1.35rem, 3vw, 2rem);
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--blue-700);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .14em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -.03em; }
h2 { margin-bottom: 5px; font-size: 1.2rem; }

.calculator,
.result-panel {
  border: 1px solid rgba(0, 139, 77, .13);
  border-radius: 24px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 16px 44px rgba(33, 66, 103, .09);
}

.calculator { padding: clamp(22px, 4vw, 36px); }
.result-panel { margin-top: 20px; overflow: hidden; }

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-heading .surgery-notice {
  margin-top: 6px;
  color: var(--warning);
  font-weight: 700;
}

.step-number {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue-800);
  font-weight: 800;
}

.selection-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  margin-top: 28px;
}

.field { display: grid; gap: 9px; }
.field > span { font-size: .94rem; font-weight: 800; }
.field small { color: var(--muted); line-height: 1.5; }

select, input[type="date"] {
  width: 100%;
  min-height: 54px;
  border: 1px solid #b9ccb8;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  padding: 0 46px 0 15px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--blue-800) 50%),
    linear-gradient(135deg, var(--blue-800) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 23px,
    calc(100% - 14px) 23px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

input[type="date"] { padding-right: 15px; }
select optgroup { color: var(--blue-800); font-weight: 800; }
select option { color: var(--ink); font-weight: 500; }

.mobile-picker { display: none; }

select:focus, input:focus {
  border-color: var(--blue-700);
  box-shadow: 0 0 0 4px rgba(126, 190, 0, .16);
}

.direction {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: .75rem;
}
.direction strong { color: var(--blue-700); font-size: 1.9rem; line-height: 1; }

.date-field {
  width: min(360px, 100%);
  margin-top: 24px;
}

.result-heading {
  padding: 25px clamp(22px, 4vw, 36px);
  background: var(--blue-950);
  color: #fff;
}
.result-heading .step-number { color: var(--blue-950); background: #fff; }
.result-heading p { color: #ddf0e5; }

.empty-state {
  display: grid;
  justify-items: center;
  gap: 11px;
  padding: 48px 24px 52px;
  color: var(--muted);
}
.empty-state p { margin-bottom: 0; font-weight: 700; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: var(--blue-700);
  background: var(--blue-100);
  font-size: 28px;
}

.result-content { padding: clamp(22px, 4vw, 36px); }
.result-grid {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 16px;
}
.metric-card {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.metric-card.accent {
  border-color: #c5dfa0;
  background: var(--blue-50);
}
.metric-label { color: var(--muted); font-size: .9rem; font-weight: 800; }
.metric-card strong { color: var(--blue-950); font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -.04em; }
.metric-card.accent strong { color: var(--blue-800); font-size: clamp(1.35rem, 4vw, 2rem); }
#cycleValue.compact-cycle {
  white-space: nowrap;
  font-size: clamp(1.35rem, 3.2vw, 2rem);
  letter-spacing: -.03em;
}
.recommended { color: var(--blue-950); font-size: .92rem; font-weight: 700; }

.warning-box {
  margin-top: 16px;
  padding: 18px 20px;
  border: 1px solid #f0c99d;
  border-left: 5px solid #e77914;
  border-radius: 14px;
  background: var(--warning-bg);
  color: #713600;
}
.warning-title { display: flex; align-items: center; gap: 8px; font-weight: 900; }
.warning-title span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: var(--warning);
}
.warning-box p { margin: 9px 0 0; line-height: 1.7; white-space: pre-line; }

.interval-guidance {
  margin-top: 16px;
  padding: 20px;
  border: 2px solid #e3bb43;
  border-radius: 14px;
  background: #fff9db;
  color: #493d1e;
  line-height: 1.8;
}
.interval-guidance h3 { margin: 0 0 12px; font-size: 1.05rem; }
.interval-guidance p { margin: 0 0 10px; }
.injection-guidance { margin: 16px 0 0; padding: 16px 0 0 1.25em; border-top: 1px solid #e3cf85; }
.injection-guidance li + li { margin-top: 8px; }
.surgery-section { margin-top: 20px; }
.surgery-guide-toggle, .surgery-guide-close {
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--blue-800);
  border-radius: 13px;
  color: var(--blue-950);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.6;
}
.surgery-guide-toggle { width: 100%; text-align: left; }
.surgery-guide-toggle::after { content: "＋"; float: right; margin-left: 12px; }
.surgery-guide-toggle[aria-expanded="true"]::after { content: "−"; }
.surgery-guide-toggle:hover, .surgery-guide-close:hover { background: var(--blue-50); }
.surgery-guide-toggle:focus-visible, .surgery-guide-close:focus-visible {
  outline: 3px solid var(--blue-800);
  outline-offset: 3px;
}
.surgery-guide {
  margin-top: 10px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid #b9ccb8;
  border-radius: 18px;
  background: #fff;
  line-height: 1.8;
}
.surgery-guide h2 { color: var(--blue-950); }
.surgery-guide h2:not(:first-child) { margin-top: 28px; }
.surgery-guide h3 { margin: 22px 0 8px; font-size: 1rem; color: var(--blue-950); }
.surgery-guide ul { padding-left: 1.25em; }
.surgery-guide li + li { margin-top: 10px; }

.selected-route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #f5f7fa;
  color: #44546a;
  font-size: .9rem;
  line-height: 1.5;
}
.selected-route b { color: var(--blue-700); font-size: 1.25rem; }

@media (max-width: 720px) {
  .shell { width: min(100% - 20px, 1080px); padding-top: 20px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .official-logo { width: min(320px, 92vw); }
  .topbar h1 { margin-left: 0; }
  .calculator, .result-panel { border-radius: 18px; }
  .selection-grid { grid-template-columns: 1fr; gap: 12px; }
  .field > select { display: none; }
  .mobile-picker {
    position: relative;
    display: block;
  }
  .mobile-picker-toggle {
    width: 100%;
    min-height: 54px;
    padding: 12px 46px 12px 15px;
    border: 1px solid #b9ccb8;
    border-radius: 13px;
    color: var(--ink);
    background:
      linear-gradient(45deg, transparent 50%, var(--blue-800) 50%) calc(100% - 20px) 23px / 6px 6px no-repeat,
      linear-gradient(135deg, var(--blue-800) 50%, transparent 50%) calc(100% - 14px) 23px / 6px 6px no-repeat,
      #fff;
    text-align: left;
  }
  .mobile-picker-toggle:focus-visible {
    outline: none;
    border-color: var(--blue-700);
    box-shadow: 0 0 0 4px rgba(126, 190, 0, .16);
  }
  .mobile-picker-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    max-height: 58vh;
    overflow-y: auto;
    border: 1px solid #b9ccb8;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(20, 32, 51, .2);
  }
  .mobile-picker-group + .mobile-picker-group {
    border-top: 1px solid #dce8d7;
  }
  .mobile-picker-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px 14px;
    color: #006b42;
    background: #e7f4c7;
    font-size: .9rem;
    font-weight: 900;
  }
  .mobile-picker-option {
    width: 100%;
    padding: 13px 14px;
    border: 0;
    border-top: 1px solid #edf1ec;
    color: var(--ink);
    background: #fff;
    text-align: left;
    line-height: 1.45;
  }
  .mobile-picker-option:active {
    background: var(--blue-50);
  }
  .direction { grid-auto-flow: column; justify-content: center; align-items: center; padding: 0; }
  .direction strong { transform: rotate(90deg); }
  .result-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 122px; }
  .selected-route { grid-template-columns: 1fr; text-align: center; }
  .selected-route b { transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
