/* Sidenote on the web: what the extension's full view (styles/app.css) doesn't have —
   the key screen, a phone layout with the rail as a drawer, and the page's own bits. */
html, body { height: 100%; }
body.app { height: 100dvh; background: var(--paper); color: var(--fg); }
body.app.gating > :not(.gate) { display: none !important; }
.main { position: relative; }
.pane { border: 0; }
.pane .bar { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
.pane.is-ro .tpls { display: none; }
body.shared #btnNew { display: none; }
.rail-bottom .hint { transition: color var(--dur); }
body.offline .rail-bottom .hint { color: var(--danger); }
.only-phone, .phone-top, .scrim { display: none; }

/* key screen */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px 16px; background: var(--paper); z-index: 80; }
.gate[hidden] { display: none; }
.gate-card { width: min(440px, 100%); animation: rise 360ms var(--ease) both; }
.gate-brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 28px; color: var(--fg2); }
.gate-brand img { width: 24px; height: 24px; border-radius: 6px; }
.gate h1 { font: 650 30px/1.15 var(--font); letter-spacing: -.02em; margin: 0; }
.gate-sub { color: var(--fg2); margin: 6px 0 22px; font-size: 15px; }
.gate-row { display: flex; gap: 8px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 8px 28px -16px rgba(0, 0, 0, .25); }
.gate-row:focus-within { border-color: var(--accent); }
.gate-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: 14px var(--font-mono); padding: 9px 10px; }
.gate-row .btn { border-radius: 8px; padding: 8px 16px; font-weight: 600; }
.gate-err { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 10px 2px 0; }
.gate .fine { font-size: 12.5px; color: var(--fg3); line-height: 1.55; margin: 12px 2px 0; }
.gate .fine b { color: var(--fg2); font-weight: 600; }
.gate a { color: var(--accent-fg); text-decoration: none; }

/* phones and narrow windows: the rail slides in over the page */
@media (max-width: 680px) {
  body.app { grid-template-columns: 1fr; }
  .rail { display: flex; position: fixed; z-index: 60; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); padding-top: max(14px, env(safe-area-inset-top)); transform: translateX(-102%); transition: transform 260ms var(--ease); box-shadow: var(--shadow); background: var(--paper); }
  body.rail-open .rail { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: color-mix(in srgb, var(--fg) 18%, transparent); opacity: 0; pointer-events: none; transition: opacity 260ms; }
  body.rail-open .scrim { opacity: 1; pointer-events: auto; }
  .only-phone { display: inline-grid; }
  .phone-top { display: flex; align-items: center; gap: 6px; padding: max(8px, env(safe-area-inset-top)) 8px 6px; border-bottom: 1px solid var(--line); flex: none; }
  .phone-title { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
  .pane-top .pane-name { visibility: hidden; }
  .pane .doc { padding: 6px 18px 48px; }
  .ri { min-height: 38px; font-size: 14.5px; }
  .rail-search kbd { display: none; }
  .gate h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .rail, .scrim, .gate-card { transition: none; animation: none; } }
