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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #c9d1d9;
  --text-dim: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --danger: #f85149;
  --success: #3fb950;
  --warning: #d2991d;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.view { display: none; flex-direction: column; flex: 1; }
.view.active { display: flex; }

/* Nav */
nav {
  display: flex;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-top: auto;
}
nav button {
  flex: 1;
  padding: 10px 4px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
}
nav button.active { color: var(--accent); background: rgba(88,166,255,0.1); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px;
}

/* Record button */
.record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px auto;
  transition: all 0.2s;
}
.record-btn.recording {
  border-color: var(--danger);
  background: rgba(248,81,73,0.15);
  animation: pulse 2s infinite;
}
.record-btn .inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--danger);
  transition: all 0.2s;
}
.record-btn:not(.recording) .inner { border-radius: 6px; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248,81,73,0.4); }
  50% { box-shadow: 0 0 0 16px rgba(248,81,73,0); }
}

/* Status bar */
.status-bar {
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  padding: 8px;
}
.status-bar .timer {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.status-bar .chunk-count { font-size: 13px; margin-top: 4px; }

/* Queue */
.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.queue-item .status { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.queue-item .status.uploading { color: var(--warning); }
.queue-item .status.done { color: var(--success); }
.queue-item .status.queued { color: var(--text-dim); }
.queue-item .status.failed { color: var(--danger); }

/* Forms */
input, textarea, button[type="submit"] {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  font-family: var(--font);
}
button[type="submit"], .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
}
button[type="submit"]:active, .btn-primary:active { background: var(--accent-hover); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; }

.hidden { display: none; }

/* Photo capture */
.photo-preview {
  width: 100%;
  border-radius: var(--radius);
  margin: 12px 0;
}
.camera-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto;
}

/* Responsive */
@media (min-width: 480px) {
  .record-btn { width: 140px; height: 140px; }
  .record-btn .inner { width: 56px; height: 56px; }
}

/* Timeline */
.tl-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tl-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.tl-body {
  flex: 1;
  min-width: 0;
}
.tl-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tl-type {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}
.tl-time {
  font-size: 13px;
  color: var(--text-dim);
}
.tl-status {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--warning);
}
.tl-status.completed { color: var(--success); }
.tl-status.error { color: var(--danger); }
.tl-meta {
  font-size: 11px;
  color: var(--text-dim);
}
.tl-preview {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
