:root {
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --border: #2a313c;
  --text: #e6edf3;
  --text-dim: #9aa4b2;
  --accent: #1f6feb;
  --accent-dim: #17335c;
  --danger: #e5534b;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:active { background: var(--bg-elevated); }

.content {
  flex: 1;
  padding: 12px 16px 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}
.btn:active { opacity: 0.85; }
.btn.secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.danger { background: var(--danger); }
.btn.block { margin-top: 12px; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
}
.card:active { border-color: var(--accent); }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card p { margin: 0; color: var(--text-dim); font-size: 13px; }
.card .meta { display: flex; justify-content: space-between; align-items: center; }
.card .count {
  font-size: 12px;
  background: var(--accent-dim);
  color: #9cc2ff;
  padding: 2px 8px;
  border-radius: 999px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 48px 16px;
}
.empty-state .big { font-size: 40px; margin-bottom: 8px; }

.field {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  margin-bottom: 12px;
}

.record-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-top: 24px;
}
.record-timer {
  font-size: 15px;
  color: var(--text-dim);
}
.record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 0 0 8px rgba(229, 83, 75, 0.15);
}
.record-btn.idle { background: var(--accent); box-shadow: 0 0 0 8px rgba(31, 111, 235, 0.15); }
.record-btn.recording { animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 83, 75, 0.35); }
  70% { box-shadow: 0 0 0 18px rgba(229, 83, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 83, 75, 0); }
}

.transcript-box {
  width: 100%;
  min-height: 160px;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.transcript-box .interim { color: var(--text-dim); }

.processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 80px;
  color: var(--text-dim);
  text-align: center;
}
.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-right: 14px;
}
.tab-btn.active { color: var(--text); border-color: var(--accent); }

.category-block { margin-bottom: 18px; }
.category-block h4 { margin: 0 0 8px; font-size: 15px; color: #9cc2ff; }
.category-block ul { margin: 0; padding-left: 20px; }
.category-block li { margin-bottom: 6px; line-height: 1.4; }

.summary-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 18px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.5;
}

.concept-map-wrap {
  width: 100%;
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.concept-node rect {
  fill: var(--accent-dim);
  stroke: var(--accent);
  stroke-width: 1.5;
}
.concept-node text {
  fill: var(--text);
  font-size: 11px;
}
.concept-node.dim rect { opacity: 0.25; }
.concept-node.dim text { opacity: 0.3; }

.concept-edge line {
  stroke: var(--text-dim);
  stroke-width: 1.4;
}
.concept-edge text {
  fill: var(--text-dim);
  font-size: 9px;
}
.concept-edge.highlight line { stroke: var(--accent); stroke-width: 2.2; }
.concept-edge.highlight text { fill: #9cc2ff; }
.concept-edge.dim line { opacity: 0.15; }
.concept-edge.dim text { opacity: 0.15; }

.week-range { color: var(--text-dim); font-size: 13px; margin: 4px 0 14px; }

.note-actions { display: flex; gap: 10px; margin-top: 20px; }
.note-actions .btn { width: auto; flex: 1; }

.banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.banner.error { border-left-color: var(--danger); color: #f3b0ac; }
