/* CeeCee AI — Premium Dark Theme */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --card: #161616;
  --card2: #1e1e1e;
  --border: rgba(255,255,255,0.07);
  --purple: #8B5CF6;
  --purple-light: #a78bfa;
  --purple-dim: rgba(139,92,246,0.15);
  --purple-glow: rgba(139,92,246,0.4);
  --text: #f0f0f0;
  --text2: #888;
  --text3: #555;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 18px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 44px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
  --nav-h: 72px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ── App Shell ───────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* ── Lock Screen ─────────────────────────────────────────────────────────── */
#lock-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(145deg, #0d0015 0%, #0a0a0a 50%, #00081a 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 32px;
  padding: var(--safe-top) 24px var(--safe-bottom);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#lock-screen.hidden {
  opacity: 0; transform: scale(1.05); pointer-events: none;
}
.lock-logo {
  width: 96px; height: 96px;
  background: radial-gradient(circle at 40% 40%, #a78bfa, #7c3aed, #4c1d95);
  border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 800; color: white;
  box-shadow: 0 0 40px rgba(139,92,246,0.5), 0 8px 32px rgba(0,0,0,0.6);
  letter-spacing: -2px;
}
.lock-title {
  font-size: 28px; font-weight: 700; letter-spacing: -0.5px;
  text-align: center;
}
.lock-subtitle {
  font-size: 15px; color: var(--text2);
  text-align: center; margin-top: -24px;
}
.lock-btn {
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 100px;
  padding: 16px 40px;
  font-size: 17px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 24px rgba(139,92,246,0.4);
  -webkit-tap-highlight-color: transparent;
}
.lock-btn:active { transform: scale(0.96); }
.lock-btn svg { width: 22px; height: 22px; }

/* PIN fallback */
.pin-container { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pin-dots { display: flex; gap: 14px; }
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--text3);
  transition: all 0.15s ease;
}
.pin-dot.filled { background: var(--purple); border-color: var(--purple); }
.pin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-top: 8px;
}
.pin-key {
  width: 72px; height: 72px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 22px; font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.pin-key:active { background: var(--purple-dim); transform: scale(0.94); }
.pin-key.del { font-size: 18px; color: var(--text2); }
.pin-error { color: var(--danger); font-size: 14px; animation: shake 0.4s ease; }

/* ── Header ──────────────────────────────────────────────────────────────── */
#header {
  padding: calc(var(--safe-top) + 8px) 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(10,10,10,0.98) 0%, transparent 100%);
  position: relative; z-index: 10;
}
.header-logo {
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 36px; height: 36px;
  background: radial-gradient(circle at 40% 40%, #a78bfa, #7c3aed);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: white;
  box-shadow: 0 2px 12px rgba(139,92,246,0.4);
}
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.logo-dot { color: var(--purple-light); }
#header-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text3);
  transition: background 0.3s ease;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.error { background: var(--danger); }

/* ── Bottom Nav ──────────────────────────────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  z-index: 50;
}
.nav-tabs {
  display: flex; width: 100%;
  justify-content: space-around; align-items: center;
  padding: 0 8px;
}
.nav-tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
}
.nav-tab:active { transform: scale(0.92); }
.nav-tab svg { width: 22px; height: 22px; color: var(--text3); transition: color 0.2s; }
.nav-tab span { font-size: 11px; color: var(--text3); font-weight: 500; transition: color 0.2s; letter-spacing: 0.2px; }
.nav-tab.active svg { color: var(--purple-light); }
.nav-tab.active span { color: var(--purple-light); }
.nav-tab-indicator {
  position: absolute; bottom: calc(var(--safe-bottom) + 2px);
  height: 3px; border-radius: 2px;
  background: var(--purple);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen {
  position: absolute;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(8px);
}
.screen.active {
  opacity: 1; pointer-events: all;
  transform: translateY(0);
}
.screen-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--safe-top) + 60px);
  padding-bottom: 20px;
}

/* ── Voice Screen ────────────────────────────────────────────────────────── */
#voice-screen {
  display: flex; flex-direction: column;
  align-items: center;
}
.voice-content {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%;
  padding: calc(var(--safe-top) + 70px) 24px 20px;
  gap: 32px;
}
.voice-orb-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.orb-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(139,92,246,0.3);
  animation: none;
  transition: all 0.3s ease;
}
.orb-ring-1 { width: 160px; height: 160px; }
.orb-ring-2 { width: 200px; height: 200px; border-color: rgba(139,92,246,0.15); }
.orb-ring-3 { width: 240px; height: 240px; border-color: rgba(139,92,246,0.08); }

