:root {
  --bg0: #0f1419;
  --bg1: #1a2332;
  --ink: #e8eef7;
  --muted: #8b9bb4;
  --accent: #3d8bfd;
  --line: rgba(255, 255, 255, 0.08);
  --danger: #ff6b6b;
  --ok: #3dd68c;
  --font: "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #243552 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1c2a22 0%, transparent 50%),
    var(--bg0);
  color: var(--ink);
  font-family: var(--font);
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status {
  font-size: 0.85rem;
  color: var(--muted);
}

.status.ok { color: var(--ok); }
.status.warn { color: #ffd166; }
.status.err { color: var(--danger); }

.panel {
  background: color-mix(in srgb, var(--bg1) 88%, black);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
}

.download-panel {
  margin-top: 16px;
}

.download-panel h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  background: #2f6f4e;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.download-btn:active { transform: scale(0.98); }

.ok-line { color: var(--ok) !important; }

.steps {
  margin: 16px 0 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.steps code {
  color: var(--ink);
  font-size: 0.84em;
  word-break: break-all;
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.hint, .tiny {
  color: var(--muted);
  font-size: 0.9rem;
}

.tiny { min-height: 1.2em; color: var(--danger); }

label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0c1118;
  color: var(--ink);
  font-size: 1rem;
}

button {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button:active { transform: scale(0.98); }

#btnConnect {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  font-size: 1rem;
}

.hidden { display: none !important; }

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.toolbar button {
  background: #243044;
}

#btnDisconnect { background: #5a2d36; }

.screen-wrap {
  position: relative;
  background: #05070b;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
}

#frame {
  max-width: 100%;
  max-height: min(78vh, 860px);
  display: block;
  pointer-events: none;
}

.overlay-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  pointer-events: none;
  background: rgba(5, 7, 11, 0.35);
}

.overlay-msg.hide { display: none; }

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.input-row input { margin: 0; }
.input-row button { white-space: nowrap; }

@media (max-width: 640px) {
  .screen-wrap { min-height: 320px; }
}
