/* ===== Variables ===== */
:root {
  --bg: #0f1216;
  --bg-card: #161b22;
  --bg-input: #21262d;
  --border: #30363d;
  --border-focus: #58a6ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --success: #3fb950;
  --error: #f85149;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Connect panel ===== */
.panel {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.panel-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

/* ===== Logo ===== */
.logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  background: linear-gradient(145deg, var(--accent) 0%, #388bfd 100%);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.25);
}

.logo h1 {
  margin: 0 0 4px 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.tagline {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== Form ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}

.hint {
  font-weight: 400;
  color: var(--text-muted);
}

.form-group input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.form-group input:hover {
  border-color: #484f58;
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* ===== Button ===== */
.btn-connect {
  margin-top: 6px;
  height: 44px;
  padding: 0 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-connect:hover {
  background: var(--accent-hover);
}

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

.btn-connect:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

/* ===== Status ===== */
.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background 0.25s ease;
}

.status.connected .status-dot {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(63, 185, 80, 0.3);
}

.status.error .status-dot {
  background: var(--error);
}

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

.status.connected .status-text {
  color: var(--success);
}

.status.error .status-text {
  color: var(--error);
}

/* ===== View panel ===== */
.hidden {
  display: none !important;
}

.view-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-panel canvas {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
