:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: rgba(20, 24, 33, .82);
  --panel-2: rgba(29, 34, 46, .88);
  --line: rgba(255,255,255,.11);
  --text: #f7f9fc;
  --muted: #a9b2c4;
  --accent: #7c9cff;
  --accent-2: #a9baff;
  --danger: #ff7070;
  --ok: #61e6a7;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { overscroll-behavior: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.app-shell { min-height: 100dvh; background:
  radial-gradient(circle at 15% 5%, rgba(94,115,255,.18), transparent 27rem),
  radial-gradient(circle at 90% 20%, rgba(65,192,255,.10), transparent 32rem), var(--bg); }
.start-screen { min-height: 100dvh; display: grid; place-items: center; padding: 32px 18px; }
.start-screen > div, .start-screen > .start-card { width: min(940px, 100%); }
.brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.brand-mark, .brand-mini span { display: grid; place-items: center; background: linear-gradient(135deg, #aabaff, #607dff); color: #071023; font-weight: 900; box-shadow: 0 12px 40px rgba(92,119,255,.25); }
.brand-mark { width: 54px; height: 54px; border-radius: 16px; font-size: 24px; }
.eyebrow { color: var(--accent-2); font-size: 12px; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 3px 0 0; font-size: clamp(24px, 5vw, 38px); }
.start-card { border: 1px solid var(--line); border-radius: 28px; padding: clamp(22px, 5vw, 42px); background: linear-gradient(180deg, rgba(26,30,42,.90), rgba(12,15,22,.88)); box-shadow: 0 26px 90px rgba(0,0,0,.35); backdrop-filter: blur(22px); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(97,230,167,.22); background: rgba(97,230,167,.08); border-radius: 999px; font-size: 12px; color: #c7ffe2; }
.dot { width: 7px; height: 7px; background: var(--ok); border-radius: 50%; box-shadow: 0 0 14px var(--ok); }
.start-card h2 { max-width: 760px; font-size: clamp(28px, 5vw, 52px); line-height: 1.03; margin: 20px 0 14px; letter-spacing: -.035em; }
.start-card p { color: var(--muted); line-height: 1.6; }
form { margin-top: 26px; }
label { display: block; font-size: 13px; color: #dbe1ee; font-weight: 700; margin-bottom: 8px; }
label span { font-weight: 500; color: var(--muted); }
.url-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); background: rgba(5,8,14,.78); color: var(--text); outline: none; border-radius: 14px; padding: 14px 15px; }
input:focus, textarea:focus { border-color: rgba(124,156,255,.7); box-shadow: 0 0 0 3px rgba(124,156,255,.12); }
.password-wrap { margin-top: 14px; max-width: 430px; }
button { border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; background: rgba(255,255,255,.055); font-weight: 750; white-space: nowrap; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: linear-gradient(135deg, #7e9cff, #627dff); border-color: rgba(185,199,255,.45); color: #071126; }
.secondary { background: rgba(124,156,255,.10); border-color: rgba(124,156,255,.24); }
.ghost { background: transparent; }
.danger { color: #ffb9b9; border-color: rgba(255,112,112,.24); }
.feature-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.feature-grid div { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: rgba(255,255,255,.025); }
.feature-grid strong, .feature-grid span { display: block; }
.feature-grid strong { font-size: 14px; }
.feature-grid span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.error { color: #ff9b9b !important; min-height: 24px; margin-bottom: 0; }

.browser-screen { min-height: 100dvh; display: flex; flex-direction: column; }
.toolbar { position: sticky; top: 0; z-index: 20; background: rgba(9,11,16,.95); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); padding: max(8px, env(safe-area-inset-top)) 10px 9px; }
.toolbar-top, .nav-row, .action-row { display: flex; align-items: center; gap: 8px; }
.toolbar-top { margin-bottom: 8px; }
.brand-mini { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand-mini span { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.brand-mini b { font-size: 13px; }
.private-state { font-size: 10px; color: #c9d2e5; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.private-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 12px var(--ok); }
.nav-row { margin-bottom: 8px; }
.icon-btn { width: 40px; height: 40px; padding: 0; font-size: 20px; }
.current-url { flex: 1; min-width: 0; border: 1px solid var(--line); background: rgba(3,5,9,.75); border-radius: 12px; padding: 10px 12px; font-size: 12px; color: #dbe2ef; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; }
.action-row { overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.action-row::-webkit-scrollbar { display: none; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex: 0 0 auto; }
.segmented button { border: 0; border-radius: 0; background: transparent; padding: 9px 12px; }
.segmented button.active { background: rgba(124,156,255,.18); color: #dbe3ff; }
.live-status { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }

.viewport-shell { flex: 1; background: #000; overflow: auto; -webkit-overflow-scrolling: touch; }
.canvas-wrap { position: relative; background: #fff; transform-origin: top left; }
.fit-mode .canvas-wrap { width: 100%; aspect-ratio: 16 / 9; }
.fit-mode canvas { width: 100%; height: 100%; display: block; object-fit: contain; }
.pixel-mode .canvas-wrap { width: 1920px; height: 1080px; }
.pixel-mode canvas { width: 1920px; height: 1080px; display: block; }
canvas { touch-action: none; user-select: none; -webkit-user-select: none; cursor: default; }
.loading-overlay { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; background: radial-gradient(circle, #182036, #07090f 70%); color: #e9eeff; font-size: 12px; }
.spinner { width: 30px; height: 30px; border: 3px solid rgba(255,255,255,.12); border-top-color: #8fa8ff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.keyboard-dock { position: fixed; z-index: 40; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto auto auto auto auto; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: rgba(13,16,24,.97); box-shadow: 0 18px 70px rgba(0,0,0,.55); backdrop-filter: blur(20px); }
.keyboard-dock textarea { resize: none; min-height: 42px; max-height: 84px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(17,21,30,.96); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; color: #edf1fb; font-size: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.4); }

@media (max-width: 720px) {
  .start-screen { place-items: start center; padding-top: max(24px, env(safe-area-inset-top)); }
  .url-row { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .toolbar { padding-left: 6px; padding-right: 6px; }
  .private-state { display: none; }
  .nav-row { gap: 5px; }
  .icon-btn { width: 36px; height: 36px; }
  .nav-row .secondary { padding-left: 10px; padding-right: 10px; }
  .action-row button { font-size: 11px; padding: 9px 10px; }
  .live-status { display: none; }
  .keyboard-dock { grid-template-columns: 1fr auto auto auto; }
  .keyboard-dock textarea { grid-column: 1 / -1; }
}
