:root {
    color-scheme: light;
    --primary: #6550a0;
    --primary-dark: #513d88;
    --text: #25232a;
    --muted: #6c6872;
    --border: #d9d6de;
    --background: #f5f5f7;
    --surface: #fff;
    --success: #24724f;
    --success-bg: #e5f4eb;
    --warning: #875514;
    --warning-bg: #fff1d8;
    --danger: #a13840;
    --danger-bg: #fbe8e9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--background); }
button, input { font: inherit; }
a { color: var(--primary-dark); }
[hidden] { display: none !important; }

.container { width: min(760px, calc(100% - 32px)); margin-inline: auto; }
.navbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.navbar-content, .footer-content { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.navbar a { font-size: 14px; text-decoration: none; }
.navbar-brand { color: var(--text) !important; font-size: 16px !important; font-weight: 650; }

main { padding-block: 48px 56px; }
.intro { margin-bottom: 24px; }
h1 { margin: 0 0 8px; font-size: clamp(26px, 5vw, 34px); line-height: 1.25; }
.intro p { margin: 0; color: var(--muted); line-height: 1.7; }

.card { margin-bottom: 20px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 8px rgb(0 0 0 / 4%); }
.card-header { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-header h2 { margin: 0; font-size: 19px; }
.card-header > span { color: var(--muted); font-size: 13px; }

.drop-zone { min-height: 180px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; background: #faf9fc; border: 2px dashed #bbb5c7; border-radius: 6px; cursor: pointer; }
.drop-zone:hover, .drop-zone:focus-within, .drop-zone.is-dragging { background: #f2eef9; border-color: var(--primary); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { font-size: 16px; }
.drop-zone span { color: var(--muted); font-size: 13px; }

.selected-file { margin-top: 16px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #f5f2fa; border-radius: 6px; }
.selected-file div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.selected-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file span { color: var(--muted); font-size: 12px; }
.button-primary { flex: 0 0 auto; padding: 9px 16px; color: #fff; background: var(--primary); border: 1px solid var(--primary); border-radius: 5px; cursor: pointer; }
.button-primary:hover { background: var(--primary-dark); }
.button-primary:disabled { opacity: .6; cursor: wait; }
.button-secondary { padding: 9px 16px; color: var(--primary-dark); background: var(--surface); border: 1px solid var(--primary); border-radius: 5px; cursor: pointer; }
.button-secondary:hover { color: #fff; background: var(--primary); }

.alert { margin-top: 16px; padding: 13px 15px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 5px; font-size: 14px; }
.alert-info { color: var(--primary-dark); background: #f2eef9; border-color: #d7ccea; }
.alert-error { color: var(--danger); background: var(--danger-bg); border-color: #edc6c9; }
.spinner { width: 18px; height: 18px; border: 2px solid #c9bfdc; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { scroll-margin-top: 20px; }
.result-state, .support-badge { display: inline-block; padding: 3px 8px; border-radius: 999px; color: var(--success); background: var(--success-bg); font-size: 12px; font-weight: 650; }
.result-state[data-state="failed"], .support-badge[data-support="unavailable"], .support-badge[data-support="unknown"] { color: var(--danger); background: var(--danger-bg); }
.support-badge[data-support="experimental"], .support-badge[data-support="compatibilityLayer"] { color: var(--warning); background: var(--warning-bg); }
.result-summary { margin: 0; border-top: 1px solid var(--border); }
.result-summary > div { padding: 14px 0; display: grid; grid-template-columns: 130px 1fr; gap: 16px; border-bottom: 1px solid var(--border); }
.result-summary dt, .shiori-details dt { color: var(--muted); font-size: 13px; }
.result-summary dd { margin: 0; font-weight: 650; }
.support-badge { margin-left: 6px; vertical-align: 1px; }
.shiori-details { margin: 16px 0 0; display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; }
.shiori-details dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.summary-text { margin: 18px 0 0; font-size: 14px; }
.result-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.diagnostics-block { margin-top: 20px; border-top: 1px solid var(--border); }
.diagnostics-block summary { padding: 16px 0; cursor: pointer; font-weight: 650; }
.diagnostics-block summary span { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.diagnostic-row, .diagnostic-empty { padding: 12px 0; border-top: 1px solid var(--border); }
.diagnostic-row { display: flex; gap: 10px; }
.diagnostic-mark { width: 21px; height: 21px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; }
.diagnostic-row[data-severity="error"] .diagnostic-mark { color: var(--danger); background: var(--danger-bg); }
.diagnostic-row[data-severity="warning"] .diagnostic-mark { color: var(--warning); background: var(--warning-bg); }
.diagnostic-row div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.diagnostic-row strong { font-size: 13px; }
.diagnostic-row div span { color: var(--muted); font: 11px ui-monospace, monospace; overflow-wrap: anywhere; }
.diagnostic-empty { color: var(--success); font-size: 13px; }
.result-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.request-id { margin: 18px 0 0; color: var(--muted); font: 10px ui-monospace, monospace; }
.file-note { margin: 0; color: var(--muted); text-align: center; font-size: 12px; }

.api-docs { margin-top: 52px; }
.api-docs h2 { margin: 0 0 10px; font-size: 24px; }
.api-docs h3 { margin: 28px 0 8px; font-size: 15px; }
.api-docs p { margin: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.api-docs code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.api-docs :not(pre) > code { padding: 2px 5px; color: var(--text); background: #ebe9ee; border-radius: 4px; font-size: .9em; }
.api-docs pre { margin: 12px 0; padding: 16px; overflow-x: auto; color: #eeeaf5; background: #29262f; border-radius: 6px; font-size: 12px; line-height: 1.6; }

.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.footer-content nav { display: flex; gap: 18px; }
.license-page h1 { font-size: 28px; }
.license-page h2 { margin: 32px 0 10px; font-size: 18px; }
.license-page pre { padding: 16px; overflow: auto; white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; font: 11px/1.55 ui-monospace, monospace; }

@media (max-width: 560px) {
    main { padding-block: 32px 40px; }
    .card { padding: 18px; }
    .card-header { align-items: baseline; }
    .drop-zone { min-height: 160px; padding: 20px 12px; }
    .selected-file { align-items: stretch; flex-direction: column; }
    .button-primary { width: 100%; }
    .button-secondary { width: 100%; }
    .result-summary > div, .shiori-details { grid-template-columns: 90px 1fr; }
    .api-docs { margin-top: 40px; }
    .footer-content { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; padding-block: 16px; }
}

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