:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e5e9;
  --text: #1a1c20;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101114;
    --surface: #1a1b1f;
    --border: #2a2c31;
    --text: #f2f3f5;
    --text-muted: #9aa0aa;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.1);
    --error: #f87171;
    --error-bg: rgba(248, 113, 113, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.brand-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

.connect-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Main content */

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 24px 0;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

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

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

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

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  background: var(--surface);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover {
  border-color: var(--accent);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.dropzone.busy {
  cursor: wait;
  opacity: 0.7;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  color: var(--text-muted);
}

.dropzone-content svg {
  color: var(--accent);
  margin-bottom: 6px;
}

.dropzone-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.dropzone-sub {
  margin: 0;
  font-size: 13px;
}

.preview-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  object-fit: contain;
}

.hidden {
  display: none;
}

.banner {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.banner.success {
  background: var(--success-bg);
  color: var(--success);
}

.banner.error {
  background: var(--error-bg);
  color: var(--error);
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 0 28px;
}

.dev-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.btn {
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-muted {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-muted:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

/* Debug panel */

.debug-panel {
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
}

.debug-panel summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.debug-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 8px;
}

.copy-status {
  font-size: 12px;
  color: var(--text-muted);
}

.debug-log-text {
  max-height: 220px;
  overflow-y: auto;
  overflow-x: auto;
  margin: 0;
  padding: 10px;
  font-size: 11px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}
