/* Shared theme controls and light palette. Dark mode keeps the original styles. */
.theme-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    white-space: nowrap;
}
.theme-button {
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid #656975;
    background: #17191f;
    color: #fff;
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}
.theme-button[aria-pressed="true"] {
    background: #b51c2b;
    border-color: #b51c2b;
    color: #fff;
}
.theme-button:focus-visible { outline: 2px solid #1597c5; outline-offset: 2px; }
.theme-button:disabled { opacity: 0.6; cursor: wait; }
.theme-status:not(:empty) {
    position: absolute;
    top: 100%;
    right: 0;
    max-width: 280px;
    white-space: normal;
    padding: 8px;
    background: #fff;
    color: #a01826;
    border: 1px solid #a01826;
    font-size: 12px;
}
.header-navigation, .header-right, .header-user { flex-wrap: wrap; }
@media (max-width: 900px) {
    .header, .site-header { flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
    .header-navigation, .header-right, .header-user { gap: 10px; }
}

html[data-theme="light"] {
    color-scheme: light;
    --background: #fff;
    --surface: #fff;
    --surface-light: #f2f4f7;
    --surface-hover: #e7edf4;
    --border: #c8cdd5;
    --border-light: #a4acb8;
    --text-main: #17191d;
    --text-sub: #454d59;
    --text-dark: #525c69;
    --accent: #b51c2b;
    --accent-light: #a01826;
    --danger: #b51c2b;
    --shadow: 0 6px 20px rgba(30, 40, 60, 0.08);
}
html[data-theme="light"] body {
    background: #fff;
    color: #17191d;
}
html[data-theme="light"] .background-decoration { opacity: 0.2; }
html[data-theme="light"] :is(.header, .site-header, .character-fixed-footer) {
    background: #fff;
    color: #17191d;
    border-color: #c8cdd5;
    box-shadow: 0 2px 12px rgba(30,40,60,0.08);
}
html[data-theme="light"] :is(.logo, .brand, .brand-text, .logo-text,
    .logo > span:last-child, .page-title, .menu-title, .header a, .site-header nav a,
    .character-view-value, .view-skill-command-source) { color: #17191d; }
html[data-theme="light"] :is(.header-version, .page-subtitle, .menu-description,
    .menu-arrow, .footer, .logout-link, .font-size-label) { color: #525c69; }
html[data-theme="light"] :is(.menu-button, .menu-character, .login-wrapper,
    .character-filter, .character-card, .sheet-section, .ninpo-card,
    .ninpo-search-item, .character-background-card, .tool-card,
    .demon-weapon-card, .prize-card, .view-skill-command-panel,
    .view-skill-command-item, .ougi-attachment-selected-card) {
    background: #fff;
    color: #17191d;
}
html[data-theme="light"] :is(.ninpo-drawer, .ninpo-drawer-header,
    .ninpo-drawer-search, .delete-dialog-panel, .character-type-dialog-panel,
    .empty-ninpo-slot-dialog, .ninpo-effect-dialog, .ninpo-effect-modal,
    .ninpo-effect-modal-content, dialog) {
    background: #fff;
    color: #17191d;
    border-color: #a4acb8;
}
html[data-theme="light"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select, textarea) {
    background: #fff;
    color: #17191d;
    border-color: #a4acb8;
}
html[data-theme="light"] :is(input, textarea)::placeholder { color: #66717e; opacity: 1; }
html[data-theme="light"] :is(input, select, textarea):disabled {
    background: #edf0f4;
    color: #525c69;
}
html[data-theme="light"] :is(.skill-table th, .sheet-table th,
    .skill-name-cell, .skill-select-label, .ninpo-card-info,
    .character-image-preview, .character-image-wrap, .character-image-placeholder,
    .ninpo-card-effect, .character-open-switch) {
    background: #f2f4f7;
    color: #17191d;
}
html[data-theme="light"] :is(.skill-gap-cell, .skill-gap-header) { background: #e5e9ef; }
html[data-theme="light"] .skill-gap-cell.is-selected { background: #bdc8d8; }
html[data-theme="light"] .skill-select-label:has(input:checked),
html[data-theme="light"] .skill-select-label.is-character-view-selected {
    background: #c9ddf0;
    color: #101820;
}
html[data-theme="light"] .skill-name-cell.is-distribution-visible {
    background: rgba(36, 107, 161, var(--skill-distribution-opacity));
}
html[data-theme="light"] :is(.secondary-button, .font-size-button,
    .theme-button:not([aria-pressed="true"]), .browse-button,
    .view-button, .delete-button, .delete-dialog-cancel,
    .character-type-option, .ninpo-drawer-close-button) {
    background: #f2f4f7;
    color: #17191d;
    border-color: #a4acb8;
}
html[data-theme="light"] .font-size-button.is-selected {
    background: #b51c2b;
    color: #fff;
}
html[data-theme="light"] :is(.character-meta span, .ninpo-type-badge,
    .ninpo-card-religion, .ninpo-card-category, .ougi-attachment-type) {
    color: #253342;
}
html[data-theme="light"] :is(.ninpo-card-rank, .ninpo-rank-restriction,
    .ninpo-card-info.is-rank-restricted) { color: #755000; background: #fff3c9; }
html[data-theme="light"] :is(.view-skill-command-copy, .ccfolia-export-button) {
    background: #fff;
    color: #006080;
    border-color: #007b9f;
}
html[data-theme="light"] .view-skill-command-item.is-best-target {
    background: #e0f3fb;
    border-color: #007b9f;
    box-shadow: inset 3px 0 0 #007b9f;
}
html[data-theme="light"] .view-skill-command-item.is-best-target code { color: #17191d; }
html[data-theme="light"] :is(.character-view-notice, .character-view-password-panel) {
    background: #f2f6e9;
    color: #344b15;
}
html[data-theme="light"] :is(.is-success, .character-view-check.is-selected) { color: #346300; }
html[data-theme="light"] :is(.is-error, .dialog-error, .delete-error) { color: #a01826; }

html[data-theme="light"] .login-card {
    background: #fff;
    border-color: #c8cdd5;
    box-shadow: var(--shadow);
}
html[data-theme="light"] :is(.login-title, .form-label) { color: #17191d; }
html[data-theme="light"] .login-subtitle { color: #525c69; }
html[data-theme="light"] :is(.ninpo-search-item-religion, .ninpo-search-item-type,
    .ninpo-search-add-button, .ninpo-card-toggle-button.is-active) { color: #253342; }
html[data-theme="light"] .has-rank-restriction {
    color: #755000;
    background: #fff3c9;
}
html[data-theme="light"] .skill-group-checkbox { accent-color: #246ba1; }

/* 人物・奥義・シナリオに共通する表のセルもライトテーマに合わせる。 */
html[data-theme="light"] .sheet-table td {
    background: var(--surface);
    color: var(--text-main);
}
html[data-theme="light"] .sheet-table tbody tr:hover td {
    background: var(--surface-light);
}