.orb-btn {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c4b5fd, #8B5CF6, #5b21b6);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 0 rgba(139,92,246,0.4), 0 8px 40px rgba(139,92,246,0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative; z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.orb-btn:active { transform: scale(0.94); }
.orb-btn svg { width: 44px; height: 44px; color: white; transition: all 0.3s ease; }

/* States */
.orb-btn.listening {
  box-shadow: 0 0 0 8px rgba(139,92,246,0.2), 0 0 0 16px rgba(139,92,246,0.1), 0 8px 40px rgba(139,92,246,0.5);
  animation: orb-pulse 1.5s ease-in-out infinite;
}
.orb-btn.listening .orb-ring-1 { animation: ring-pulse 1.5s ease-in-out infinite; }
.orb-btn.listening .orb-ring-2 { animation: ring-pulse 1.5s ease-in-out infinite 0.3s; }
.orb-btn.listening .orb-ring-3 { animation: ring-pulse 1.5s ease-in-out infinite 0.6s; }
.orb-btn.speaking {
  background: radial-gradient(circle at 35% 35%, #6ee7b7, #10b981, #065f46);
  box-shadow: 0 0 0 8px rgba(16,185,129,0.15), 0 8px 40px rgba(16,185,129,0.3);
  animation: orb-wave 0.8s ease-in-out infinite alternate;
}
.orb-btn.speaking ~ .orb-ring-1 { border-color: rgba(16,185,129,0.3); animation: ring-pulse-g 0.8s ease-in-out infinite; }

.voice-status {
  font-size: 16px; color: var(--text2); letter-spacing: 0.3px;
  min-height: 24px; text-align: center;
  transition: color 0.3s ease;
}
.voice-status.listening { color: var(--purple-light); }
.voice-status.speaking { color: var(--success); }

/* Voice waveform bars */
.voice-wave {
  display: flex; align-items: center; gap: 4px;
  height: 36px; opacity: 0;
  transition: opacity 0.3s ease;
}
.voice-wave.visible { opacity: 1; }
.wave-bar {
  width: 4px; border-radius: 2px;
  background: var(--purple-light);
  animation: none;
}
.voice-wave.listening .wave-bar { animation: wave-anim 0.8s ease-in-out infinite; }
.voice-wave.speaking .wave-bar {
  background: var(--success);
  animation: wave-anim-fast 0.5s ease-in-out infinite;
}
.wave-bar:nth-child(1) { animation-delay: 0s; height: 12px; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; height: 20px; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; height: 28px; }
.wave-bar:nth-child(4) { animation-delay: 0.15s; height: 24px; }
.wave-bar:nth-child(5) { animation-delay: 0.05s; height: 16px; }
.wave-bar:nth-child(6) { animation-delay: 0.25s; height: 20px; }
.wave-bar:nth-child(7) { animation-delay: 0.1s; height: 14px; }

/* Voice transcript */
.voice-transcript {
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 4px;
}
.vt-msg {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 15px; line-height: 1.5;
  max-width: 90%;
  animation: msg-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.vt-msg.user {
  background: var(--purple-dim);
  border: 1px solid rgba(139,92,246,0.2);
  align-self: flex-end;
  color: var(--purple-light);
}
.vt-msg.ai {
  background: var(--card);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text);
}

/* ── Chat Screen ─────────────────────────────────────────────────────────── */
#chat-screen {
  display: flex; flex-direction: column;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + 68px) 16px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 16px; line-height: 1.5;
  animation: msg-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  word-break: break-word;
}
.chat-bubble.user {
  background: var(--purple);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}
.chat-bubble.ai {
  background: var(--card2);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  border: 1px solid var(--border);
}
.chat-bubble.ai.thinking {
  color: var(--text3);
  font-style: italic;
}
.chat-bubble.ai.thinking::after {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text3);
  margin-left: 4px;
  animation: dot-blink 1.2s infinite;
}

.chat-bubble .bubble-time {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
  text-align: right;
}
.chat-bubble.ai .bubble-time { color: var(--text3); }

