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

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --border: #e8e6e0;
  --border-2: #d4d1c9;
  --text-primary: #1a1916;
  --text-secondary: #6b6860;
  --text-muted: #a09e99;
  --accent: #2c5282;
  --accent-light: #ebf0f8;
  --danger: #c53030;
  --danger-light: #fff5f5;
  --success: #276749;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141412;
    --surface: #1e1d1b;
    --surface-2: #252422;
    --border: #2e2c29;
    --border-2: #3d3b37;
    --text-primary: #f0ede8;
    --text-secondary: #9e9b95;
    --text-muted: #5e5c58;
    --accent: #90b4e8;
    --accent-light: #1a2535;
    --danger: #fc8181;
    --danger-light: #2d1a1a;
    --success: #68d391;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  }
}

html, body {
  height: 100%;
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.badge.recording {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.badge.done {
  background: #f0faf4;
  border-color: var(--success);
  color: var(--success);
}

@media (prefers-color-scheme: dark) {
  .badge.done {
    background: #1a2d22;
  }
}

/* Main Layout */
.main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-footer {
  padding: 8px 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
}

.char-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-2);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  padding: 6px 8px;
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border);
}

.btn-record {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-record:hover:not(:disabled) {
  background: var(--accent);
  color: white;
}

.btn-stop {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-stop:hover:not(:disabled) {
  background: var(--danger);
  color: white;
}

.btn-summarize {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg);
  padding: 6px 16px;
}

.btn-summarize:hover:not(:disabled) {
  opacity: 0.85;
  background: var(--text-primary);
}

/* Transcript */
.transcript-box,
.summary-box {
  padding: 1.25rem;
  min-height: 160px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
  word-break: keep-all;
  scroll-behavior: smooth;
}

.placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.interim {
  color: var(--text-muted);
}

/* Summary */
.summary-box {
  white-space: pre-wrap;
}

/* Loading */
.loading-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
}

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

.dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: bounce 1.2s infinite;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Recording pulse on badge */
@keyframes pulse-border {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.badge.recording {
  animation: pulse-border 1.2s infinite;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; }

/* Responsive */
@media (max-width: 600px) {
  .main { padding: 1rem; }
  .header { padding: 0 1rem; }
  .controls { gap: 4px; }
  .btn { padding: 5px 10px; }
  .timer { display: none; }
}
