:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f7f7f8;
  --red-soft: #fff5f6;
  --text: #20242a;
  --muted: #667085;
  --line: #d9dee7;
  --line-strong: #b8c0cc;
  --red: #bc002d;
  --red-dark: #920021;
  --focus: rgba(188, 0, 45, 0.22);
  --radius: 8px;
  --page-x: 40px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
li,
span,
strong {
  overflow-wrap: anywhere;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -44px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
}

.skip-link:focus {
  top: 12px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 10px var(--page-x);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: grid;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.topnav {
  display: flex;
  gap: 4px;
}

.topnav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border-radius: 6px;
  color: #414b5a;
  font-size: 13px;
  font-weight: 780;
  text-decoration: none;
}

.topnav a:hover {
  background: var(--red-soft);
  color: var(--red);
}

button:focus-visible,
a:focus-visible,
select:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.workspace {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px var(--page-x) 48px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(280px, 0.34fr) minmax(420px, 0.66fr);
  gap: 24px;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
}

h1 {
  max-width: 16ch;
  margin: 0;
  color: var(--text);
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: 0;
}

.intro > p {
  margin: 0;
  color: #4f5a68;
  font-size: 16px;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: clip;
}

.control-panel {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--soft);
}

.results-panel {
  padding: 18px;
}

.segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}

.segment button,
#copyButton {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 820;
}

.segment button.is-active,
#copyButton {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

#copyButton:hover {
  background: var(--red-dark);
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span {
  color: #303947;
  font-size: 12px;
  font-weight: 820;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

.notice {
  margin-top: 18px;
  padding: 13px;
  border: 1px solid #e9b8c3;
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
  background: var(--red-soft);
}

.notice strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.notice p {
  margin: 6px 0 0;
  color: #4f5a68;
  font-size: 12px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
}

.result-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 850;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.summary-cell {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.summary-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.summary-cell strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.action-plan {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid #e9b8c3;
  border-radius: var(--radius);
  background: var(--red-soft);
}

.plan-head h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.plan-head p {
  margin: 0;
  color: #4f5a68;
  font-size: 13px;
}

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

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 5px 10px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.steps li::before {
  content: counter(step);
  grid-row: 1 / span 3;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 850;
}

.steps strong {
  grid-column: 2;
  color: var(--text);
  font-size: 14px;
}

.steps span,
.steps small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.steps small {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--soft);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.detail-panel {
  min-height: 190px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.detail-panel h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.detail-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.section-band {
  padding: 58px var(--page-x);
  border-top: 1px solid var(--line);
  background: #fff;
}

.section-head {
  max-width: 840px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.15;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.source-grid,
.limit-list {
  display: grid;
  gap: 12px;
  max-width: var(--max);
}

.source-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.limit-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.source-card,
.limit-list article {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-decoration: none;
}

.source-card:hover {
  border-color: var(--red);
}

.source-card span {
  color: var(--red);
  font-size: 12px;
  font-weight: 820;
}

.source-card strong,
.limit-list strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
}

.source-card small,
.limit-list span {
  color: var(--muted);
  font-size: 13px;
}

.limits {
  background: var(--soft);
}

.site-footer {
  padding: 22px var(--page-x);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 1000px) {
  .intro,
  .tool-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    max-width: none;
    font-size: 34px;
  }
}

@media (max-width: 720px) {
  :root {
    --page-x: 14px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    width: 100%;
    overflow-x: auto;
  }

  h1 {
    max-width: none;
    font-size: 28px;
  }

  .workspace,
  .section-band {
    padding-top: 34px;
    padding-bottom: 38px;
  }

  .summary-grid,
  .detail-grid,
  .source-grid,
  .limit-list {
    grid-template-columns: 1fr;
  }

  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  #copyButton {
    width: 100%;
  }

  .steps li {
    grid-template-columns: 32px minmax(0, 1fr);
  }
}
