:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #21262d;
  --line: #30363d;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #4f9dff;
  --accent-2: #a371f7;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* ----------------------------- Ust bar ----------------------------- */
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.brand .logo {
  color: var(--accent);
  font-size: 20px;
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.engine {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}
.engine-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.omni {
  display: flex;
  flex: 1 1 320px;
  min-width: 240px;
  gap: 6px;
}
.url {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 9px 12px;
  border-radius: var(--radius);
  outline: none;
  font-size: 14px;
}
.url:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79, 157, 255, 0.25); }
.go {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: 0;
  padding: 9px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}
.go:active { transform: translateY(1px); }

.tools { display: flex; align-items: center; gap: 8px; }
.transport {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.transport select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}
.icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--fg);
  border-radius: 9px;
  cursor: pointer;
  font-size: 16px;
}
.icon:hover { border-color: var(--accent); }

/* ----------------------------- Sahne ----------------------------- */
.stage { position: relative; flex: 1; min-height: 0; }

.welcome {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 12px;
  overflow: auto;
}
.welcome h1 {
  font-size: clamp(22px, 4vw, 34px);
  margin: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome p { max-width: 640px; margin: 0; color: var(--fg); }
.welcome .muted { color: var(--muted); font-size: 14px; }
.welcome .warn {
  color: var(--warn);
  font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  padding: 8px 14px;
  border-radius: var(--radius);
  max-width: 640px;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.frame-wrap { position: absolute; inset: 0; background: #fff; }
.frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.frame-wrap.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cg fill='none' stroke='%234f9dff' stroke-width='3'%3E%3Ccircle cx='22' cy='22' r='18' stroke-opacity='.25'/%3E%3Cpath d='M40 22a18 18 0 0 0-18-18'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 22 22' to='360 22 22' dur='0.9s' repeatCount='indefinite'/%3E%3C/path%3E%3C/g%3E%3C/svg%3E") center no-repeat;
  pointer-events: none;
}

/* ----------------------------- Durum cubugu ----------------------------- */
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.status .spacer { flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot[data-state="idle"] { background: var(--muted); }
.dot[data-state="busy"] { background: var(--warn); animation: pulse 1s infinite; }
.dot[data-state="ok"] { background: var(--ok); }
.dot[data-state="err"] { background: var(--err); }
@keyframes pulse { 50% { opacity: 0.3; } }
.tag {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 8px;
  color: var(--fg);
}
.tag:empty { display: none; }

@media (max-width: 640px) {
  .tools .transport span { display: none; }
  .brand { font-size: 14px; }
}
