/* ========================================
   Design Tokens
   ======================================== */

:root {
  /* Core palette */
  --bg:          #f5f5f9;
  --bg-card:     #ffffff;
  --bg-surface:  #f0f0f5;
  --fg:          #1a1a2e;
  --muted:       #6b6b80;
  --border:      #e0e0e8;

  /* Accent (pink) */
  --accent:      #d6336c;
  --accent-dim:  #f0e0e8;
  --accent-text: #ffffff;

  /* Semantic */
  --success:     #2b8a3e;
  --warning:     #e67700;
  --danger:      #c92a2a;

  /* Derived — text on colored backgrounds */
  --on-accent:   #ffffff;
  --on-surface:  var(--fg);

  /* Input */
  --input-bg:    #ffffff;
  --input-border: #d0d0d8;
}

/* ========================================
   Reset
   ======================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #e8e8ec;
  color: var(--fg);
  min-height: 100vh;
  min-height: 100dvh;
}

#shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ========================================
   Status Bar
   ======================================== */

.status-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.status-bar.listening .status-prompt { background: #e8f0e8; }
.status-bar.capturing .status-prompt { background: var(--accent-dim); }

/* Nav row: hamburger + date left, action buttons right */
.status-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
}

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

.hamburger-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.hamburger-btn:hover {
  color: var(--accent);
}

.nav-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.session-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

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

.help-btn {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

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

/* Prompt row: mic status + hint text */
.status-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  transition: background 0.2s;
}

.mic-icon { font-size: 1.5rem; }
.mic-icon.pulse { animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.status-text { font-weight: 500; }
.status-text.capturing { color: var(--accent); }

.confirmation {
  margin: 0.5rem 1rem 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--accent-dim);
  border-radius: 999px;
  text-align: center;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--fg);
}

/* ========================================
   Listening Toggle
   ======================================== */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.25rem 1rem;
  background: var(--bg-card);
}

.new-session-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.new-session-btn:active { transform: scale(0.95); }

