:root {
  --bg: #0a0303;
  --bg2: #120606;
  --panel: #1a0808;
  --panel2: #241010;
  --text: #ffe8e8;
  --muted: #c98a8a;
  --accent: #c62828;
  --accent2: #ff5252;
  --accent-glow: rgba(198, 40, 40, 0.45);
  --border: rgba(255, 82, 82, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #1a0606 0%, #0a0303 55%, #050101 100%);
  color: var(--text);
}

html.embed-root,
html.embed-root body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

body.embed .home-link,
body.embed .toolbar-brand {
  display: none;
}

body.embed,
body.embed .browser {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body.embed .browser {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.embed .toolbar {
  flex-shrink: 0;
}

body.embed .frame-host {
  flex: 1 1 auto;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.embed .splash {
  min-height: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 16px;
}

body.embed .proxy-frame,
body.embed .frame-host iframe {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.splash {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.splash-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  pointer-events: none;
}

.splash-inner {
  position: relative;
  width: min(640px, 100%);
  text-align: center;
  z-index: 1;
}

.logo-mark {
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: #000;
  box-shadow: 0 0 40px var(--accent-glow), inset 0 0 0 1px rgba(255, 82, 82, 0.15);
}

.logo-mark img {
  display: block;
  width: 72px;
  height: auto;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.tagline {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
}

.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-form input,
.url-bar input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-form input:focus,
.url-bar input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.15);
}

.search-form button,
.go-mini {
  padding: 0 22px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff5252, #b71c1c);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s;
}

.search-form button:hover,
.go-mini:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.engine-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
}

.toolbar-engines {
  margin-bottom: 0;
  flex-shrink: 0;
}

.engine-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.engine-select {
  min-width: 148px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  outline: none;
}

.engine-select:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.15);
}

.engine-label-single .engine-select {
  pointer-events: none;
  cursor: default;
  opacity: 0.92;
}

body.embed .engine-label--proxy .engine-embed-note {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
  margin-top: 2px;
  max-width: 148px;
  line-height: 1.35;
}

.engine-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.powered-by {
  margin: 20px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.powered-by a {
  color: var(--accent2);
  text-decoration: none;
}

.powered-by a:hover {
  text-decoration: underline;
}

.powered-by span {
  margin: 0 8px;
  opacity: 0.45;
}

.lite-notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 193, 7, 0.35);
  background: rgba(255, 193, 7, 0.08);
  color: #ffdca8;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: left;
}

.embed-blocked {
  min-height: calc(100vh - 58px);
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.embed-blocked p {
  max-width: 420px;
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.embed-open-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5252, #b71c1c);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.quick {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  font-size: 0.92rem;
}

.quick:hover {
  background: rgba(198, 40, 40, 0.22);
  border-color: rgba(255, 82, 82, 0.35);
}

.auth-panel,
.user-panel {
  margin: 18px 0 8px;
}

.auth-note {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.auth-error {
  margin: 12px auto 0;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 82, 82, 0.45);
  background: rgba(198, 40, 40, 0.18);
  color: #ffb4b4;
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-error.hidden {
  display: none;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #fff;
  color: #1f1f1f;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.google-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.user-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

#user-email {
  font-size: 0.9rem;
  color: var(--accent2);
}

.logout-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.logout-btn:hover {
  color: var(--text);
  background: rgba(198, 40, 40, 0.18);
}

.search-block.locked {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.2);
}

.search-block.locked .quick-links {
  display: none;
}

.status {
  min-height: 1.4em;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.home-link {
  position: absolute;
  top: 18px;
  left: 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.home-link:hover {
  color: var(--accent2);
}

.browser {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #180808, #100404);
  border-bottom: 1px solid var(--border);
}

.toolbar-left {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(198, 40, 40, 0.25);
}

.url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.url-lock {
  opacity: 0.55;
  font-size: 0.85rem;
}

.toolbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
  max-width: 220px;
}

.toolbar-email {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.logout-btn--compact {
  padding: 4px 10px;
  font-size: 0.72rem;
}

.toolbar-brand {
  text-align: right;
  min-width: 120px;
}

.brand-name {
  display: block;
  font-weight: 700;
  color: var(--accent2);
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--muted);
}

.frame-host,
.frame-host iframe,
.proxy-frame {
  flex: 1;
  width: 100%;
  min-height: calc(100vh - 58px);
  border: 0;
  background: #000;
}

.proxy-frame {
  display: block;
}

@media (max-width: 720px) {
  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar-brand {
    display: none;
  }

  .toolbar-engines {
    width: 100%;
    order: 3;
  }

  .search-form {
    flex-direction: column;
  }

  .engine-row {
    flex-direction: column;
    align-items: stretch;
  }

  .engine-select {
    width: 100%;
  }
}