.chat-input-area {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  left: 0; right: 0;
  padding: 10px 16px;
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end;
  z-index: 20;
}
#chat-input {
  flex: 1;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
}
#chat-input:focus { border-color: var(--purple); }
#chat-input::placeholder { color: var(--text3); }
.chat-send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--purple);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(139,92,246,0.3);
  -webkit-tap-highlight-color: transparent;
}
.chat-send-btn:active { transform: scale(0.9); }
.chat-send-btn svg { width: 18px; height: 18px; color: white; }

/* ── Dashboard Screen ────────────────────────────────────────────────────── */
#dashboard-screen .screen-scroll { padding: 0; }
.dash-content {
  padding: calc(var(--safe-top) + 68px) 16px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.dash-greeting {
  font-size: 26px; font-weight: 700; letter-spacing: -0.5px;
}
.dash-greeting span { color: var(--purple-light); }
.dash-date { font-size: 14px; color: var(--text2); margin-top: 2px; }

/* Balance cards row */
.balance-row {
  display: flex; gap: 12px;
}
.balance-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.balance-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.balance-card.kraken::before { background: linear-gradient(90deg, #f97316, #fb923c); }
.balance-card.clawcard::before { background: linear-gradient(90deg, var(--purple), var(--purple-light)); }
.balance-label { font-size: 11px; color: var(--text2); font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }
.balance-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.balance-value.loading { color: var(--text3); font-size: 18px; }
.balance-change { font-size: 12px; }
.balance-change.positive { color: var(--success); }
.balance-change.negative { color: var(--danger); }

/* Section header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2px;
}
.section-title { font-size: 17px; font-weight: 600; }
.section-action { font-size: 13px; color: var(--purple-light); cursor: pointer; }

/* Quick Actions */
.quick-actions {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.quick-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}
.quick-btn:active { transform: scale(0.97); background: var(--card2); }
.quick-btn-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.quick-btn-icon svg { width: 20px; height: 20px; }
.quick-btn-label { font-size: 14px; font-weight: 600; }
.quick-btn-sub { font-size: 12px; color: var(--text2); }

/* Activity feed */
.activity-feed { display: flex; flex-direction: column; gap: 1px; }
.activity-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: background 0.15s ease;
}
.activity-item:first-child { border-radius: var(--radius) var(--radius) var(--radius-sm) var(--radius-sm); }
.activity-item:last-child { border-radius: var(--radius-sm) var(--radius-sm) var(--radius) var(--radius); }
.activity-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-icon svg { width: 18px; height: 18px; }
.activity-text { flex: 1; min-width: 0; }
.activity-title { font-size: 14px; font-weight: 500; }
.activity-time { font-size: 12px; color: var(--text2); margin-top: 1px; }
.activity-value { font-size: 14px; font-weight: 600; flex-shrink: 0; }

/* Workflow status */
.workflow-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 13px; color: var(--text2);
  cursor: pointer; transition: all 0.2s ease;
}
.workflow-pill.active { border-color: var(--success); color: var(--success); background: rgba(16,185,129,0.08); }
.workflow-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.workflow-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 8px rgba(139,92,246,0.2), 0 0 0 16px rgba(139,92,246,0.1), 0 8px 40px rgba(139,92,246,0.5); }
  50%       { transform: scale(1.04); box-shadow: 0 0 0 12px rgba(139,92,246,0.15), 0 0 0 24px rgba(139,92,246,0.07), 0 8px 48px rgba(139,92,246,0.6); }
}
@keyframes orb-wave {
  0%   { transform: scale(1); }
  100% { transform: scale(1.06); }
}
@keyframes ring-pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%       { opacity: 0.8; transform: scale(1.05); }
}
@keyframes ring-pulse-g {
  0%, 100% { border-color: rgba(16,185,129,0.3); }
  50%       { border-color: rgba(16,185,129,0.7); }
}
@keyframes wave-anim {
  0%, 100% { transform: scaleY(0.4); }
  50%       { transform: scaleY(1.0); }
}
@keyframes wave-anim-fast {
  0%, 100% { transform: scaleY(0.5); }
  50%       { transform: scaleY(1.0); }
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
@keyframes dot-blink {
  0%, 80%, 100% { opacity: 0; }
  40%            { opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.fade-in { animation: fade-in 0.3s ease; }

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Toast */
#toast {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%; transform: translateX(-50%) translateY(-80px);
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 20px;
  font-size: 14px; color: var(--text);
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  backdrop-filter: blur(16px);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* Settings overlay */
#settings-panel {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  justify-content: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
#settings-panel.open { opacity: 1; pointer-events: all; }
.settings-sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 16px 24px calc(var(--safe-bottom) + 16px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#settings-panel.open .settings-sheet { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-row label { color: var(--text2); font-size: 14px; }
.settings-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px; font-family: inherit;
  outline: none;
  width: 220px;
  -webkit-appearance: none;
}
.settings-input:focus { border-color: var(--purple); }
.settings-btn {
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
  -webkit-tap-highlight-color: transparent;
}
.gear-btn {
  width: 36px; height: 36px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gear-btn svg { width: 18px; height: 18px; color: var(--text2); }

/* ── Camera Button in Voice Screen ──────────────────────────────────────── */
.voice-actions-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: -8px;
}
.voice-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 28px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.voice-action-btn:active { transform: scale(0.95); }
.voice-action-btn svg { width: 22px; height: 22px; }
.voice-action-btn.active {
  background: var(--purple-dim);
  border-color: var(--purple);
  color: var(--purple-light);
}

/* ── Camera Overlay ──────────────────────────────────────────────────────── */
.camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
}
.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-ui {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.camera-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 100%);
}
.camera-icon-btn {
  width: 44px; height: 44px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.camera-icon-btn:active { transform: scale(0.9); }
.camera-status-text {
  flex: 1;
  font-size: 14px; font-weight: 500;
  color: white;
  text-align: center;
  padding: 0 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.camera-frame-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.camera-frame {
  position: relative;
  width: 220px; height: 220px;
}
.cf-corner {
  position: absolute;
  width: 28px; height: 28px;
  border-color: var(--purple);
  border-style: solid;
  border-width: 0;
}
.cf-tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-radius: 4px 0 0 0; }
.cf-tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.cf-bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 4px; }
.cf-br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }
.camera-bottom-bar {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.camera-hint {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.camera-snap-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--purple);
  border: 4px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 24px rgba(139,92,246,0.5);
  -webkit-tap-highlight-color: transparent;
}
.camera-snap-btn:active { transform: scale(0.9); }
.camera-result {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 148px);
  left: 16px; right: 16px;
  background: rgba(10,10,10,0.92);
  border: 1px solid var(--purple);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px; line-height: 1.5;
  color: var(--text);
  backdrop-filter: blur(12px);
  animation: msg-in 0.3s ease;
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.camera-flash {
  position: absolute;
  inset: 0;
  background: white;
  pointer-events: none;
  animation: flash-out 0.35s ease forwards;
}
@keyframes flash-out {
  from { opacity: 0.7; }
  to   { opacity: 0; }
}

