/* ──────────────────────────────────────
   Reset & Base
────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1c1c1c;
  --accent: #ff3b30;
  --accent-dim: rgba(255, 59, 48, 0.15);
  --text-primary: #f5f5f5;
  --text-secondary: #8a8a8a;
  --text-tertiary: #4a4a4a;
  --border: #242424;
  --green: #34c759;
  --blue: #0a84ff;
  --yellow: #ffd60a;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ──────────────────────────────────────
   Screen Manager
────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ──────────────────────────────────────
   Header
────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.result-title {
  font-size: 16px;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 12px;
}

.today-date {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.recording-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

.back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  transition: background 0.15s;
}

.back-btn:active {
  background: var(--border);
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

/* ──────────────────────────────────────
   Home Screen
────────────────────────────────────── */
.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 24px 32px;
  gap: 40px;
}

.record-area {
  display: flex;
  justify-content: center;
  padding: 48px 0 16px;
}

.record-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}

.record-btn::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--accent-dim);
  animation: pulse 2.5s ease-out infinite;
}

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

.record-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(255, 59, 48, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  z-index: 1;
}

.record-btn:active .record-icon {
  transform: scale(0.93);
  box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3);
}

.record-icon svg {
  width: 44px;
  height: 44px;
  color: white;
}

.record-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* Recent list */
.recent-section {
  flex: 1;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meeting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.meeting-card:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

.card-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.card-arrow {
  color: var(--text-tertiary);
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: 32px 0;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ──────────────────────────────────────
   Recording Screen
────────────────────────────────────── */
.recording-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 32px 24px;
}

#screen-recording {
  background: var(--bg);
}

#screen-recording.active {
  background: radial-gradient(ellipse at center 40%, rgba(255,59,48,0.08) 0%, var(--bg) 65%);
}

.timer-display {
  font-size: 72px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  color: var(--text-primary);
}

.waveform-area {
  width: 100%;
  max-width: 280px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.waveform {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.wave-bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  height: 12px;
  opacity: 0.6;
  animation: wave 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(1)  { animation-delay: 0.0s; }
.wave-bar:nth-child(2)  { animation-delay: 0.1s; }
.wave-bar:nth-child(3)  { animation-delay: 0.2s; }
.wave-bar:nth-child(4)  { animation-delay: 0.3s; }
.wave-bar:nth-child(5)  { animation-delay: 0.4s; }
.wave-bar:nth-child(6)  { animation-delay: 0.5s; }
.wave-bar:nth-child(7)  { animation-delay: 0.4s; }
.wave-bar:nth-child(8)  { animation-delay: 0.3s; }
.wave-bar:nth-child(9)  { animation-delay: 0.2s; }
.wave-bar:nth-child(10) { animation-delay: 0.1s; }
.wave-bar:nth-child(11) { animation-delay: 0.05s; }
.wave-bar:nth-child(12) { animation-delay: 0.0s; }

@keyframes wave {
  0%, 100% { height: 12px; opacity: 0.5; }
  50% { height: 48px; opacity: 1; }
}

.stop-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: none;
  border: none;
  cursor: pointer;
}

.stop-icon {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s;
}

.stop-btn:active .stop-icon {
  transform: scale(0.93);
  background: var(--bg-card-hover);
}

.stop-icon svg {
  width: 40px;
  height: 40px;
  color: var(--text-primary);
}

/* ──────────────────────────────────────
   Processing Screen
────────────────────────────────────── */
.processing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 32px 24px;
}

.processing-spinner {
  width: 80px;
  height: 80px;
  position: relative;
}

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

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

.processing-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 280px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.3s;
}

.step.pending {
  opacity: 0.3;
}

.step-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ──────────────────────────────────────
   Result Screen
────────────────────────────────────── */
.result-main {
  flex: 1;
  padding: 20px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.result-meta {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.result-section {}

.result-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.result-summary-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
}

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.result-list li::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.decisions-list li::before {
  background: var(--blue);
}

.todos-list li::before {
  background: var(--accent);
}

.contacts-list li::before {
  background: var(--green);
}

.result-actions {
  padding-top: 8px;
}

.notion-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.notion-btn:active {
  background: var(--bg-card-hover);
  transform: scale(0.98);
}

/* ──────────────────────────────────────
   Utility
────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f2f7;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5f5;
    --text-primary: #1c1c1e;
    --text-secondary: #6c6c70;
    --text-tertiary: #aeaeb2;
    --border: #e5e5ea;
  }

  #screen-recording.active {
    background: radial-gradient(ellipse at center 40%, rgba(255,59,48,0.06) 0%, var(--bg) 65%);
  }
}
