:root {
  color-scheme: dark;
  font-family: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", sans-serif;
  --background: #07110d;
  --surface: #0c1b13;
  --foreground: #edf8f1;
  --muted: #9fb9aa;
  --border: #2a4736;
  --accent: #41dc8b;
  --error: #ffb4b4;
  background: var(--background);
  color: var(--foreground);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 280px; margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.access-shell {
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  padding: 48px 20px;
  background: radial-gradient(ellipse at 50% 0, #17462c66, transparent 65%);
}
.access-panel { width: min(100%, 470px); padding: 36px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); }
.brand-row { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; color: #031109; background: var(--accent); font-size: 23px; font-weight: 800; }
.brand-row div { display: grid; gap: 3px; }
.brand-row strong { font-size: 17px; }
.brand-row div > span { font-size: 12px; color: var(--muted); }
.access-copy { margin: 34px 0 30px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 11px; letter-spacing: .16em; font-weight: 700; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 38px); line-height: 1.35; font-weight: 650; letter-spacing: -.02em; }
.access-copy > p:last-child { margin: 18px 0 0; color: var(--muted); line-height: 1.8; font-size: 14px; }
.field-label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.password-control { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 3px 6px 3px 14px; background: var(--background); }
.password-control:focus-within { border-color: var(--accent); outline: 3px solid #41dc8b18; }
.field-icon { color: var(--muted); width: 18px; }
.password-control input { width: 100%; min-width: 0; height: 44px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--foreground); }
input::placeholder { color: #759180; font-size: 13px; }
.icon-button { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; }
.icon-button:hover:not(:disabled) { color: var(--foreground); background: #ffffff0b; }
.form-message { margin: 12px 0; min-height: 20px; color: var(--error); font-size: 13px; line-height: 1.5; }
.primary-button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; padding: 0 17px; border: 0; border-radius: 12px; color: #031b0b; background: var(--accent); font-weight: 700; }
.primary-button:hover:not(:disabled) { background: #66e6a2; }
.access-note { margin: 18px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.initial-status { margin: 16px 0 0; color: var(--muted); font-size: 12px; }
.access-footer { color: #759180; font-size: 12px; }
.access-footer span { margin: 0 8px; color: var(--border); }

.browser-shell { height: 100svh; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; padding-top: env(safe-area-inset-top); }
.browser-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.toolbar-brand { display: flex; align-items: center; gap: 10px; }
.toolbar-brand .brand-mark { width: 30px; height: 30px; font-size: 19px; border-radius: 9px; }
.toolbar-brand strong { font-size: 14px; }
.connection-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #c9ad65; }
.status-dot[data-state="connected"] { background: var(--accent); }
.status-dot[data-state="error"] { background: var(--error); }
.toolbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.text-button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; color: var(--foreground); background: transparent; font-size: 12px; }
.text-button:hover:not(:disabled) { background: #ffffff0b; }
.text-button .icon { width: 17px; }
.browser-location { display: flex; align-items: center; gap: 8px; padding: 9px 18px; color: var(--muted); font-size: 12px; border-bottom: 1px solid #1c3023; }
.browser-location > .icon { width: 14px; height: 14px; }
#pageLocation { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.engine-label { font-size: 11px; color: var(--accent); }
.browser-viewport { position: relative; min-height: 0; overflow: hidden; background: #131816; }
.browser-canvas { display: block; width: 100%; height: 100%; object-fit: contain; touch-action: none; }
.page-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; }
.surface-notice { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: #131816; }
.surface-notice h2 { margin: 0; font-size: 19px; font-weight: 600; }
.surface-notice p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.secondary-button { display: flex; align-items: center; gap: 9px; min-height: 42px; margin-top: 5px; padding: 0 16px; color: var(--foreground); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.secondary-button:hover { border-color: var(--accent); }
.browser-footer { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 11px; background: var(--surface); }

@media (max-width: 640px) {
  .access-shell { padding: 24px 16px; }
  .access-panel { padding: 28px 24px; }
  .browser-toolbar { padding: 8px 10px; gap: 8px; }
  .connection-state { margin-left: auto; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  .browser-location { padding: 8px 12px; }
  .browser-footer { padding-left: 12px; padding-right: 12px; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-color: var(--accent); }
}
