:root {
    color-scheme: light;
    --page: #f1f5f9; --surface: #fff; --muted-surface: #f8fafc; --input: #fff;
    --text: #15243b; --muted: #52647b; --line: #cbd5e1; --soft-line: #e2e8f0;
    --blue: #075ce5; --blue-hover: #064bb9; --blue-soft: #edf4ff; --blue-text: #164fa1;
    --success: #167247; --error: #b42318; --error-bg: #fff1f0; --focus: #2563eb;
    --shadow: 0 8px 28px #142f5010;
}
.dark {
    color-scheme: dark;
    --page: #0c1726; --surface: #112338; --muted-surface: #162c42; --input: #0d1c2e;
    --text: #edf4ff; --muted: #b3c5da; --line: #486079; --soft-line: #30465e;
    --blue: #1668f5; --blue-hover: #0d58d5; --blue-soft: #193653; --blue-text: #9ac5ff;
    --success: #6be6a5; --error: #ffb4ad; --error-bg: #41242b; --focus: #80b9ff;
    --shadow: 0 8px 28px #0002;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--text); font-family: 'Noto Sans JP', Inter, sans-serif; font-size: 14px; line-height: 1.65; }
button, input, select { font: inherit; }
button, summary, select, input[type=checkbox], input[type=range] { cursor: pointer; }
button { color: inherit; }
button:disabled { opacity: .5; cursor: not-allowed; }
a { color: var(--blue-text); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button, select, input:not([type=checkbox]):not([type=range]) { min-height: 44px; }
input:not([type=checkbox]):not([type=range]), select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); color: var(--text); }
input[type=checkbox] { width: 21px; height: 21px; flex: 0 0 21px; accent-color: var(--blue); }
input[type=range] { width: 100%; min-height: 32px; margin: 4px 0 0; accent-color: var(--blue); }
input:disabled { opacity: .5; }
input[aria-invalid=true] { border-color: var(--error) !important; box-shadow: 0 0 0 1px var(--error); }
h1,h2,h3,p { margin: 0; }
h1 { font-size: 27px; font-weight: 700; letter-spacing: -.04em; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
label { font-weight: 500; }
.app-shell { max-width: 1256px; margin: 32px auto; padding: 0 24px; }
.app-frame { background: var(--surface); border: 1px solid var(--soft-line); border-radius: 18px; box-shadow: var(--shadow); }
.app-header { padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--soft-line); }
.brand { display: flex; align-items: center; gap: 24px; }
.brand a { font-size: 13px; padding: 10px 0; }
.theme-options { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--muted-surface); }
.theme-options button { padding: 6px 13px; border: 0; border-radius: 6px; background: transparent; font-size: 13px; min-height: 36px; }
.theme-options button[aria-pressed=true] { background: var(--blue); color: #fff; }
.workspace { padding: 24px; display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); grid-template-rows: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-panel { grid-column: 1; grid-row: 1 / span 2; min-width: 0; }
.results-panel { grid-column: 2; grid-row: 1; min-width: 0; }
.batch-panel { grid-column: 2; grid-row: 2; }
.panel { border: 1px solid var(--line); border-radius: 12px; padding: 20px; background: var(--surface); }
.settings-tabs { display: flex; gap: 6px; margin-bottom: -1px; }
.settings-tabs button { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px 9px 0 0; background: var(--muted-surface); font-weight: 700; }
.settings-tabs button[aria-selected=true] { color: #fff; background: var(--blue); border-color: var(--blue); }
.settings-fields { border: 1px solid var(--line); border-radius: 0 0 12px 12px; padding: 20px; }
.help { font-size: 13px; line-height: 1.8; color: var(--muted); }
.mode-help { margin-bottom: 16px; }
.field-block + .field-block { margin-top: 20px; }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; }
.preset-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.preset-heading .field-label { margin: 0; }
.preset-status { color: var(--blue-text); font-size: 12px; font-weight: 500; }
.preset-context { margin-top: 6px; }
.preset-context > summary { font-size: 13px; color: var(--muted); padding: 9px 0; min-height: 40px; }
#preset-note, #preset-sources { overflow-wrap: anywhere; }
#preset-sources a { display: inline-block; padding: 8px; }
.text-button { border: 0; background: transparent; color: var(--blue-text); padding: 8px 0; text-decoration: underline; font-size: 13px; }
.length-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.length-heading label { font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 5px; }
.stepper input { width: 64px !important; text-align: center; padding: 8px 3px !important; font-weight: 700; }
.stepper button { width: 44px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue-text); background: var(--blue-soft); font-size: 22px; }
.range-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.disclosure { border: 1px solid var(--line); border-radius: 10px; background: var(--muted-surface); margin-top: 16px; }
.disclosure > summary { min-height: 48px; padding: 12px 14px; font-weight: 700; }
.disclosure[open] > summary { border-bottom: 1px solid var(--soft-line); }
.disclosure-body { padding: 14px; }
.type-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.type-table th { font-weight: 500; font-size: 12px; color: var(--muted); text-align: left; padding: 5px 0; }
.type-table th:last-child { text-align: right; }
.type-table td { border-top: 1px solid var(--soft-line); padding: 5px 0; }
.type-table td:last-child { width: 90px; text-align: right; }
.type-table label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.type-table input[type=number] { width: 64px; text-align: center; display: inline-block; padding: 8px 4px; }
.minimum-total { font-size: 13px; font-weight: 700; margin-top: 8px; }
.check-label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 0; }
.stack-field + .stack-field { margin-top: 16px; }
.stack-field label:not(.check-label) { display: block; margin-bottom: 6px; }
.stack-field .help { margin-top: 6px; }
.mode-warning { color: var(--error); }
.settings-management { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--soft-line); }
.management-actions { display: flex; gap: 24px; flex-wrap: wrap; }
.condition-summary { background: var(--muted-surface); border: 1px solid var(--soft-line); border-radius: 9px; padding: 12px 14px; overflow-wrap: anywhere; }
.condition-summary p + p { margin-top: 3px; }
.simple-summary { margin-top: 16px; }
.result-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 14px; }
#strength-text { font-size: 12px; color: var(--muted); }
.password-value { font: 600 24px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; word-break: break-all; padding: 17px; background: var(--muted-surface); border: 1px solid var(--line); border-radius: 9px; user-select: all; }
.result-status { margin-top: 9px; font-size: 13px; color: var(--success); }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; padding: 11px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--blue-text); font-weight: 700; min-height: 46px; }
.button:hover:not(:disabled) { background: var(--blue-soft); }
.button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--blue-hover); }
.icon { width: 19px; height: 19px; flex-shrink: 0; }
.reading-details { margin-top: 8px; }
.reading-details > summary { color: var(--blue-text); font-size: 13px; min-height: 44px; padding: 10px 0; }
.reading-text { display: block; width: 100%; text-align: left; white-space: normal; overflow-wrap: anywhere; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--muted-surface); font-size: 13px; line-height: 1.9; }
.reading-copy-label { display: block; color: var(--blue-text); margin-top: 6px; font-weight: 500; }
.candidates { border: 0; border-top: 1px solid var(--soft-line); border-radius: 0; background: transparent; margin-top: 8px; }
.candidates > summary { padding: 13px 0; }
.candidates[open] > summary { border: 0; }
#password-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#password-list.long-passwords { grid-template-columns: 1fr; }
.candidate { min-width: 0; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--muted-surface); }
.password-text { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 46px; padding: 8px 0; border: 0; background: transparent; color: var(--text); text-align: left; font: 500 15px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
.password-text span { overflow-wrap: anywhere; word-break: break-all; }
.candidate .reading-details { margin: 0; border-top: 1px solid var(--soft-line); }
.candidate .reading-details summary { min-height: 32px; padding: 4px 0; font-size: 13px; }
.candidate .reading-text { margin-bottom: 8px; }
.result-summary { margin-top: 12px; }
.batch-panel { margin-top: 0; }
.batch-panel > summary { padding: 16px 18px; }
.batch-options { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.batch-count { display: flex; align-items: center; gap: 8px; }
.batch-count input { width: 76px !important; }
.condition-error { margin-top: 10px; padding: 12px; border: 1px solid var(--error); border-radius: 8px; background: var(--error-bg); color: var(--error); font-size: 13px; overflow-wrap: anywhere; }
.field-error { margin-top: 8px; color: var(--error); font-size: 13px; }
.error-link { color: inherit; font-weight: 700; }
.ad-section { margin: 28px 0 20px; display: flex; justify-content: center; align-items: center; }
.ad-section a, .ad-section a img { max-width: 100%; height: auto; }
.app-footer { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 20px; }
.app-footer p + p { margin-top: 10px; }
.return-dock { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.return-dock .button { min-height: 44px; border-radius: 24px; padding: 8px 18px; }
#copy-feedback { position: fixed; z-index: 20; bottom: calc(86px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 9px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; width: max-content; max-width: calc(100vw - 32px); }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 30; padding: 12px; background: var(--surface); }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 880px) {
    .return-dock { display: none; }
    .mobile-only { display: none; }
    .workspace[data-mode=simple] .advanced-only { display: none; }
    .workspace[data-mode=simple] .type-table td:last-child { width: 0; }
    .workspace[data-mode=simple] .type-table,
    .workspace[data-mode=simple] .type-table tbody { display: block; }
    .workspace[data-mode=simple] .type-table thead { display: none; }
    .workspace[data-mode=simple] .type-table tbody { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
    .workspace[data-mode=simple] .type-table tr,
    .workspace[data-mode=simple] .type-table td { display: block; border: 0; }
    .workspace[data-mode=simple] .type-table small { display: none; }
}
@media (max-width: 879px) {
    .app-shell { margin: 0 auto; padding: 0 12px 90px; max-width: 640px; }
    .app-frame { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
    .app-header { padding: 16px 0; border: 0; gap: 8px; }
    h1 { font-size: 22px; }
    .brand a { display: none; }
    .theme-options button { padding: 5px 10px; min-height: 44px; font-size: 12px; }
    .workspace { display: flex; flex-direction: column; padding: 0; gap: 16px; }
    .workspace > * { width: 100%; }
    .settings-tabs, .mode-help, .simple-summary { display: none; }
    .settings-fields { padding: 16px; border-radius: 12px; background: var(--surface); }
    .panel { padding: 16px; }
    .result-heading { margin-bottom: 12px; }
    .password-value { font-size: 21px; padding: 12px; }
    .result-actions { grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
    .result-actions .button { min-height: 46px; padding: 9px; }
    .result-summary { margin-top: 8px; }
    .candidates { margin-top: 0; }
    .type-table td:last-child { width: 85px; }
    #password-list { grid-template-columns: 1fr; }
    .password-text { font-size: 15px; }
    .candidate .reading-details summary { min-height: 44px; padding: 10px 0; }
    .preset-heading { display: block; }
    .preset-status { display: block; margin-top: 4px; }
    .stepper { gap: 4px; }
    .stepper input { width: 58px !important; }
    .length-heading { flex-wrap: wrap; }
    .settings-management { margin-top: 16px; }
    .batch-panel { background: var(--surface); }
    .app-footer { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
