html, body { height: 100%; margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #f4f4f2; color: #222; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
#frame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; display: none; }
body.bar #frame { top: var(--bar-h, 44px); height: calc(100% - var(--bar-h, 44px)); }
#gate.over { position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: inherit; background-color: #f4f4f2; }
#gate { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom)); }
.card { width: 100%; max-width: 30rem; background: #fff; border-radius: 12px; padding: 1.5rem 1.75rem; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
h1 { font-size: 1.25rem; margin: 0 0 .5rem; }
h2 { font-size: 1rem; margin: 1.25rem 0 .25rem; }
p { margin: .5rem 0; line-height: 1.45; }
.muted { opacity: .72; font-size: .9rem; }
label { display: block; margin: .75rem 0 .3rem; font-size: .9rem; font-weight: 600; line-height: 1.3; }
label .muted { font-weight: 400; }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: flex-start; }
label.linklike { display: inline; margin: 0; font-weight: 400; font-size: 1rem; }
input:not([type=checkbox]), select { width: 100%; font: inherit; font-size: 1rem; padding: .55rem .65rem; border: 1px solid #b8b8b4; border-radius: 8px; background: #fff; color: inherit; }
input:focus-visible, button:focus-visible, select:focus-visible, summary:focus-visible, .linklike:focus-visible { outline: 3px solid #7cc4a8; outline-offset: 1px; }
button { font: inherit; padding: .55rem .9rem; min-height: 2.6rem; border-radius: 8px; border: 1px solid #9a9a96; background: transparent; color: inherit; cursor: pointer; }
button.primary { background: #1f7a5c; border-color: #1f7a5c; color: #fff; font-weight: 600; margin-top: .75rem; }
button.primary:disabled { opacity: .6; cursor: wait; }
button.wide { width: 100%; }
button.danger { color: #b3261e; border-color: #b3261e; }
.linklike { background: none; border: 0; padding: 0; min-height: 0; color: #1f6f8b; text-decoration: underline; cursor: pointer; font: inherit; }
hr { border: 0; border-top: 1px solid rgba(128,128,128,.3); margin: 1.1rem 0; }
progress { width: 100%; height: .6rem; margin-top: .75rem; }
.err { color: #b3261e; white-space: pre-wrap; font-size: .9rem; min-height: 0; margin: .4rem 0 0; }
.err:empty { display: none; }
.ok { color: #1f7a5c; font-size: .9rem; }
.note { background: #e8f3ee; border-radius: 8px; padding: .6rem .75rem; font-size: .9rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; letter-spacing: .06em; text-align: center; background: #f1f1ee; border-radius: 8px; padding: .8rem .5rem; overflow-wrap: anywhere; user-select: all; }
summary { cursor: pointer; color: #1f6f8b; }
#bar { display: none; position: fixed; top: 0; left: 0; right: 0; background: #fff3cd; color: #4d3b00; font-size: .875rem; padding: .5rem .75rem; z-index: 5; align-items: center; gap: .5rem; flex-wrap: wrap; }
body.bar #bar { display: flex; }
#bar.bad { background: #f9dedc; color: #601410; }
#bar button { padding: .2rem .6rem; min-height: 0; border-color: currentColor; }
#bar .grow { flex: 1 1 14rem; }
#panel { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.45); overflow-y: auto; padding: 1rem; display: flex; align-items: flex-start; justify-content: center; }
#panel .card { max-width: 34rem; margin: auto; }
#panel .row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
#panel .row > .grow { flex: 1 1 10rem; }
#panel ul { list-style: none; padding: 0; margin: .25rem 0; }
#panel li { display: flex; gap: .5rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid rgba(128,128,128,.2); }
#panel li span { flex: 1; }
#panel button { min-height: 2.3rem; padding: .4rem .7rem; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: #1f7a5c; color: #fff; vertical-align: 2px; }
.pill.off { background: #8a8a86; }
@media (prefers-color-scheme: dark) {
  html, body, #gate.over { background-color: #16181b; color: #e8e8e8; }
  .card { background: #22262b; }
  input:not([type=checkbox]), select { background: #16181b; border-color: #555; }
  .code { background: #16181b; } .note { background: #1d3229; }
  .linklike, summary { color: #7cc4e0; } .err { color: #ff8a80; } .ok { color: #7cc4a8; }
  #bar { background: #3a3320; color: #f3e6b8; } #bar.bad { background: #4a1f1c; color: #ffd9d6; }
  button.danger { color: #ff8a80; border-color: #ff8a80; }
}
@media print { body > :not(#gate), #gate section:not(#s-recovery), #s-recovery form, #s-recovery button { display: none !important; } .card { box-shadow: none; } }
