body.owner-locked > :not(#owner-gate):not(script):not(style) { display: none !important; }
#owner-gate[hidden] { display: none; }
#owner-gate {
    --owner-ink: #10364c;
    --owner-muted: #345c6d;
    position: fixed; inset: 0; z-index: 2147483647;
    display: grid; place-items: center; overflow: auto; overscroll-behavior: contain;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: #f7f7f2; color: var(--owner-ink); text-align: center;
}
#owner-gate .owner-welcome {
    box-sizing: border-box; position: relative; isolation: isolate;
    display: flex; flex-direction: column; align-items: center;
    width: min(100%, 480px); height: 100%; min-height: 640px; max-height: 960px;
    padding: clamp(28px, 6dvh, 56px) 20px clamp(64px, 9dvh, 88px);
    border: 1px solid #fff; border-radius: 24px;
    background: #bce8eb url('../assets/owner-login/japan-memories.webp') center / cover no-repeat;
    box-shadow: 0 8px 32px #31596b12;
}
#owner-gate .owner-welcome-heading { width: 100%; }
#owner-gate .owner-welcome-mark { display: block; margin: 0 auto 12px; width: 54px; height: 54px; opacity: .85; }
#owner-gate .owner-welcome-eyebrow { margin: 0 0 6px; font-size: 6px; font-weight: 700; line-height: 1.5; letter-spacing: .38em; padding-left: .38em; }
#owner-gate h1 { margin: 0; font-size: clamp(21px, calc(7vw - 4px), 28px); font-weight: 900; line-height: 1.4; letter-spacing: .015em; }
#owner-gate .owner-welcome-tagline { margin: 8px 0 0; font-size: 10px; font-weight: 500; line-height: 1.5; }
#owner-gate .owner-login-card {
    box-sizing: border-box; width: 100%; margin-top: auto; padding: 20px 18px 16px;
    border: 1px solid #fff; border-radius: 24px;
    background: #edfafdE8; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    box-shadow: 0 8px 24px #31596b15;
}
#owner-gate h2 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.4; }
#owner-gate [role="status"] { min-height: 21px; margin: 6px 0 16px; font-size: 10px; line-height: 1.5; color: var(--owner-muted); overflow-wrap: anywhere; }
#owner-gate button {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; min-height: 48px; padding: 10px 12px;
    border: 1px solid #fff; border-radius: 999px; background: #fff;
    color: var(--owner-ink); font: inherit; font-size: 13px; font-weight: 500; line-height: 1.4;
    box-shadow: 0 6px 18px #31596b12; cursor: pointer;
}
#owner-gate button img { flex: 0 0 24px; }
#owner-gate button:hover:not(:disabled) { background: #f5fcff; }
#owner-gate button:disabled { opacity: .65; cursor: wait; }
#owner-gate .owner-login-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0 0; font-size: 8px; line-height: 1.5; color: var(--owner-muted); }
#owner-gate .owner-welcome-footer { margin: 32px 0 0; padding: 2px 6px; border-radius: 4px; background: #eaf9f4d9; font-size: 7px; font-weight: 500; line-height: 1.5; color: var(--owner-muted); }
@media (max-width: 359px) {
    #owner-gate .owner-welcome { padding-inline: 14px; }
    #owner-gate .owner-welcome-tagline { font-size: 8px; }
    #owner-gate .owner-login-card { padding-inline: 12px; }
}
/* Short screens scroll the welcome surface instead of clipping the login or error text. */
@media (max-height: 639px) {
    #owner-gate { place-items: start center; }
    #owner-gate .owner-welcome { height: auto; min-height: 616px; padding-top: 28px; padding-bottom: 32px; }
    #owner-gate .owner-login-card { margin-top: 200px; }
}
#owner-gate button:focus-visible, #owner-account button:focus-visible { outline: 3px solid #147d9b; outline-offset: 2px; }
/* Account actions live inside the existing settings dialog, never over the map tools. */
#owner-account { position: static; display: block; }
#ai-settings-content .account-settings-body { color: #29343b; font-size: 13px; min-height: 0; }
#ai-settings-content h3 { font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.account-identity { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.account-avatar { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; background: #e6f0ff; color: #2760a7; font-size: 20px; }
.account-identity-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-identity-copy strong { font-size: 14px; font-weight: 600; }
.account-identity-copy > span { color: #647180; font-size: 11px; overflow-wrap: anywhere; }
.account-private { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; padding: 4px 7px; border-radius: 12px; background: #eef3f8; color: #546b80; white-space: nowrap; font-size: 10px; }
.account-settings-details { border-top: 1px solid #e8ecf0; }
.account-settings-details summary { display: flex; align-items: center; gap: 12px; min-height: 56px; cursor: pointer; list-style: none; }
.account-settings-details summary::-webkit-details-marker { display: none; }
.account-settings-details summary > .ph:first-child { font-size: 22px; color: #536b80; }
.account-settings-details summary > span { display: flex; flex: 1; flex-direction: column; gap: 3px; }
.account-settings-details summary strong { font-size: 13px; font-weight: 600; }
.account-settings-details summary span span { font-size: 11px; color: #647180; }
.account-settings-details summary > .ph:last-child { font-size: 14px; color: #81909d; transition: transform .16s; }
.account-settings-details[open] summary > .ph:last-child { transform: rotate(90deg); }
.account-detail-body { padding: 0 0 12px 34px; color: #647180; font-size: 11px; line-height: 1.65; }
.account-detail-body p { margin: 0 0 6px; }
.account-detail-body button { min-height: 44px; padding: 6px 10px; border-radius: 8px; background: #edf3fc; color: #2458a2; font-size: 12px; }
.account-api-settings { border-top: 1px solid #e8ecf0; margin-top: 2px; padding-top: 16px; }
.account-api-settings label { display: block; margin-bottom: 6px; font-size: 12px; color: #536170; }
#ai-settings-content #ai-worker-url { min-height: 44px; font-size: 12px; font-weight: 400; }
#ai-settings-content #account-api-note { margin: 8px 0 12px; color: #7b8591; font-size: 10px; line-height: 1.6; }
.account-save-api { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 12px; background: #2563eb; color: white; font-size: 13px; font-weight: 600; }
.account-reset-api { display: block; min-height: 44px; margin: 0 auto; padding: 6px 12px; font-size: 11px; color: #677484; }
#account-settings-feedback { font-size: 11px; line-height: 1.6; color: #315e8a; }
#account-settings-feedback:empty { display: none; }
.account-logout { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; margin-top: 12px; padding: 12px 0 0; border-top: 1px solid #e8ecf0; color: #e65743; text-align: left; }
.account-logout > .ph { font-size: 23px; }
.account-logout > span { display: flex; flex-direction: column; gap: 3px; }
.account-logout strong { font-size: 13px; font-weight: 500; }
.account-logout small { font-size: 10px; color: #7b8591; }
#ai-settings-content .account-settings-close { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
#ai-settings-content :is(button,input,summary):focus-visible { outline: 2px solid #2477bc; outline-offset: 2px; }
#ai-settings-content button:disabled { opacity: .5; cursor: wait; }
#ai-settings-content [hidden] { display: none !important; }
@media(max-width:359px) { .account-identity { flex-wrap: wrap; } .account-private { margin-left: 52px; } }
@media(prefers-reduced-motion:reduce) { .account-settings-details summary > .ph:last-child { transition: none; } }
