body #recovery-panel{position:fixed;margin:auto;width:min(440px,92vw);max-height:88dvh;box-sizing:border-box;overflow:auto;border:1px solid var(--ui-panel-recovery-recovery-panel-border);border-radius:16px;padding:18px;background:var(--ui-panel-recovery-recovery-panel-background);color:var(--ui-panel-recovery-recovery-panel-text);box-shadow:0 12px 60px var(--ui-panel-recovery-recovery-panel-shadow)}
#recovery-panel::backdrop{background:var(--ui-panel-recovery-recovery-panel-background-2)}
#recovery-panel h2{font-size:18px;margin:0}
#recovery-panel p{font-size:13px;line-height:1.6}
#recovery-panel .recovery-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
#recovery-panel button{min-height:42px;font-size:13px;padding:8px 12px}
body:not(.desktop-ui) #recovery-panel button{min-height:44px}
#recovery-code,#recovery-input{width:100%;box-sizing:border-box;font-family:ui-monospace,monospace;font-size:16px;line-height:1.6;padding:10px;margin:8px 0;border:1px solid var(--ui-panel-recovery-recovery-code-recovery-input-border);border-radius:8px;background:var(--ui-panel-recovery-recovery-code-recovery-input-background);color:var(--ui-panel-recovery-recovery-code-recovery-input-text);user-select:text;-webkit-user-select:text}
#recovery-code{height:84px;resize:none;word-break:break-all}
#recovery-status{min-height:1.5em;color:var(--ui-panel-recovery-recovery-status-text);margin-bottom:0}
#recovery-import{display:block;margin:12px auto 0;font-size:12px;min-height:40px}
body #login-panel{position:fixed;margin:auto;width:min(440px,92vw);max-height:88dvh;box-sizing:border-box;overflow:auto;border:1px solid var(--ui-panel-recovery-login-panel-border);border-radius:16px;padding:18px;background:var(--ui-panel-recovery-login-panel-background);color:var(--ui-panel-recovery-login-panel-text);box-shadow:0 12px 60px var(--ui-panel-recovery-login-panel-shadow);font-size:var(--readable-font-size,15px);overflow-wrap:anywhere}
#login-panel::backdrop{background:var(--ui-panel-recovery-login-panel-background-2)}
#login-panel h2{font-size:calc(var(--readable-font-size,15px)*1.2);margin:0;min-width:0}
#login-panel p{font-size:inherit;line-height:1.5}
#login-panel .panel-heading{gap:8px;flex-wrap:wrap}
#login-panel button{min-height:44px;min-width:0;max-width:100%;font-size:inherit;padding:8px 12px;white-space:normal;overflow-wrap:anywhere}
#login-panel form{display:grid;gap:10px;min-width:0}
#login-panel label{display:grid;gap:5px;min-width:0;font-size:inherit}
#login-panel input{width:100%;min-width:0;min-height:44px;box-sizing:border-box;font-size:max(16px,var(--readable-font-size,15px));padding:10px;border:1px solid var(--ui-panel-recovery-login-panel-border-2);border-radius:8px;background:var(--ui-panel-recovery-login-panel-background-3);color:var(--ui-panel-recovery-login-panel-text-2);user-select:text;-webkit-user-select:text}
#login-status{min-height:1.5em;color:var(--ui-panel-recovery-login-status-text);margin-bottom:0}
@media (orientation:landscape) and (max-height:500px){
 body #login-panel{max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;touch-action:pan-y;padding:12px 18px}
 #login-panel p{margin:8px 0;line-height:1.4}
 #login-panel form{gap:8px}
}
/* A218: one native dialog for consent and text-only legal documents. */
body #legal-panel{position:fixed;inset:0;margin:auto;width:min(600px,94vw);max-height:90dvh;box-sizing:border-box;overflow:auto;padding:20px;border:1px solid var(--ui-panel-recovery-legal-panel-border);border-radius:16px;background:var(--ui-panel-recovery-legal-panel-background);color:var(--ui-panel-recovery-legal-panel-text);box-shadow:0 12px 60px var(--ui-panel-recovery-legal-panel-shadow);font-size:var(--readable-font-size,15px);line-height:1.6;overflow-wrap:anywhere;overscroll-behavior:contain}
#legal-panel::backdrop{background:var(--ui-panel-recovery-legal-panel-background-2)}
body #legal-panel .panel-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
body #legal-panel h2{font-size:calc(var(--readable-font-size,15px)*1.2);line-height:1.4;margin:0;min-width:0}
body #legal-panel h3,body #legal-panel h4{font-size:inherit;line-height:1.5;margin:18px 0 6px}
body #legal-panel p,body #legal-panel li,body #legal-panel label{font-size:inherit;line-height:1.6}
body #legal-panel button{position:static;min-height:44px;max-width:100%;min-width:0;white-space:normal;font-size:inherit;line-height:1.5;padding:8px 12px;touch-action:manipulation}
#legal-close{flex:none}
#legal-choice{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:16px 0}
#legal-form{display:grid;gap:14px;margin-top:18px}
#legal-form[hidden],#legal-choice[hidden],#legal-reading[hidden]{display:none!important}
#legal-panel .legal-check{display:flex;align-items:flex-start;gap:10px;min-height:44px}
#legal-agree{flex:none;width:22px;height:22px;margin:3px 0;accent-color:var(--ui-panel-recovery-legal-agree-accent-color);touch-action:manipulation}
#legal-continue{width:100%}
#legal-version{font-size:12px!important;opacity:.85}
#legal-reader{max-height:55dvh;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;user-select:text;-webkit-user-select:text;padding:4px 12px 12px 4px;outline-offset:-2px}
#legal-reader>p:first-child{color:var(--ui-panel-recovery-legal-reader-text);font-weight:700}
#legal-reader ul,#legal-reader ol{padding-left:24px}
#legal-back{margin-top:14px}
#legal-status{min-height:1.6em;color:var(--ui-panel-recovery-legal-status-text);margin-bottom:0}
@media(max-height:500px){body #legal-panel{max-height:94dvh;padding:12px 18px}#legal-reader{max-height:45dvh}#legal-choice{margin:8px 0}#legal-form{margin-top:10px;gap:8px}#legal-help{margin:8px 0}}
/* A303: landscape reading uses a shared header row for back and close. */
@media(orientation:landscape) and (max-height:500px){
 html body #legal-panel[open]:has(#legal-reading:not([hidden])){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;max-height:calc(100dvh - 24px);padding:12px 18px;overflow:hidden}
 html body #legal-panel:has(#legal-reading:not([hidden]))>.panel-heading{grid-column:1;grid-row:1;min-height:44px}
 html body #legal-reading:not([hidden]){display:contents}
 html body #legal-reader{grid-column:1/-1;grid-row:3;height:calc(100dvh - 132px);min-height:55dvh;max-height:none;scrollbar-gutter:stable}
 html body #legal-back{grid-column:2;grid-row:1;margin:0;align-self:center;z-index:3}
 html body #legal-version{grid-column:1/-1;grid-row:2;margin:0}
 html body #legal-panel:has(#legal-reading:not([hidden]))>#legal-status{grid-column:1/-1;grid-row:4;margin:0;min-height:0}
 html body #legal-panel:has(#legal-reading:not([hidden]))>#legal-status:empty{display:none}
}
