:root {
  --canvas: #faf6f1;
  --surface: #ffffff;
  --ink: #0e0e0f;
  --text: #0e0e0f;
  --body: #52545a;
  --muted: #5c5e63;
  --border: #dfddd8;
  --blue: #176cb7;
  --accent: #ff3c00;
  --accent-hover: #ec4e02;
  --ok: #269448;
  --ok-soft: #eef8ef;
  --warning: #e69300;
  --warning-soft: #fff8ea;
  --danger: #c7392f;
  --danger-soft: #fff1ef;
  --info: #2d6da4;
  --info-soft: #eef5fb;
  --radius: 4px;
  --font: YakuHanJP, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--canvas);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: inherit;
}

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

button:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(255, 60, 0, 0.3);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  color: #000;
  background: #fff;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.brand-header {
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
}

.brand-header__inner {
  display: grid;
  grid-template-columns: 320px 1fr 440px;
  gap: 28px;
  align-items: center;
  width: min(1260px, calc(100% - 32px));
  min-height: 118px;
  margin: 0 auto;
}

.brand-header__logo {
  display: block;
}

.brand-header__logo img {
  display: block;
  width: 100%;
  height: auto;
}

.brand-header__message {
  display: grid;
  font-size: 13px;
  line-height: 1.5;
}

.brand-header__message strong {
  font-size: 15px;
}

.brand-header__actions {
  text-align: right;
}

.brand-header__actions p,
.brand-header__actions small {
  display: block;
  margin: 0;
  font-size: 13px;
}

.brand-header__actions > div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 8px 0 4px;
}

.brand-header__actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  color: #fff;
  background: var(--blue);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.brand-nav {
  background: #8a0002;
  border-top: 1px solid #ececec;
  color: white;
}

.brand-nav__inner {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
}

.brand-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 6px;
  color: #ffffff;
  border-left: 1px solid #ececec;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}

.brand-nav a:last-child {
  border-right: 1px solid #ececec;
}

.brand-nav a:hover,
.brand-nav a:focus-visible {
  color: #fff;
  background: #700002;
}

.page-shell {
  width: min(1200px, calc(100% - 40px));
  margin-inline: auto;
}

.tool-content-shell {
  width: min(1100px, calc(100% - 48px));
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 24px 0 4px;
  color: var(--body);
  font-size: 14px;
}

.breadcrumb a {
  text-decoration: none;
}

.first-view-head {
  display: block;
}

.hero {
  padding: 14px 0 10px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 3.5vw, 34px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-align: center;
}

.hero-copy {
  margin-top: 24px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
}

.hero-copy p {
  margin: 0;
}

.usage-limits {
  width: min(500px, 100%);
  margin: 26px auto 34px;
  padding: 12px 18px;
  border: 1px solid #ffc9c0;
  background-color: #fffde7;
  text-align: center;
}

.usage-limits h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

.usage-limits ul {
  display: grid;
  gap: 1px;
  padding: 0;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  list-style: none;
}

.usage-limits li::before {
  content: none;
}

.diagnosis-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0;
}

.field {
  padding: 30px 44px;
  background: var(--surface);
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(12, 12, 13, 0.1);
}

.field label {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 0 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid #bdbab7;
  border-radius: 3px;
}

.field input:disabled {
  color: #898c94;
  background: #f8f8f8;
}

.form-privacy {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.form-privacy svg {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.turnstile-container:empty {
  display: none;
}

.form-actions > button {
  width: min(430px, 100%);
  min-height: 54px;
  color: #fff;
  background: #ef201d;
  border: 0;
  border-radius: 3px;
  font-weight: 700;
}

.form-actions > button:disabled {
  opacity: 1;
  background: #9d9995;
  cursor: not-allowed;
}

.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.form-status[data-state="success"] {
  margin-top: 4px;
  color: #ef201d;
  font-size: 26px;
  font-weight: 700;
}

.form-status[data-state="success"]::after {
  display: block;
  content: "↓";
  margin-top: 4px;
  color: var(--text);
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

.result-section {
  padding-top: 34px;
}

.section-heading-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 18px;
}

.section-heading-row h2,
.panel h3 {
  margin: 0;
}

.section-heading-row h2 {
  font-size: 27px;
}

.section-heading-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  padding: 24px 82px;
  background: #fffde7;
  border: 1px solid #f1e6bb;
  border-radius: 5px;
}

.summary-card {
  display: grid;
  place-content: center;
  min-width: 0;
  min-height: 78px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  text-align: center;
}

.summary-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 3px;
}

.summary-icon svg {
  width: 28px;
  height: 28px;
}

.summary-icon--ok {
  color: var(--ok);
  background: var(--ok-soft);
}

.summary-icon--warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.summary-icon--danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.summary-icon--info,
.summary-icon--unknown {
  color: var(--info);
  background: var(--info-soft);
}

.summary-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.summary-card p {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 700;
}

.status--ok {
  color: var(--ok);
  background: var(--ok-soft);
}

.status--warning {
  color: #a76500;
  background: var(--warning-soft);
}

.status--danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.status--info,
.status--unknown {
  color: var(--info);
  background: var(--info-soft);
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  margin-top: 28px;
}

.result-side {
  display: grid;
  align-content: start;
  gap: 20px;
}

.panel {
  padding: 28px;
  background: var(--surface);
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(12, 12, 13, 0.08);
}

.panel h3 {
  font-size: 24px;
}

.result-main-panel {
  display: grid;
}

