:root {
  color-scheme: dark;
  --bg-deep: #121318;
  --bg-surface: #1e2028;
  --bg-elevated: #282b36;
  --bg-input: #15171e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(124, 92, 255, 0.65);

  --text-primary: #f1f3f9;
  --text-secondary: #9aa0b4;
  --text-muted: #646b82;

  --accent: #7c5cff;
  --accent-2: #39d0ff;
  --glow-opacity: 1;

  --success: #2dd4bf;
  --warning: #f59e0b;
  --danger: #f43f5e;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

/* 1. Theme Presets */
html[data-theme="cyberpunk"] {
  --bg-deep: #0b0416;
  --bg-surface: #180a2a;
  --bg-elevated: #261040;
  --bg-input: #10061c;
  --accent: #ff2a85;
  --accent-2: #fcee09;
  --border-focus: rgba(255, 42, 133, 0.7);
}

html[data-theme="nord"] {
  --bg-deep: #242933;
  --bg-surface: #2e3440;
  --bg-elevated: #3b4252;
  --bg-input: #1f242d;
  --text-primary: #eceff4;
  --text-secondary: #d8dee9;
  --accent: #88c0d0;
  --accent-2: #81a1c1;
  --border-focus: rgba(136, 192, 208, 0.7);
}

html[data-theme="dracula"] {
  --bg-deep: #191a24;
  --bg-surface: #282a36;
  --bg-elevated: #343746;
  --bg-input: #1c1d27;
  --accent: #bd93f9;
  --accent-2: #ff79c6;
  --border-focus: rgba(189, 147, 249, 0.7);
}

html[data-theme="matrix"] {
  --bg-deep: #060f09;
  --bg-surface: #0b1b11;
  --bg-elevated: #11291a;
  --bg-input: #050d08;
  --text-primary: #e2ffed;
  --text-secondary: #78c697;
  --accent: #00ff88;
  --accent-2: #00b862;
  --border-focus: rgba(0, 255, 136, 0.7);
}

html[data-theme="synthwave"] {
  --bg-deep: #12071f;
  --bg-surface: #1f0d31;
  --bg-elevated: #2e1447;
  --bg-input: #140822;
  --accent: #ff6b6b;
  --accent-2: #a855f7;
  --border-focus: rgba(255, 107, 107, 0.7);
}

html[data-theme="oled"] {
  --bg-deep: #000000;
  --bg-surface: #0a0a0d;
  --bg-elevated: #16161c;
  --bg-input: #040406;
  --border-subtle: rgba(255, 255, 255, 0.11);
  --accent: #a78bfa;
  --accent-2: #38bdf8;
}

/* Typography Modes */
html[data-font="mono"] {
  --font-ui: "JetBrains Mono", monospace;
}
html[data-font="system"] {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

/* Ambient Backgrounds */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--glow-opacity);
  transition: opacity 0.25s ease, background 0.35s ease;
  background:
    radial-gradient(650px circle at 50% 22%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}

html[data-bg="grid"] .ambient-glow {
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(600px circle at 50% 25%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
  background-size: 40px 40px, 40px 40px, 100% 100%;
}

html[data-bg="stars"] .ambient-glow {
  background-image:
    radial-gradient(1.5px 1.5px at 40px 60px, #fff, transparent),
    radial-gradient(1px 1px at 140px 160px, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 260px 90px, var(--accent-2), transparent),
    radial-gradient(1.5px 1.5px at 340px 230px, var(--accent), transparent),
    radial-gradient(600px circle at 50% 35%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%);
  background-size: 380px 300px, 380px 300px, 380px 300px, 380px 300px, 100% 100%;
}

html[data-bg="minimal"] .ambient-glow {
  background: none;
}

html[data-bg="custom"] .ambient-glow {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.app-shell {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1;
  display: flex !important;
  flex-direction: column !important;
  width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

/* Google Chrome Top Bar */
.chrome-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
  z-index: 30;
}

/* Row 1: Chrome Tab Strip */
.chrome-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 0;
  background: var(--bg-deep);
}

html[data-density="compact"] .chrome-top {
  padding: 4px 8px 0;
}

.tab-strip {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-strip::-webkit-scrollbar {
  display: none;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  min-width: 120px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}

.tab--pinned {
  min-width: 42px;
  max-width: 48px;
  justify-content: center;
  padding: 0 8px;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.tab--active {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.tab--split {
  box-shadow: inset 0 -2px 0 var(--accent-2);
}

.tab__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.tab--active .tab__dot {
  background: var(--accent);
}

.tab--loading .tab__dot {
  background: var(--accent-2);
  animation: pulseDot 1s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 1; }
}

.tab__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
}

.tab__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.top-status-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
}

.ping-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.ping-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.panic-btn {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.panic-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* Row 2: Chrome Navigation & Omnibox */
.chrome-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
}

html[data-density="compact"] .chrome-nav {
  padding: 4px 8px;
}

.nav-controls,
.utility-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  font-family: inherit;
}

.icon-btn--sm {
  width: 28px;
  height: 28px;
  margin-bottom: 3px;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.icon-btn.is-active {
  color: var(--accent);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Clean Switch Proxy Pill Button */
.switch-proxy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.switch-proxy-btn:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: var(--accent);
}

/* Chrome-style Pill Omnibox */
.omnibox-container {
  position: relative;
  flex: 1;
  min-width: 0;
}

.omnibox {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px 0 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.omnibox:hover {
  background: color-mix(in srgb, var(--bg-input) 88%, #fff);
}

.omnibox:focus-within {
  background: var(--bg-input);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.omnibox-shield {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.omnibox-input::placeholder {
  color: var(--text-muted);
}

.omnibox-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.omnibox-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
.omnibox-action-btn.is-starred,
.omnibox-action-btn.is-active {
  color: var(--accent);
}

.omnibox-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 90;
  max-height: 260px;
  overflow-y: auto;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.suggestion-item small {
  color: var(--text-muted);
  font-size: 11.5px;
}

/* Chrome 3-Dots Dropdown Menu */
.more-menu-wrap {
  position: relative;
}

.chrome-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.6);
  padding: 6px;
  z-index: 95;
}

.chrome-dropdown[hidden] {
  display: none !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dropdown-item kbd {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
}

.dropdown-divider {
  height: 1px;
  margin: 5px 4px;
  background: var(--border-subtle);
}

/* Row 3: Chrome Bookmarks Bar */
.bookmarks-bar {
  display: flex;
  align-items: center;
  padding: 2px 12px 6px;
  background: var(--bg-surface);
}

.bookmarks-bar.is-hidden {
  display: none;
}

.bookmarks-list {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.bookmarks-list::-webkit-scrollbar {
  display: none;
}

.bookmark-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.bookmark-pill:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}
.bookmark-pill__del {
  opacity: 0;
  font-size: 12px;
  transition: opacity 0.12s;
}
.bookmark-pill:hover .bookmark-pill__del {
  opacity: 0.6;
}
.bookmark-pill__del:hover {
  opacity: 1 !important;
  color: var(--danger);
}

/* Loading Progress Bar */
.loading-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  background-size: 200% 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-bar.is-active {
  opacity: 1;
  animation: loadingSweep 1.15s linear infinite;
}

@keyframes loadingSweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Main Viewport */
.viewport {
  position: relative !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: calc(100vh - 122px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Chill Google Chrome-Style New Tab Page */
.launchpad {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px 80px;
  z-index: 5;
}

.launchpad.is-hidden {
  display: none;
}

.launchpad-inner {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-title {
  margin: 0 0 28px;
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  cursor: pointer;
}

.hero-title span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Chrome-style Rounded Search Bar on New Tab */
.hero-search {
  display: flex;
  align-items: center;
  width: 100%;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.hero-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.38), 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.hero-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.hero-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
}

.hero-search-input::placeholder {
  color: var(--text-muted);
}

/* Chrome-Style Circular Shortcuts Grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 32px;
}

.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.quick-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.quick-card__title {
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.quick-card__del {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.quick-card:hover .quick-card__del {
  opacity: 0.7;
}
.quick-card__del:hover {
  opacity: 1 !important;
  color: var(--danger);
}

/* Chrome-Style Bottom-Right "Customize" Pill */
.customize-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.customize-fab:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

/* Proxied Iframes Stage + Split Screen */
.frames-stage {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #05060a;
}

.frames-stage.is-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--border-subtle);
}

.proxy-frame {
  display: none;
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
}

.proxy-frame.is-active,
.proxy-frame.is-split-visible {
  display: block;
}

/* Developer Console Dock */
.devtools-dock {
  height: 220px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 25;
}

.devtools-dock[hidden] {
  display: none !important;
}

.devtools-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.devtools-tabs {
  display: flex;
  gap: 6px;
}

.devtools-tab {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.devtools-tab.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.devtools-actions {
  display: flex;
  gap: 6px;
}

.devtools-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.devtools-pane {
  display: none;
  height: 100%;
  flex-direction: column;
}
.devtools-pane.is-active {
  display: flex;
}

.dev-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.dev-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.dev-row__badge {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
}
.dev-row__url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-row--warn {
  color: var(--warning);
}
.dev-row--error {
  color: var(--danger);
}

.dev-console-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-input);
}
.dev-prompt {
  color: var(--accent);
  font-family: var(--font-mono);
}
#dev-console-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mini-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.mini-btn:hover,
.mini-btn.is-active {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* Modals & Drawers */
.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop[hidden],
.drawer-backdrop[hidden] {
  display: none !important;
}

.command-palette {
  width: 100%;
  max-width: 520px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.cp-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.cp-icon {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.cp-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
}

.cp-esc {
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.cp-results {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.cp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.cp-item:hover,
.cp-item.is-selected {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.cp-item__tag {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
}

/* Customize Studio Modal */
.studio-modal {
  width: 100%;
  max-width: 680px;
  max-height: 86vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.studio-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.studio-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.studio-header p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.studio-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.studio-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.studio-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.studio-section h3 {
  margin: 0 0 10px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 8px;
}

.theme-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.theme-card:hover,
.theme-card.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
}

.studio-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.studio-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-input,
.studio-select {
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.studio-input:focus,
.studio-select:focus {
  border-color: var(--border-focus);
}

.cloak-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.studio-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.danger-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.12);
  color: #fda4af;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.danger-btn:hover {
  background: rgba(244, 63, 94, 0.25);
}

/* Side Drawers */
.drawer-backdrop {
  justify-content: flex-end;
  padding: 0;
}

.side-drawer {
  width: 100%;
  max-width: 380px;
  height: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.6);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.drawer-header h3 {
  margin: 0;
  font-size: 15px;
}
.drawer-header-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-search {
  margin: 12px 0;
}
.drawer-search input {
  width: 100%;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
}
.history-item:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}
.history-item__top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
}
.history-item__url {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0;
}

.scratchpad-textarea {
  flex: 1;
  width: 100%;
  resize: none;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
}
.scratchpad-textarea:focus {
  border-color: var(--border-focus);
}

/* Fullscreen Mode */
body.is-fullscreen .chrome-bar {
  display: none;
}

.exit-fullscreen-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(12, 14, 22, 0.85);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

/* Games Hub Pill Button & Modal */
.games-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.games-pill-btn:hover {
  background: var(--accent);
  color: #fff;
}

.games-hub-modal {
  width: 100%;
  max-width: 980px;
  height: 86vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.games-hub-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.games-hub-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.games-hub-title-row h2 {
  margin: 0 0 4px;
  font-size: 19px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.games-count-pill {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text-primary);
  font-weight: 600;
}

.games-hub-title-row p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.games-hub-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.games-search-input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
}

.games-search-input:focus {
  border-color: var(--accent);
}

.games-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.game-cat-btn {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.game-cat-btn:hover,
.game-cat-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.games-hub-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 12px;
}

.game-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.game-card__thumb {
  position: relative;
  width: 100%;
  height: 104px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 32%, #141622), color-mix(in srgb, var(--accent-2) 22%, #0c0e16));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card__icon {
  font-size: 28px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
}

.game-card__badge {
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.82);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

.game-card--aaa .game-card__badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
}

.game-card__body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.game-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card__sub {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.games-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 20px 0 8px;
}

/* Block Google Auto Ads from injecting random layout-breaking banners into the browser UI */
.google-auto-placed,
.adsbygoogle-noablate,
body > ins.adsbygoogle:not(#lucasbrowse-ad-unit),
.app-shell > ins.adsbygoogle {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* Floating Google AdSense Pill */
.bottom-ad-bar {
  position: fixed !important;
  left: 12px !important;
  bottom: 10px !important;
  z-index: 25;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  width: auto !important;
  max-width: 380px !important;
  padding: 2px 28px 2px 8px;
  border-radius: 10px;
  background: rgba(12, 14, 22, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  overflow: hidden !important;
}

.bottom-ad-bar[hidden],
body.is-fullscreen .bottom-ad-bar {
  display: none !important;
}

.bottom-ad-bar__label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
  user-select: none;
}

.bottom-ad-bar__slot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px !important;
  max-height: 50px !important;
  width: 320px !important;
  max-width: 320px !important;
  overflow: hidden !important;
  border-radius: 6px;
}

.bottom-ad-bar__slot ins.adsbygoogle {
  display: block !important;
  width: 320px !important;
  height: 50px !important;
  max-width: 320px !important;
  max-height: 50px !important;
  overflow: hidden !important;
}

/* Games Hub Ad Container */
.games-hub-ad-wrap {
  width: 100%;
  max-width: 728px;
  min-height: 60px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.bottom-ad-bar__close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.bottom-ad-bar__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

/* Native LucasBrowse Search Engine View */
.lb-search-view {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: var(--bg-base, #0b0c12);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.lb-search-view[hidden] {
  display: none !important;
}

.lb-search-header {
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(14, 16, 24, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 24px 0;
}

.lb-search-header__top {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.lb-brand-btn {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  cursor: pointer;
  padding: 4px 0;
  flex-shrink: 0;
}

.lb-brand-btn span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lb-search-form {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 4px 6px 4px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lb-search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.lb-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  height: 32px;
}

.lb-search-submit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.lb-search-tabs {
  max-width: 1060px;
  margin: 10px auto 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.lb-search-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 14px 10px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.lb-search-tab:hover {
  color: var(--text-primary);
}

.lb-search-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.lb-search-body {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 22px 24px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 28px;
  align-items: start;
}

.lb-search-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.lb-search-games-strip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 4px;
}

.lb-search-games-strip__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-search-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.lb-result-card {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lb-result-card:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border-subtle));
  background: rgba(255, 255, 255, 0.04);
}

.lb-result-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.lb-result-card__badge {
  padding: 1px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
}

.lb-result-card__title {
  display: inline-block;
  font-size: 16px;
  font-weight: 600;
  color: #8ab4f8;
  text-decoration: none;
  margin-bottom: 6px;
  cursor: pointer;
  line-height: 1.35;
}

.lb-result-card__title:hover {
  text-decoration: underline;
}

.lb-result-card__snippet {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.lb-result-card__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.lb-search-sidebar {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-search-sidebar[hidden] {
  display: none !important;
}

.lb-search-sidebar h3 {
  margin: 0;
  font-size: 17px;
  color: var(--text-primary);
}

.lb-search-sidebar p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

@media (max-width: 860px) {
  .lb-search-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .top-status-cluster {
    display: none;
  }
  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bottom-ad-bar__label {
    display: none;
  }
}

