* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Login Page ── */
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.login-card .subtitle {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text-dim);
}

.form-group input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
}

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

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

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.error-msg {
  color: var(--danger);
  font-size: 0.8125rem;
  margin-top: 1rem;
  text-align: center;
  display: none;
}

/* ── Session / Desktop Page ── */
.session-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.booting { background: var(--warning); animation: pulse 1s infinite; }
.status-dot.ready { background: var(--success); }
.status-dot.error { background: var(--danger); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

/* ── Boot Screen ── */
.boot-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.boot-screen h2 {
  font-size: 1.25rem;
  font-weight: 500;
}

.progress-bar-wrap {
  width: 300px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.boot-log {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-dim);
  max-width: 500px;
  text-align: center;
  line-height: 1.6;
}

/* ── Guacamole Display Container ── */
.display-container {
  flex: 1;
  overflow: hidden;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: none;
}

.display-container.active {
  display: flex;
}

.display-container.drag-over {
  outline: 3px dashed var(--primary);
  outline-offset: -3px;
}

/* ── Toolbar Center (Special Keys / Actions) ── */
.toolbar-center {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.toolbar-btn {
  padding: 0.25rem 0.625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: var(--border);
  color: var(--text);
  border-color: var(--text-dim);
}

.toolbar-btn:active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.25rem;
}

/* ── Clipboard Modal ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-content h3 {
  font-size: 1rem;
  font-weight: 600;
}

.modal-hint {
  font-size: 0.8125rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.modal-content textarea {
  width: 100%;
  padding: 0.625rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8125rem;
  resize: vertical;
  outline: none;
}

.modal-content textarea:focus {
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ── Hidden ── */
.hidden {
  display: none !important;
}