.result-block {
  min-width: 0;
  padding-bottom: 44px;
}

.result-block + .result-block {
  padding-top: 44px;
  border-top: 1px solid #ececec;
}

.result-block:last-child {
  padding-bottom: 0;
}

.panel-note {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.body-copy {
  max-height: 380px;
  margin: 12px 0;
  padding: 16px;
  overflow: auto;
  color: #28282a;
  background: #fcfcfc;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: 14px/1.7 var(--font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.heading-outline h3 {
  margin-bottom: 14px;
}

.heading-outline ol {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.heading-outline li {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  padding: 5px 10px;
  background: #f0efed;
  border-radius: 2px;
  color: var(--body);
  font-size: 13px;
}

.heading-outline li span {
  color: var(--text);
  font-weight: 700;
}

.copy-button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  margin-top: 12px;
  padding: 7px 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--text);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.copy-button svg {
  width: 18px;
  height: 18px;
}

.rule-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.rule {
  border: 1px solid var(--border);
  border-radius: 3px;
}

.rule--danger,
.rule--warning {
  border-color: #efc882;
  background: var(--warning-soft);
}

.rule summary {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}

.rule summary::-webkit-details-marker {
  display: none;
}

.rule-mark {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: var(--warning);
  border: 2px solid currentColor;
  border-radius: 2px;
  font-weight: 800;
}

.rule > div {
  padding: 0 12px 12px 42px;
  color: var(--body);
  font-size: 13px;
}

.rule > div p {
  margin: 5px 0;
}

.rule code {
  color: var(--muted);
}

.fact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 17px;
  margin: 18px 0 0;
}

.fact-grid div {
  min-width: 0;
  padding: 0;
  text-align: left;
}

.fact-grid dt {
  color: var(--muted);
  font-size: 13px;
}

.fact-grid dd {
  margin: 2px 0 0;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.panel-title-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.panel-title-row span {
  color: var(--muted);
  font-size: 13px;
}

.structured-panel ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.structured-panel li {
  display: inline-flex;
  gap: 10px;
  padding: 5px 9px;
  background: var(--ok-soft);
  border-radius: 2px;
  font-size: 13px;
}

.structured-panel li span:last-child {
  color: var(--ok);
  font-weight: 700;
}

.scope-note {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  margin-top: 16px;
  padding: 17px 22px;
  color: #503619;
  background: #fff7ee;
  border: 1px solid #f4c88f;
  border-radius: 3px;
}

.scope-note svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.scope-note h3,
.scope-note p {
  margin: 0;
}

.scope-note h3 {
  font-size: 16px;
}

.scope-note p {
  font-size: 13px;
}

.json-export {
  min-height: 320px;
  margin-top: 28px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 1px 4px rgba(12, 12, 13, 0.08);
}

.json-export h3 {
  margin: 0;
  font-size: 24px;
}

.json-export pre {
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  background: #f6f6f6;
  border-radius: 2px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-empty {
  margin-top: 28px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.preview-empty h2,
.preview-empty p {
  margin: 0;
}

.preview-empty p {
  margin-top: 8px;
  color: var(--body);
}

.preview-empty[hidden] {
  display: none;
}

footer {
  padding-block: 35px;
  background: #fff;
  border-top: 1px solid var(--border);
}

footer .page-shell {
  display: flex;
  align-items: center;
  gap: 24px;
}

footer img {
  width: 230px;
  height: auto;
}

footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1000px) {
  .brand-header__inner {
    grid-template-columns: 260px 1fr;
    min-height: 96px;
  }

  .brand-header__message {
    display: none;
  }

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

  .brand-nav a {
    border-bottom: 1px solid #ececec;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    padding-inline: 50px;
  }

  .result-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 24px, 1200px);
  }

  .tool-content-shell {
    width: min(100% - 28px, 1100px);
  }

  .brand-header__inner {
    grid-template-columns: 1fr;
    gap: 8px;
    width: calc(100% - 24px);
    min-height: auto;
    padding: 14px 0;
  }

  .brand-header__logo {
    width: 250px;
  }

  .brand-header__actions {
    text-align: left;
  }

  .brand-header__actions p,
  .brand-header__actions small {
    display: none;
  }

  .brand-header__actions > div {
    justify-content: flex-start;
    margin: 0;
  }

  .brand-header__actions a {
    min-height: 44px;
    font-size: 13px;
  }

  .brand-nav__inner {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .brand-nav a {
    flex: 0 0 auto;
    min-width: 132px;
    padding-inline: 12px;
  }

  .breadcrumb {
    gap: 8px;
    padding-top: 15px;
    font-size: 13px;
  }

  .hero {
    padding-top: 18px;
  }

  .first-view-head {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .usage-limits {
    margin: 0 0 18px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .field {
    padding: 22px 20px;
  }

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

  .form-status {
    text-align: left;
  }

  .form-status[data-state="success"] {
    text-align: center;
  }

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

  .summary-card {
    min-height: auto;
  }

  .result-layout {
    display: block;
  }

  .result-side {
    margin-top: 14px;
  }

  .scope-note {
    grid-template-columns: 28px 1fr;
    padding: 16px;
  }

  .scope-note svg {
    width: 26px;
    height: 26px;
  }

  footer .page-shell {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

@media (max-width: 420px) {
  .brand-header__actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .brand-header__actions a {
    padding-inline: 8px;
    line-height: 1.35;
    text-align: center;
  }
}

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