.listening-toggle {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.listening-toggle.listening {
  background: #D63384;
}

.listening-toggle.paused {
  background: var(--bg-card);
  border: 2px solid #D63384;
}

.pause-icon {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pause-bar {
  width: 6px;
  height: 18px;
  border-radius: 2px;
  background: #fff;
}

.play-triangle {
  width: 0;
  height: 0;
  border-left: 14px solid #D63384;
  border-right: 0 solid transparent;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 3px;
}

/* ========================================
   Layout
   ======================================== */

.main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.section-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
}

/* ========================================
   Timer Cards
   ======================================== */

.timers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.timer-card {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  position: relative;
}

.timer-card.urgent {
  background: #fff3cd;
  color: var(--fg);
  animation: urgent-pulse 0.8s infinite;
}

.timer-card.interval { border-left: 3px solid #17a2b8; }

.timer-cancel {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.15);
  color: var(--fg);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.timer-card:hover .timer-cancel { opacity: 1; }

.timer-card.urgent .timer-cancel { color: var(--fg); }

.timer-id {
  position: absolute;
  top: 0.25rem;
  left: 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.8;
}

.timer-card.urgent .timer-id { color: var(--fg); opacity: 0.9; }

@keyframes urgent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-name {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-card.urgent .timer-name { color: var(--fg); opacity: 0.9; }

.timer-countdown {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.timer-card.urgent .timer-label { color: var(--fg); opacity: 0.8; }

/* ========================================
   Events
   ======================================== */

.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: 8px;
}

.event.birth {
  background: #fff0f3;
  border-radius: 6px;
  padding: 0.375rem 0.5rem;
  margin: 0 -0.5rem;
}

.event.birth .event-time { color: var(--muted); }

.event.birth .event-text {
  color: #D63384;
  font-weight: 600;
}

.event.help-row {
  background: transparent;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 0;
  padding: 0.35rem 0.5rem;
  gap: 0.75rem;
}

.help-phrase {
  font-size: 0.8rem;
  font-weight: 500;
  color: #D63384;
  flex: 1;
}

.help-desc {
  font-size: 0.8rem;
  color: var(--muted);
  width: 120px;
  flex-shrink: 0;
}

.help-tip {
  font-size: 0.75rem;
  color: #bbb;
  text-align: center;
  margin-top: 0.5rem;
}

.event-time {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  min-width: 5rem;
}

.event-text { flex: 1; }

/* ========================================
   Birth Log
   ======================================== */

.birth-log { margin-bottom: 1rem; }

.birth-card {
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.birth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
}

.birth-row:last-child {
  border-bottom: none;
}

.birth-key {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.birth-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
}

.birth-val.set {
  color: var(--accent);
}

/* ========================================
   Quick Actions
   ======================================== */

.quick-actions {
  position: fixed;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 430px;
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.action-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s, opacity 0.1s;
}

.action-btn:active { transform: scale(0.95); }

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

.action-btn.secondary {
  background: var(--bg-surface);
  color: var(--fg);
}

.action-btn.danger {
  background: var(--danger);
  color: var(--on-accent);
}

/* ========================================
   Inline Forms
   ======================================== */

.inline-form {
  padding: 1rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.inline-form input,
.inline-form select,
.inline-form textarea {
  padding: 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
}

.inline-form input { flex: 1; min-width: 0; }
.inline-form select { min-width: 80px; }
.inline-form textarea { flex: 1; min-width: 0; }

.unit-toggle {
  display: flex;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  overflow: hidden;
}

.unit-btn {
  padding: 0.5rem 0.75rem;
  border: none;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
}

.unit-btn.active {
  background: var(--accent);
  color: var(--on-accent);
}

.apgar-btn {
  min-width: 44px !important;
  height: 44px;
  padding: 0.5rem !important;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

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

/* ========================================
   Slide Menu
   ======================================== */

.slide-menu-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 430px;
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  animation: fadeIn 0.15s ease-out;
}

.slide-menu {
  position: fixed;
  top: 0;
  bottom: 0;
  left: max(0px, calc(50% - 215px));
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  animation: slideInLeft 0.2s ease-out;
}

.slide-menu-items {
  flex: 0;
}

.slide-menu-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.slide-menu-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.slide-menu-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--fg);
}

.slide-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border: none;
  background: transparent;
  color: var(--fg);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
}

.slide-menu-item:hover {
  background: var(--bg-surface);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

/* ========================================
   Transcript Bar
   ======================================== */

.transcript-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 430px;
  width: 100%;
  padding: 1rem;
  text-align: center;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.transcript {
  color: var(--muted);
  font-style: italic;
  font-size: 0.875rem;
}

/* ========================================
   Loading
   ======================================== */

.loading-bar {
  padding: 0;
  margin-top: 1.5rem;
}

.loading-status {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

/* ========================================
   Start Screen
   ======================================== */

.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1rem 1.25rem;
  gap: 1.25rem;
}

.start-hero { text-align: center; }

.start-icon { font-size: 3rem; margin-bottom: 0.5rem; }

.start-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
}

.start-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.125rem;
}

.mobile-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 1rem;
  background: #fff0f0;
  border: 2px solid var(--danger);
  border-radius: 12px;
}

.mobile-warning-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
  color: var(--danger);
}

.mobile-warning-text {
  color: var(--fg);
  font-size: 0.9rem;
  line-height: 1.4;
}

.mobile-warning-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--danger);
}

.mobile-warning-text p {
  margin: 0;
  color: var(--muted);
}

.start-btn-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
  min-height: 3.5rem;
}

.start-btn {
  font-size: 1.1rem;
  padding: 0.75rem 1.5rem;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.start-btn.loading {
  opacity: 0.8;
  cursor: wait;
}

.start-btn.error {
  opacity: 1;
  cursor: pointer;
  background: var(--danger, #e74c3c);
  border-color: var(--danger, #e74c3c);
}

.start-btn-label {
  position: relative;
  z-index: 1;
}

.start-btn-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
  width: 0;
  transition: width 0.3s;
}

.start-note {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.7;
  margin-top: 0.75rem;
}

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem;
  gap: 2.5rem;
}

.loading-hero {
  text-align: center;
  max-width: 400px;
}

.loading-icon { font-size: 3rem; margin-bottom: 1rem; }

.loading-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
}

.loading-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.loading-note {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 1rem;
  opacity: 0.7;
}

/* ========================================
   Command Reference (loading screen)
   ======================================== */

.cmd-ref {
  max-width: 400px;
  width: 100%;
}

.cmd-ref-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.cmd-ref-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.cmd-ref-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-radius: 8px;
}

.cmd-phrase {
  font-size: 0.8rem;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  color: var(--accent);
}

.cmd-desc {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ========================================
   Error Screen
   ======================================== */

.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 2rem;
  text-align: center;
}

