/* RoRo — Material-inspired browser UI */
:root{
  --bg:#0b0f14; --surface:#131922; --surface-2:#1b2330; --text:#eef2f7; --muted:#8b95a5;
  --primary:#4f8cff; --primary-2:#7aa8ff; --danger:#ff5b6a; --border:rgba(255,255,255,.08);
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --radius:16px;
}
[data-theme="light"]{
  --bg:#f5f7fb; --surface:#ffffff; --surface-2:#eef2f7; --text:#0b0f14; --muted:#5b6675;
  --primary:#2f6bff; --primary-2:#4f8cff; --danger:#e23744; --border:rgba(0,0,0,.08);
  --shadow:0 10px 30px rgba(20,30,60,.12);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%;background:var(--bg);color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  -webkit-tap-highlight-color:transparent;overscroll-behavior:none}

/* ---------- Splash + lock ---------- */
.splash{position:fixed;inset:0;background:var(--bg);display:flex;flex-direction:column;
  align-items:center;justify-content:center;z-index:9999;transition:opacity .5s ease}
.splash.hide{opacity:0;pointer-events:none}
.splash-name{font-size:34px;font-weight:800;letter-spacing:.5px;margin-top:16px}
.splash-tag{color:var(--muted);margin-top:6px}

.logo-badge{width:72px;height:72px;border-radius:22px;
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  display:grid;place-items:center;box-shadow:var(--shadow);color:#fff;font-weight:900;font-size:32px}
.logo-badge.big{width:104px;height:104px;font-size:46px;border-radius:28px}
.pulse{animation:pulse 1.8s ease-in-out infinite}
@keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}

.lock-body{display:grid;place-items:center;min-height:100dvh;padding:24px}
.lock-shell{max-width:360px;width:100%;text-align:center}
.lock-shell h1{margin:16px 0 4px}
.pin-form{margin-top:18px;display:flex;flex-direction:column;gap:12px}
.pin-input{width:100%;padding:16px;font-size:24px;text-align:center;letter-spacing:8px;
  border-radius:14px;border:1px solid var(--border);background:var(--surface);color:var(--text)}
.error{color:var(--danger);font-size:14px}
.hint{margin-top:22px;color:var(--muted);font-size:13px}

.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-2));
  color:#fff;border:0;padding:14px 18px;border-radius:14px;font-weight:700;
  box-shadow:var(--shadow);cursor:pointer;transition:transform .1s ease}
.btn-primary:active{transform:scale(.98)}
.btn-ghost{background:transparent;border:1px solid var(--border);color:var(--text);
  padding:10px 14px;border-radius:12px;cursor:pointer}

/* ---------- App shell ---------- */
.app{display:flex;flex-direction:column;height:100dvh}
.topbar{display:flex;align-items:center;gap:8px;padding:10px 10px 6px;background:var(--bg);
  padding-top:calc(10px + env(safe-area-inset-top))}
.icon-btn{width:40px;height:40px;border-radius:12px;border:0;background:var(--surface);
  color:var(--text);font-size:18px;display:grid;place-items:center;cursor:pointer;
  transition:background .15s ease}
.icon-btn:active{background:var(--surface-2)}
#tabCount{font-size:13px;font-weight:800}

.omnibox{flex:1;display:flex;align-items:center;background:var(--surface);
  border-radius:22px;padding:6px 10px;box-shadow:var(--shadow)}
.lock-icon{margin-right:6px;color:var(--muted)}
#omni{flex:1;border:0;outline:0;background:transparent;color:var(--text);
  font-size:15px;padding:8px 4px}

.tabstrip{display:flex;gap:6px;padding:4px 10px;overflow-x:auto;scrollbar-width:none}
.tabstrip::-webkit-scrollbar{display:none}
.tab-chip{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;
  background:var(--surface);font-size:12px;white-space:nowrap;max-width:180px;cursor:pointer;
  border:1px solid transparent}
.tab-chip.active{border-color:var(--primary)}
.tab-chip.incognito{background:linear-gradient(135deg,#2a2f3a,#3a2a4a);color:#fff}
.tab-chip .title{overflow:hidden;text-overflow:ellipsis;max-width:120px}
.tab-chip .x{opacity:.7}

.viewport{flex:1;position:relative;overflow:hidden;background:var(--surface-2)}
.frame-wrap{position:absolute;inset:0}
.frame-wrap iframe{width:100%;height:100%;border:0;background:#fff;display:none}
.frame-wrap iframe.active{display:block}
.blocked{position:absolute;inset:0;display:grid;place-items:center;padding:20px}
.blocked-card{background:var(--surface);padding:24px;border-radius:var(--radius);
  max-width:360px;text-align:center;box-shadow:var(--shadow)}
.blocked-card h3{margin:16px 0 6px}

.bottomnav{display:flex;justify-content:space-around;align-items:center;
  padding:8px 6px calc(8px + env(safe-area-inset-bottom));background:var(--surface);
  border-top:1px solid var(--border)}
.nav-btn{flex:1;height:44px;border:0;background:transparent;color:var(--text);font-size:22px;
  border-radius:12px;cursor:pointer}
.nav-btn:active{background:var(--surface-2)}

/* ---------- Sheets ---------- */
.sheet{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;
  align-items:flex-end;justify-content:center;z-index:200;
  animation:fade .2s ease}
.sheet[hidden]{display:none}
@keyframes fade{from{opacity:0}to{opacity:1}}
.sheet-card{width:100%;max-width:520px;background:var(--surface);border-radius:20px 20px 0 0;
  padding:16px;box-shadow:var(--shadow);animation:slideup .25s ease;
  padding-bottom:calc(16px + env(safe-area-inset-bottom))}
.sheet-card.tall{max-height:80dvh;overflow:auto}
@keyframes slideup{from{transform:translateY(100%)}to{transform:translateY(0)}}
.sheet-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.sheet-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.sheet-grid button{background:var(--surface-2);border:0;color:var(--text);
  padding:14px 8px;border-radius:14px;font-size:13px;cursor:pointer;text-align:center}
.sheet-grid button:active{transform:scale(.97)}

.tab-list{display:flex;flex-direction:column;gap:8px}
.tab-row{display:flex;justify-content:space-between;align-items:center;
  background:var(--surface-2);padding:12px;border-radius:12px}
.tab-row .meta{overflow:hidden}
.tab-row .meta .t{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:60vw}
.tab-row .meta .u{color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:60vw}

.panel-body{display:flex;flex-direction:column;gap:8px}
.panel-item{display:flex;justify-content:space-between;align-items:center;
  background:var(--surface-2);padding:10px 12px;border-radius:10px}
.panel-item a{color:var(--primary);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:70vw;display:block}
.panel-item .sub{color:var(--muted);font-size:12px}

.settings-body{display:flex;flex-direction:column;gap:12px}
.settings-body .row{display:flex;justify-content:space-between;align-items:center;gap:12px}
.settings-body input,.settings-body select{background:var(--surface-2);border:1px solid var(--border);
  color:var(--text);padding:8px 10px;border-radius:10px;min-width:140px}
.muted{color:var(--muted)}
.small{font-size:12px}

#qrVideo{width:100%;border-radius:12px;background:#000}