/* ── Memories Panel ──────────────────────────────────────────────────────── */
.memories-panel {
  position: fixed; inset: 0; z-index: 920;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  justify-content: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.memories-panel.open { opacity: 1; pointer-events: all; }
.memories-sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 16px 20px calc(var(--safe-bottom) + 16px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 80vh;
  display: flex; flex-direction: column;
}
.memories-panel.open .memories-sheet { transform: translateY(0); }
.memories-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.memories-close-btn {
  width: 34px; height: 34px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.memories-grid {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  display: flex; flex-direction: column; gap: 8px;
}
.memories-empty {
  text-align: center; color: var(--text3);
  font-size: 15px; padding: 40px 20px; line-height: 1.8;
}
.memory-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.memory-card:active { background: var(--purple-dim); }
.memory-thumb {
  width: 60px; height: 44px;
  border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.memory-thumb-icon {
  width: 60px; height: 44px;
  border-radius: 8px;
  background: var(--purple-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.memory-info { flex: 1; min-width: 0; }
.memory-date { font-size: 11px; color: var(--text3); margin-bottom: 2px; }
.memory-summary { font-size: 13px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memory-delete {
  width: 28px; height: 28px;
  background: rgba(239,68,68,0.1);
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--danger); cursor: pointer; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Memory detail overlay */
.memory-detail-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.memory-detail-sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 16px 20px calc(var(--safe-bottom) + 16px);
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.memory-detail-img {
  width: 100%; max-height: 280px;
  object-fit: contain; border-radius: var(--radius-sm);
  margin-bottom: 16px; background: #000;
}
.memory-detail-noimg {
  text-align: center; font-size: 48px;
  padding: 24px; margin-bottom: 16px;
}

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 0; background: transparent; }

/* iOS input zoom prevent */
@media (max-width: 768px) {
  input, textarea, select { font-size: 16px !important; }
}
