:root {
  color-scheme: light;
  --ink: #15221d;
  --muted: #66736c;
  --line: #dce3de;
  --surface: #ffffff;
  --canvas: #f4f7f4;
  --green: #0b6b4c;
  --green-dark: #074b37;
  --green-soft: #e7f3ed;
  --lime: #b8e34d;
  --amber: #b96b13;
  --amber-soft: #fff3df;
  --red: #a23b3b;
  --red-soft: #fdeaea;
  --blue: #315d8f;
  --shadow: 0 18px 50px rgba(23, 44, 34, 0.07);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.65; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(11, 107, 76, 0.25); outline-offset: 2px;
}

.topbar {
  position: sticky; top: 0; z-index: 20; height: 76px; padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid rgba(220, 227, 222, 0.9); backdrop-filter: blur(15px);
}
.header-brands { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--green-dark); color: white; font-weight: 800; letter-spacing: -.05em; }
.brand strong, .brand small { display: block; line-height: 1.2; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.producer-logo { display: block; width: 145px; height: auto; padding-left: 18px; border-left: 1px solid var(--line); }
.topbar nav { display: flex; gap: 8px; }
.topbar nav a { padding: 9px 14px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.topbar nav a:hover { background: var(--green-soft); color: var(--green-dark); }

main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 90px; }
.hidden { display: none !important; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: end; gap: 70px; padding: 42px 0 60px; }
.eyebrow { margin: 0 0 15px; color: var(--green); font-size: 12px; font-weight: 900; letter-spacing: .18em; }
.hero h1, .page-heading h1 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(40px, 6vw, 76px); line-height: 1.14; letter-spacing: -.035em; font-weight: 600; }
.hero h1 span { color: var(--green); }
.hero-copy { max-width: 720px; margin: 28px 0 0; color: #4c5c54; font-size: 17px; }
.hero-note { padding: 24px; border: 1px solid rgba(11, 107, 76, .18); border-radius: 18px; background: var(--green-soft); }
.hero-note strong { color: var(--green-dark); font-size: 14px; }
.hero-note p { margin: 8px 0 0; color: #4c6559; font-size: 13px; }

.panel { margin-top: 22px; padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.setup-panel { margin-top: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading > div { display: flex; align-items: center; gap: 13px; min-width: 0; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-heading > p { max-width: 580px; margin: 0; color: var(--muted); font-size: 13px; }
.section-heading .section-guide { margin: 0 0 0 18px; color: var(--muted); font-size: 13px; font-weight: 700; }
.step { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: white; font-size: 11px; font-weight: 900; }
.meta-grid { display: grid; grid-template-columns: 1.4fr .7fr 1fr; gap: 18px; align-items: end; }
label { display: grid; gap: 7px; color: #445249; font-size: 12px; font-weight: 800; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #cdd7d0; border-radius: 10px; background: white; color: var(--ink); }
input::placeholder { color: #9ca7a0; }
input:focus, select:focus { border-color: var(--green); }
.toggle-field { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfb; }
.toggle-field input { width: 18px; min-height: 18px; margin: 0 9px 0 0; accent-color: var(--green); }

.provider-status { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.provider-badge { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 12px; font-weight: 800; }
.provider-badge.ready::before, .provider-badge.missing::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; }
.provider-badge.ready::before { background: #26a268; }
.provider-badge.missing::before { background: var(--amber); }

.company-list { display: grid; gap: 16px; }
.company-card { position: relative; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: #fbfcfb; }
.company-card.target { border: 2px solid rgba(11, 107, 76, .5); background: linear-gradient(135deg, #fbfffd, #f2faf6); }
.company-card.excluded { opacity: .6; }
.company-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.company-role { display: flex; align-items: center; gap: 9px; font-weight: 900; }
.role-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px var(--green-soft); }
.competitor .role-dot { background: #839087; box-shadow: 0 0 0 5px #edf0ee; }
.card-actions { display: flex; gap: 6px; }
.icon-button { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: var(--green); color: var(--green); }
.company-fields { display: grid; grid-template-columns: 1.45fr .55fr .65fr; gap: 12px; }
.official-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 13px; align-items: end; }
.candidate-box { margin-top: 14px; padding: 14px; border-radius: 12px; background: white; border: 1px solid var(--line); }
.candidate-option { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid #edf1ee; }
.candidate-option:last-child { border-bottom: 0; }
.candidate-option input { width: 17px; min-height: 17px; margin-top: 4px; accent-color: var(--green); }
.candidate-option strong, .candidate-option small { display: block; }
.candidate-option small { color: var(--muted); font-weight: 500; word-break: break-all; }
.confidence { color: var(--green); font-size: 11px; font-weight: 900; }

.button { min-height: 44px; padding: 10px 18px; border: 0; border-radius: 10px; font-weight: 900; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; transform: none; }
.button.primary { background: var(--green); color: white; box-shadow: 0 9px 22px rgba(11, 107, 76, .2); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border: 1px solid var(--line); background: white; color: var(--green-dark); }
.button.danger { border: 1px solid #efc2c2; background: var(--red-soft); color: var(--red); }
.button.danger:hover { background: #f9dada; }
.button.small { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.history-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.history-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  line-height: 1;
  text-decoration: none;
}
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 20px 4px; }
.form-actions p { margin: 0; color: var(--muted); font-size: 13px; }
.final-actions { margin-bottom: -8px; border-top: 1px solid var(--line); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.metric { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fafcfb; }
.metric span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.metric strong { display: block; margin-top: 5px; font-size: 25px; line-height: 1.25; }
.preview-company { padding: 20px 0; border-top: 1px solid var(--line); }
.preview-company h3 { margin: 0 0 4px; font-size: 16px; }
.domain { color: var(--muted); font-size: 12px; word-break: break-all; }
.page-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.page-check { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; padding: 10px; border-radius: 10px; background: #f7f9f7; font-size: 12px; }
.page-check input { width: 16px; min-height: 16px; accent-color: var(--green); }
.page-check span { min-width: 0; overflow-wrap: anywhere; }
.doc-type { color: var(--green); font-size: 10px; font-weight: 900; }

.page-heading { padding: 34px 0 22px; }
.page-heading.compact h1 { font-size: clamp(38px, 5vw, 60px); }
.page-heading > p:last-child { color: var(--muted); }
.progress-shell { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: 20px; align-items: start; }
.progress-shell .panel { margin-top: 0; }
.progress-orbit { position: relative; width: 72px; height: 72px; margin-bottom: 20px; border: 2px solid var(--green-soft); border-radius: 50%; }
.progress-orbit::before { content: ""; position: absolute; inset: 8px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin 1.1s linear infinite; }
.progress-orbit span { position: absolute; inset: 27px; border-radius: 50%; background: var(--lime); }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-companies { display: grid; gap: 10px; margin-top: 22px; }
.progress-company { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.progress-company strong, .progress-company small { display: block; }
.progress-company small { color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.status-pill.success { background: var(--green-soft); color: var(--green-dark); }
.status-pill.warning { background: var(--amber-soft); color: var(--amber); }
.status-pill.danger { background: var(--red-soft); color: var(--red); }
.status-pill.neutral { background: #edf1ee; color: #556158; }
.timeline-panel h2 { margin: 0 0 18px; font-size: 18px; }
.timeline { max-height: 540px; margin: 0; padding: 0 0 0 18px; overflow: auto; }
.timeline li { padding: 0 0 16px 11px; color: var(--muted); font-size: 12px; }
.timeline li strong { display: block; color: var(--ink); }

.result-header { display: grid; grid-template-columns: 1fr auto; gap: 30px; align-items: end; padding: 32px 0; }
.result-header h1 { margin: 4px 0 12px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: clamp(36px, 5vw, 62px); line-height: 1.15; font-weight: 600; }
.result-header p { margin: 0; color: var(--muted); }
.result-meta { text-align: right; color: var(--muted); font-size: 12px; }
.result-meta strong { display: block; color: var(--ink); font-size: 14px; }
.notice { margin: 16px 0; padding: 14px 16px; border-radius: 12px; font-size: 13px; }
.notice.warning { background: var(--amber-soft); color: #74430c; border: 1px solid #efd3a2; }
.notice.danger { background: var(--red-soft); color: #762d2d; border: 1px solid #efc2c2; }
.result-tabs { position: sticky; top: 86px; z-index: 10; display: flex; gap: 7px; margin: 12px 0 20px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); overflow-x: auto; }
.result-tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 900; text-decoration: none; white-space: nowrap; }
.result-tabs a:hover { background: var(--green-soft); color: var(--green-dark); }
.result-section { scroll-margin-top: 145px; }
.result-section > h2 { margin: 42px 0 14px; font-size: 23px; }
.result-section > p.section-copy { margin: -8px 0 14px; color: var(--muted); font-size: 13px; }
.score-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 13px; }
.score-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.score-card.target { border: 2px solid var(--green); }
.score-card-head { display: flex; justify-content: space-between; gap: 10px; }
.score-card h3 { margin: 0; font-size: 15px; }
.score-card small { color: var(--muted); }
.score-value { margin-top: 14px; font-size: 38px; line-height: 1; font-weight: 800; }
.score-value span { color: var(--muted); font-size: 13px; }
.coverage-row { display: flex; justify-content: space-between; margin-top: 15px; color: var(--muted); font-size: 11px; }
.bar-track { height: 7px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: #e8ede9; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--green); }
.target .bar-fill { background: linear-gradient(90deg, var(--green), var(--lime)); }
.provider-switch { display: flex; gap: 8px; margin-bottom: 12px; }
.provider-switch button[aria-pressed="true"] { background: var(--green); color: white; border-color: var(--green); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f4f7f4; color: #4b5a51; font-size: 11px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.score-cell { min-width: 150px; }
.score-cell.target-cell { background: #f5fbf8; }
.score-summary { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.score-summary strong { font-size: 18px; }
details p { color: #4f5f56; }
.evidence-list { margin: 8px 0 0; padding-left: 16px; }
.evidence-list a { overflow-wrap: anywhere; }
.position-cell { min-width: 220px; color: var(--muted); }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.insight-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.insight-card h3 { margin: 0 0 12px; font-size: 16px; }
.insight-card ul { margin: 0; padding-left: 18px; }
.insight-card li { margin: 7px 0; color: #4e5c54; font-size: 13px; }
.diff-card { margin-bottom: 12px; }
.diff-scores { display: flex; gap: 18px; margin: 12px 0; font-size: 13px; }
.diff-scores strong { font-size: 20px; }
.conflict { margin-top: 10px; padding: 12px; border-radius: 10px; background: var(--amber-soft); }
.conflict summary { cursor: pointer; font-weight: 800; }
.persona-grid, .improvement-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 13px; }
.persona-card h3, .improvement-card h3 { margin: 0 0 8px; font-size: 15px; }
.persona-card p { color: #4e5c54; font-size: 13px; }
.mini-label { margin-top: 12px; color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.source-list { display: grid; gap: 8px; }
.source-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 12px; }
.source-row a { overflow-wrap: anywhere; }
.empty { padding: 36px; color: var(--muted); text-align: center; }
.history-target { font-weight: 900; }
.site-footer { padding: 24px 20px 30px; border-top: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: center; letter-spacing: .04em; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 14px 17px; border-radius: 12px; background: var(--ink); color: white; box-shadow: 0 18px 40px rgba(0,0,0,.2); font-size: 13px; }
.loading-text::after { content: "…"; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-note { max-width: 520px; }
  .meta-grid, .company-fields { grid-template-columns: 1fr 1fr; }
  .meta-grid > :first-child, .company-fields > :first-child { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .progress-shell, .two-column { grid-template-columns: 1fr; }
  .page-checks { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { height: 66px; padding: 0 14px; }
  .brand-copy { display: none; }
  .header-brands { gap: 10px; }
  .producer-logo { width: 104px; padding-left: 10px; }
  .topbar nav a { padding: 8px; font-size: 12px; }
  main { width: min(100% - 24px, 1240px); padding-top: 25px; }
  .hero { padding-top: 20px; }
  .hero h1 { font-size: 39px; }
  .panel { padding: 20px; border-radius: 16px; }
  .section-heading, .form-actions, .result-header { align-items: flex-start; flex-direction: column; }
  .section-heading { display: flex; }
  .section-heading > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; width: 100%; }
  .section-heading .section-guide { grid-column: 2; width: auto; margin: 4px 0 0; }
  .meta-grid, .company-fields, .official-row, .metric-grid { grid-template-columns: 1fr; }
  .meta-grid > :first-child, .company-fields > :first-child { grid-column: auto; }
  .company-card-head { align-items: flex-start; }
  .result-header { display: flex; }
  .result-meta { text-align: left; }
  .source-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