.error-card {
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem;
  border: 2px solid var(--danger);
}

.error-icon { font-size: 3rem; margin-bottom: 1rem; }

.error-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.error-message {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.error-instruction {
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.error-reload {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

/* ========================================
   SW Update Banner
   ======================================== */

#sw-update-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 430px;
  width: 100%;
  z-index: 10000;
  padding: 0.75rem 1.5rem;
  background: var(--warning);
  color: white;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
}

#sw-update-banner button {
  margin-left: 0.5rem;
  padding: 0.3rem 1rem;
  border: 2px solid white;
  border-radius: 999px;
  background: transparent;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

#sw-update-banner button:hover {
  background: white;
  color: var(--warning);
}

/* ========================================
   Page Overlay (unified skeleton)
   ======================================== */

.page-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  max-width: 430px;
  width: 100%;
  background: var(--bg);
  z-index: 80;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.15s ease-out;
}

.page-overlay-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  gap: 0.75rem;
}

.page-overlay-back {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.page-overlay-back:hover {
  background: var(--bg-surface);
}

.page-overlay-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.page-overlay-spacer {
  width: 2rem;
  flex-shrink: 0;
}

.page-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
}

/* ========================================
   About Page
   ======================================== */

.about-section {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.about-app-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #D63384;
}

.about-version {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.about-desc {
  color: var(--muted);
  line-height: 1.5;
  margin-top: 0.5rem;
}

.about-details {
  margin-bottom: 1.5rem;
}

.about-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.about-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.about-value {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ========================================
   Help Page
   ======================================== */

.help-intro {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.help-section { margin-top: 1.5rem; }

.help-steps {
  padding-left: 1.25rem;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--fg);
}

.help-steps li { margin-bottom: 0.25rem; }

.help-note {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  opacity: 0.7;
}

/* ========================================
   Export Page
   ======================================== */

.export-session-id {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.export-session-id .export-label { color: var(--muted); }

.export-session-id .export-value {
  font-family: monospace;
  font-weight: 600;
  color: var(--fg);
}

.export-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.export-card h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.75rem;
}

.export-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.export-row:last-child { border-bottom: none; }

.export-label { font-size: 0.95rem; color: var(--muted); }

.export-value { font-size: 0.95rem; font-weight: 600; }

.export-events { font-size: 0.9rem; }

.export-event-row {
  display: flex;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.export-event-row:last-child { border-bottom: none; }

.export-event-time {
  color: var(--muted);
  white-space: nowrap;
  min-width: 5rem;
}

.export-event-text { flex: 1; }

.export-download {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.85rem;
  font-size: 1.05rem;
}

.export-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
}

.export-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.export-done-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: #E8F5E9;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.export-done-icon {
  font-size: 2rem;
  color: #2E7D32;
}

.export-done-text {
  font-size: 1rem;
  font-weight: 600;
  color: #2E7D32;
}

.export-done-actions {
  display: flex;
  gap: 0.5rem;
}

/* ========================================
   Performance HUD
   ======================================== */

.phud {
  position: fixed;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 9999;
  background: rgba(26, 26, 46, 0.92);
  color: #e0e0e8;
  padding: 0.6rem 0.8rem;
  border-radius: 0.5rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.7rem;
  line-height: 1.4;
  min-width: 200px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: auto;
  user-select: none;
}

.phud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.phud-section {
  padding-bottom: 0.3rem;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.phud-title {
  font-weight: 700;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: #d6336c;
}

.phud-fps {
  font-weight: 600;
  font-size: 0.75rem;
}

.phud-row {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  margin-bottom: 0.35rem;
}

.phud-label {
  color: #999;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.phud-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.phud-thresh {
  color: #666;
  font-size: 0.6rem;
}

.phud-warn {
  color: #ff6b6b;
}

.phud-ok {
  color: #69db7c;
}

.phud-footer {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.phud-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #ccc;
  border: none;
  border-radius: 0.3rem;
  padding: 0.25rem 0.4rem;
  font-family: inherit;
  font-size: 0.6rem;
  cursor: pointer;
  transition: background 0.15s;
}

.phud-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.phud-log {
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.6rem;
  line-height: 1.3;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

.phud-log-line {
  padding: 0.1rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  word-break: break-all;
}

.phud-log-warn {
  color: #ffdd57;
}

.phud-log-error {
  color: #ff6b6b;
}
