:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #647084;
  --border: #d8e0ea;
  --primary: #155eef;
  --primary-hover: #0f4dcc;
  --primary-soft: #eaf1ff;
  --warning: #8a5a00;
  --warning-soft: #fff6d8;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --success: #147a43;
  --success-soft: #e9f8ef;
  --focus: rgba(21, 94, 239, 0.22);
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.7;
}
body.dark {
  --bg: #0f1728;
  --surface: #172235;
  --surface-soft: #111b2c;
  --text: #f3f6fb;
  --muted: #aeb9ca;
  --border: #34445a;
  --primary: #7aaeff;
  --primary-hover: #9ac1ff;
  --primary-soft: #20385f;
  --warning: #ffd37a;
  --warning-soft: #3a311d;
  --danger: #ffaaa2;
  --danger-soft: #3d2023;
  --success: #9fe0b8;
  --success-soft: #183426;
  --focus: rgba(122, 174, 255, 0.25);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

button, textarea { font: inherit; }
button { cursor: pointer; }
code {
  border-radius: 5px;
  background: var(--surface-soft);
  padding: 0.1em 0.35em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92em;
}
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner, .page-shell, .site-footer { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.header-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 28px 0 24px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: 0.86rem; font-weight: 800; }
h1, h2, h3, p, span, strong, li, code { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(1.85rem, 4vw, 2.55rem); line-height: 1.25; }
.lead { max-width: 860px; margin: 10px 0 0; color: var(--muted); }
.page-shell { padding: 28px 0 56px; }
.tool-grid { display: grid; grid-template-columns: minmax(330px, 0.95fr) minmax(0, 1.45fr); gap: 24px; align-items: start; }
.panel, .content-section { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 22px; }
.panel-heading h2, .result-topbar h2, .content-section h2 { margin: 0; line-height: 1.35; }
.panel-heading p, .result-status { margin: 5px 0 0; color: var(--muted); font-size: 0.92rem; }
.input-label { display: block; margin: 18px 0 7px; font-weight: 800; }
textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 14px;
  outline: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  tab-size: 2;
}
textarea:focus, button:focus-visible, summary:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); outline: none; }
.counter-row { min-height: 1.45em; display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 0.82rem; }
.field-error { color: var(--danger); font-weight: 800; }
.input-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.theme-toggle, .primary-button, .secondary-button, .ghost-button, .filter-button {
  min-height: 44px;
  border-radius: 10px;
  padding: 10px 16px;
  border: 1px solid transparent;
  font-weight: 800;
}
.theme-toggle, .ghost-button, .filter-button { background: var(--surface-soft); color: var(--text); border-color: var(--border); }
.primary-button { background: var(--primary); color: #fff; }
body.dark .primary-button { color: #0f1728; }
.primary-button:hover { background: var(--primary-hover); }
.secondary-button { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.scope-box, .important-note { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); padding: 14px; }
.scope-box ul { margin: 8px 0 0; padding-left: 1.25rem; color: var(--muted); font-size: 0.9rem; }
.result-topbar { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.summary-card { min-width: 0; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 11px; padding: 12px; }
.summary-card span { display: block; color: var(--muted); font-size: 0.78rem; }
.summary-card strong { display: block; margin-top: 4px; font-size: 1.28rem; }
.summary-card.warning { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.filter-button { min-height: 38px; padding: 7px 11px; font-size: 0.82rem; }
.filter-button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
body.dark .filter-button.active { color: #0f1728; }
.copy-status { min-height: 1.5em; margin: 10px 0 0; color: var(--success); font-size: 0.9rem; font-weight: 800; }
.copy-status.error { color: var(--danger); }
.result-list { display: grid; gap: 12px; margin-top: 12px; }
.empty-state { border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--muted); padding: 28px 16px; text-align: center; }
.result-item { min-width: 0; border: 1px solid var(--border); border-left: 5px solid var(--warning); border-radius: 12px; background: var(--surface-soft); padding: 14px; }
.result-item.ok { border-left-color: var(--success); }
.result-item h3 { margin: 5px 0 0; font-size: 1rem; }
.result-item p { margin: 6px 0 0; }
.badge { display: inline-flex; border-radius: 999px; padding: 3px 9px; font-size: 0.75rem; font-weight: 800; }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.ok { background: var(--success-soft); color: var(--success); }
.issue-meta { color: var(--muted); font-size: 0.82rem; }
.code-snippet { margin-top: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 9px 10px; white-space: pre-wrap; word-break: break-word; font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.82rem; }
.content-section { margin-top: 28px; padding: 26px; }
.content-section > p { margin: 10px 0 0; color: var(--muted); }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.info-grid article { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.info-grid h3 { margin: 0; font-size: 1rem; }
.info-grid p { margin: 7px 0 0; color: var(--muted); font-size: 0.93rem; }
.important-note p { margin: 5px 0 0; color: var(--muted); font-size: 0.9rem; }
.faq-section details { border-top: 1px solid var(--border); padding: 14px 0; }
.faq-section details:first-of-type { margin-top: 16px; }
.faq-section summary { cursor: pointer; font-weight: 800; }
.faq-section details p { margin: 9px 0 0; color: var(--muted); }
.site-footer { padding: 0 0 28px; color: var(--muted); text-align: center; font-size: 0.86rem; }

@media (max-width: 980px) {
  .tool-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .header-inner, .result-topbar { flex-direction: column; }
  .theme-toggle, .result-topbar .secondary-button { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .header-inner, .page-shell, .site-footer { width: min(100% - 22px, 1240px); }
  .panel, .content-section { padding: 18px; }
  .input-actions { display: grid; grid-template-columns: 1fr; }
  .input-actions button { width: 100%; }
  .info-grid { grid-template-columns: 1fr; }
  .counter-row { flex-direction: column; }
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-button { width: 100%; }
}
