html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

.account-theme-control {
    margin: 0;
    padding: 8px 10px 6px;
    border: 0;
}

.theme-picker-label {
    margin: 0 0 8px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.theme-picker {
    display: flex;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    padding: 4px;
    box-sizing: border-box;
    border: 1px solid #d7e3ef;
    border-radius: 12px;
    background: #eef4f8;
}

.theme-picker .theme-choice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    min-height: 36px;
    margin: 0;
    padding: 7px 5px;
    gap: 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #52657e;
    font: 600 11px/1.3 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.theme-picker .theme-choice[data-theme-choice="system"] { flex-grow: 1.4; }
.theme-picker .theme-choice svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.theme-picker .theme-choice:hover { color: #174e73; background: #e0edf6; }
.theme-picker .theme-choice[aria-pressed="true"] {
    color: #17628e;
    background: #fff;
    box-shadow: 0 1px 5px rgba(15, 23, 42, .10);
}
.theme-picker .theme-choice:focus-visible { outline: 2px solid #2572a4; outline-offset: 2px; }

.auth-theme-control {
    position: absolute;
    top: 18px;
    right: clamp(16px, 4vw, 64px);
    z-index: 20;
    width: min(290px, calc(100% - 32px));
}
body:has(> .auth-theme-control) > .login-wrapper { padding-top: max(82px, 7vh); }

html[data-theme="dark"] .account-theme-control { border-color: #2c3d55; }
html[data-theme="dark"] .theme-picker-label { color: #a6b5ca; }
html[data-theme="dark"] .theme-picker { background: #0b1627; border-color: #2c3d55; }
html[data-theme="dark"] .theme-picker .theme-choice { color: #a6b5ca; }
html[data-theme="dark"] .theme-picker .theme-choice:hover { background: #1d3048; color: #e8f0fa; }
html[data-theme="dark"] .theme-picker .theme-choice[aria-pressed="true"] {
    background: #243b53;
    color: #c9eaff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .25);
}
html[data-theme="dark"] .theme-picker .theme-choice:focus-visible { outline-color: #83c9f4; }

/* Account preferences: compact theme segments, then one row per action. */
.account-menu .account-dropdown {
    width: min(336px, calc(100vw - 40px));
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
    padding: 6px;
    border-radius: 16px;
}
.account-dropdown .account-dropdown-header {
    margin: 0 4px 6px;
    padding: 12px 6px 14px;
    border-bottom: 1px solid #e2e8f0;
}
.account-dropdown .theme-picker-label {
    margin-bottom: 7px;
    font-size: 10px !important;
    line-height: 1.4;
    font-weight: 650;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.account-dropdown .theme-picker {
    padding: 3px;
    border-radius: 10px;
}
.account-dropdown .theme-picker .theme-choice {
    min-height: 36px;
    padding: 7px 6px;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 7px;
}
.account-dropdown .theme-picker .theme-choice[data-theme-choice="system"] { flex-grow: 1; }
.account-dropdown .theme-picker .theme-choice svg { width: 15px; height: 15px; flex-basis: 15px; }
.account-dropdown .account-dropdown-item {
    min-height: 44px;
    padding: 10px;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}
.account-dropdown .account-dropdown-item img { width: 19px; height: 19px; flex-basis: 19px; }
.account-dropdown .account-action-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.account-dropdown .account-notification-sound { margin-top: 1px; }
.account-dropdown .account-notification-sound-copy { flex-direction: row; align-items: center; }
.account-dropdown .account-notification-sound-switch {
    width: 36px;
    height: 22px;
    flex-basis: 36px;
}
.account-dropdown .account-notification-sound-switch::after { width: 16px; height: 16px; }
.account-dropdown .account-dropdown-separator { margin: 7px 4px; }
.account-dropdown .account-dropdown-item:focus-visible { outline: 2px solid #2572a4; outline-offset: -2px; }
html[data-theme="dark"] .account-menu .account-dropdown[data-account-dropdown] {
    background: #0f1726;
    border-color: #24324a;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .account-menu .account-dropdown .account-dropdown-header { border-color: #24324a; }
html[data-theme="dark"] .account-menu .account-dropdown .theme-picker-label { color: #9aacbf; }
html[data-theme="dark"] .account-menu .account-dropdown .theme-picker { background: #0a1220; border-color: #24324a; }
html[data-theme="dark"] .account-menu .account-dropdown .theme-picker .theme-choice { color: #a6b5ca; }
html[data-theme="dark"] .account-menu .account-dropdown .theme-picker .theme-choice[aria-pressed="true"] {
    background: #1e2b42;
    border-color: #2e4059;
    color: #e8f0fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
html[data-theme="dark"] .account-menu .account-dropdown .account-dropdown-item { color: #dce5f3; }
html[data-theme="dark"] .account-menu .account-dropdown .account-dropdown-item:hover { background: #1b2b40; color: #e8f0fa; }
html[data-theme="dark"] .account-menu .account-dropdown .account-dropdown-item:focus-visible { outline-color: #83c9f4; }
html[data-theme="dark"] .account-menu .account-dropdown .account-dropdown-separator { background: #24324a; }
html[data-theme="dark"] .account-menu .account-dropdown .account-notification-sound-switch { background: #29354b; }
html[data-theme="dark"] .account-menu .account-dropdown .account-notification-sound[aria-checked="true"] .account-notification-sound-switch {
    background: #168657;
}

@media (max-width: 750px) {
    .account-menu .account-dropdown { max-height: calc(100dvh - 150px); }
}

@media (max-width: 480px) {
    .auth-theme-control { top: 12px; right: 16px; }
    .auth-theme-control .theme-picker .theme-choice { min-height: 38px; }
    body:has(> .auth-theme-control) > .login-wrapper { padding-top: 82px; }
}
@media (prefers-reduced-motion: reduce) {
    .theme-picker .theme-choice { transition: none; }
}
