* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --accent: #e94560;
  --accent-dim: #c73050;
  --text: #eee;
  --text-dim: #888;
  --success: #4ade80;
  --warning: #fbbf24;
}

html, body {
  height: 100%; /* fallback for older browsers */
  height: 100dvh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Status bar */
#status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  padding-right: 40px; /* room for settings gear */
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
}

#status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  transition: background 0.3s;
}

#status-dot.connected { background: var(--success); }
#status-dot.error { background: var(--accent); }

#avatar-toggle {
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#avatar-toggle:active { color: var(--text); border-color: rgba(255,255,255,0.3); }
#avatar-toggle.active {
  color: var(--success);
  border-color: var(--success);
}

#clear-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#clear-btn:active { color: var(--text); border-color: rgba(255,255,255,0.3); }

/* Avatar container */
#avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
#avatar-container.hidden { display: none; }

#avatar-video {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
}

#avatar-status {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
}

.msg.sent {
  align-self: flex-end;
  background: var(--accent);
  border-bottom-right-radius: 4px;
}

.msg.received {
  align-self: flex-start;
  background: var(--surface);
  border-bottom-left-radius: 4px;
}

.msg.streaming {
  border-left: 2px solid var(--accent);
  opacity: 0.9;
}
.msg.streaming .streaming-dots {
  color: rgba(255,255,255,0.6);
  font-style: italic;
}

.msg .time {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}

.msg .msg-meta {
  font-size: 10px;
  color: rgba(74,222,128,0.7);
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
  line-height: 1.4;
}

.msg .ack {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.msg img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
}

/* Upload progress */
.msg .upload-progress {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.file-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.file-icon {
  font-size: 24px;
}

.file-info {
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 14px;
  word-break: break-all;
}

.file-size {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

/* Recording timer */
#recording-timer {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 200;
  color: rgba(255,255,255,0.6);
  pointer-events: none;
  z-index: 10;
  font-variant-numeric: tabular-nums;
}

#recording-timer.visible {
  display: block;
  animation: timerFadeIn 0.3s ease;
}

@keyframes timerFadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Transcript preview */
#transcript-preview {
  font-size: 14px;
  color: var(--text-dim);
  min-height: 0;
  max-height: 60px;
  overflow-y: auto;
  padding: 0 16px;
  transition: all 0.2s;
}

#transcript-preview:not(:empty) {
  padding: 8px 16px;
  min-height: 28px;
  background: rgba(255,255,255,0.03);
}

/* Input area */
#input-area {
  padding: 12px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#text-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#text-input {
  flex: 1;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

#text-input:focus {
  border-color: var(--accent);
}

#send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 44px;
  height: 44px;
  background: var(--accent);
  flex-shrink: 0;
}

#send-btn:active { background: var(--accent-dim); transform: scale(0.95); }

#file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-dim);
  background: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
#file-btn:active { color: var(--text); }

/* Mic row -- big buttons */
#mic-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

#mic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 72px;
  height: 72px;
  background: var(--accent);
  flex-shrink: 0;
}

#mic-btn.recording {
  background: #dc2626;
  animation: pulse 1s infinite;
}

#mic-btn:active { transform: scale(0.95); }

/* Camera and gallery buttons */
#camera-btn, #gallery-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.12);
  flex-shrink: 0;
}

#camera-btn:active, #gallery-btn:active {
  transform: scale(0.95);
  background: rgba(255,255,255,0.2);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0); }
}

/* Continuous mode toggle -- big and obvious */
#continuous-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 14px 24px;
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  transition: all 0.2s;
  min-width: 90px;
}

#continuous-toggle:active {
  transform: scale(0.95);
}

#continuous-toggle.active {
  background: var(--success);
  border-color: var(--success);
  color: #000;
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
}

/* Settings */
#settings {
  position: fixed;
  inset: 0;
  background: var(--bg);
  padding: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

#settings.hidden { display: none; }

#settings h2 { font-size: 20px; }

#settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

#settings input[type="text"],
#settings input[type="password"] {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.checkbox-label {
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  font-size: 14px !important;
  color: var(--text) !important;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

#settings button {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  color: white;
}

#save-settings { background: var(--accent); }
#close-settings { background: rgba(255,255,255,0.1); }

#settings-btn {
  position: fixed;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 12px;
  z-index: 50;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Login screen */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

#login-screen.hidden { display: none; }

.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  max-width: 320px;
  width: 100%;
}

.login-box h1 {
  font-size: 24px;
  font-weight: 600;
}

.login-box p {
  font-size: 14px;
  color: var(--text-dim);
}

.login-box input {
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  text-align: center;
  -webkit-user-select: text;
  user-select: text;
}

.login-box input:focus {
  border-color: var(--accent);
}

.login-box button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.login-box button:active {
  background: var(--accent-dim);
  transform: scale(0.98);
}

.login-box button:disabled {
  opacity: 0.5;
}

#login-error {
  color: var(--accent);
  font-size: 14px;
  min-height: 20px;
}

/* App content toggle */
#app-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#app-content.hidden { display: none; }

/* Clipboard sync toggle button */
#clipboard-sync-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
#clipboard-sync-toggle:active { color: var(--text); border-color: rgba(255,255,255,0.3); }
#clipboard-sync-toggle.active {
  color: var(--success);
  border-color: var(--success);
}

/* Clipboard toast */
#clipboard-toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(22, 33, 62, 0.95);
  color: var(--text);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
  border: 1px solid rgba(74, 222, 128, 0.3);
}
#clipboard-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Clipboard paste overlay (fallback when Clipboard API needs gesture) */
#clipboard-paste-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
#clipboard-paste-overlay.visible {
  display: flex;
}
.clipboard-paste-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  max-width: 320px;
  width: 90%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.clipboard-paste-box p {
  font-size: 14px;
  color: var(--text-dim);
}
.clipboard-paste-preview {
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  max-height: 120px;
  overflow-y: auto;
  word-break: break-all;
  -webkit-user-select: text;
  user-select: text;
}
.clipboard-paste-box button {
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  color: white;
}
#clipboard-copy-btn { background: var(--accent); }
#clipboard-dismiss-btn { background: rgba(255,255,255,0.1); }

/* Screen share button */
#screen-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.12);
  flex-shrink: 0;
}
#screen-share-btn:active {
  transform: scale(0.95);
  background: rgba(255,255,255,0.2);
}
#screen-share-btn.active {
  background: var(--accent);
  animation: pulse 1s infinite;
}

/* Screen share overlay */
#screen-share-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 200;
  display: flex;
  flex-direction: column;
  touch-action: none;
}
#screen-share-overlay.hidden { display: none; }

#screen-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0,0,0,0.8);
  z-index: 201;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

#screen-share-fps {
  font-size: 12px;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

#screen-share-close {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  padding: 6px 16px;
  cursor: pointer;
}
#screen-share-close:active {
  background: var(--accent-dim);
  transform: scale(0.95);
}

#screen-share-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#screen-share-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: none;
  image-rendering: auto;
}

/* Wake-on-LAN button */
#wol-btn {
  display: block;
  width: calc(100% - 32px);
  text-align: center;
  cursor: default;
}
#wol-btn.hidden { display: none; }

/* Encryption indicator */
.encryption-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(74,222,128,0.15);
  color: var(--success);
  margin-left: 6px;
  vertical-align: middle;
}

/* deployed Sun, Mar 15, 2026  5:17:12 PM */
