:root {
  --bg: #07080b;
  --window: #0d1016;
  --chrome: #12161f;
  --chrome-2: #161b26;
  --text: #f3f5f8;
  --muted: #9aa3b2;
  --accent: #6ea8ff;
  --accent-2: #8b7bff;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --ok: #3dd68c;
  --danger: #ff6b6b;
  --lock: #3dd68c;
  --shadow: 0 40px 90px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --radius: 16px;
  --font: "SF Pro Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 640px at 12% -8%, rgba(110, 80, 210, 0.28), transparent 55%),
    radial-gradient(900px 560px at 92% 8%, rgba(50, 110, 220, 0.22), transparent 52%),
    radial-gradient(800px 480px at 50% 115%, rgba(40, 80, 170, 0.16), transparent 50%),
    var(--bg);
  overflow: hidden;
}

button,
input {
  font-family: inherit;
}

.screen {
  min-height: 100%;
}

/* ——— Login ——— */

.login-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}

.login-screen[hidden] {
  display: none;
}

.login-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(110, 168, 255, 0.18), transparent 68%);
  filter: blur(8px);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(18, 22, 31, 0.96), rgba(13, 16, 22, 0.96));
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-mark {
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}

.brand {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.login-card h1 {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.login-lead {
  margin: 10px 0 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.field {
  display: block;
  text-align: left;
  margin-bottom: 16px;
}

.field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #0a0d12;
  color: var(--text);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}

.field input:focus {
  border-color: rgba(110, 168, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.18);
}

.primary-btn {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #7eb4ff, #5b96f0);
  color: #071018;
  font-weight: 650;
  font-size: 15px;
  cursor: pointer;
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.primary-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

/* ——— App / window ——— */

.app-screen {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}

.app-screen[hidden] {
  display: none;
}

.browser-window {
  width: min(1200px, 100%);
  height: min(820px, calc(100vh - 56px));
  background: var(--window);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
}

body.is-maximized .app-screen {
  padding: 0;
  place-items: stretch;
}

body.is-maximized .browser-window {
  width: 100%;
  height: 100%;
  max-width: none;
  border-radius: 0;
  border: 0;
}

body.is-fullscreen .app-screen {
  padding: 0;
  place-items: stretch;
}

body.is-fullscreen .browser-window {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: 0;
}

body.is-focus .titlebar,
body.is-focus .statusbar {
  display: none;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 12px 0 14px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  user-select: none;
  flex-shrink: 0;
}

.traffic-lights {
  display: flex;
  gap: 7px;
  padding-right: 4px;
}

.tl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}

.tl.red { background: #ff5f57; }
.tl.yellow { background: #febc2e; }
.tl.green { background: #28c840; }

.tabs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.tab {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  min-width: 120px;
  height: 30px;
  margin-bottom: 0;
  padding: 0 14px;
  border-radius: 8px 8px 0 0;
  background: var(--window);
  border: 1px solid var(--line);
  border-bottom-color: var(--window);
  color: var(--text);
  font-size: 12px;
}

.tab-favicon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(110, 168, 255, 0.7);
  flex-shrink: 0;
}

.tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.titlebar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.icon-btn.is-on {
  color: var(--accent);
  background: rgba(110, 168, 255, 0.12);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--chrome-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 2px;
}

.omnibox {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  background: #0a0d12;
  border: 1px solid var(--line-strong);
  gap: 8px;
}

.omnibox:focus-within {
  border-color: rgba(110, 168, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.14);
}

.omnibox-lock {
  color: var(--lock);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.omnibox-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  height: 100%;
}

.omnibox-input::placeholder {
  color: #6d7686;
}

.go-btn {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.16);
  color: var(--accent);
  font-weight: 650;
  font-size: 12px;
  cursor: pointer;
}

.go-btn:hover {
  background: rgba(110, 168, 255, 0.28);
}

.viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #090b10;
  outline: none;
  overflow: hidden;
}

.start-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  background:
    radial-gradient(600px 280px at 50% 0%, rgba(110, 168, 255, 0.08), transparent 70%),
    #090b10;
}

.start-kicker {
  margin: 0;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.start-page h2 {
  margin: 8px 0 0;
  font-size: 36px;
  letter-spacing: -0.04em;
  font-weight: 650;
}

.start-sub {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  max-width: 420px;
  line-height: 1.45;
}

.start-search {
  width: min(520px, 100%);
  margin-bottom: 28px;
}

.start-search input {
  width: 100%;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #0d1118;
  color: var(--text);
  padding: 0 18px;
  font-size: 14px;
  outline: none;
}

.start-search input:focus {
  border-color: rgba(110, 168, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.14);
}

.dials {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 110px));
  gap: 18px;
}

.dial {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0;
}

.dial-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 22px;
  background: #141924;
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.dial:hover .dial-icon {
  transform: translateY(-2px);
  border-color: rgba(110, 168, 255, 0.45);
}

.dial-icon.google {
  color: #8ab4f8;
  background: linear-gradient(180deg, #1a2333, #141924);
}

.dial-icon.youtube {
  color: #fff;
  background: linear-gradient(180deg, #e23d3d, #b91c1c);
  font-size: 18px;
}

.dial-icon.ip {
  color: #071018;
  background: linear-gradient(180deg, #8bb6ff, #5b96f0);
  font-size: 16px;
  letter-spacing: 0.04em;
}

.dial-icon.wiki {
  color: var(--text);
  background: linear-gradient(180deg, #2a3140, #171c26);
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  font-size: 26px;
}

.dial-label {
  font-size: 12px;
  color: var(--muted);
}

.stream {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  user-select: none;
  pointer-events: none;
}

.loading-page {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.02em;
  background: #090b10;
}

.viewport.is-live .start-page {
  display: none;
}

.viewport.is-live.is-waiting .loading-page {
  display: grid;
}

.viewport.is-live .stream.has-frame {
  display: block;
}

.viewport.is-waiting .stream {
  display: none !important;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 28px;
  padding: 0 12px;
  background: var(--chrome);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  flex-shrink: 0;
  user-select: none;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #555d6a;
  flex-shrink: 0;
}

.ws-dot.on {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(61, 214, 140, 0.7);
}

.ip-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.12);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

@media (max-width: 720px) {
  .app-screen {
    padding: 0;
  }

  .browser-window {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: 0;
  }

  .dials {
    grid-template-columns: repeat(2, minmax(88px, 110px));
  }

  .start-page h2 {
    font-size: 28px;
  }

  .tab {
    max-width: 140px;
    min-width: 80px;
  }
}
