:root {
  --bg: #0e1116;
  --bg2: #161b22;
  --card: #1c2230;
  --txt: #e6edf3;
  --muted: #8b949e;
  --accent: #7ee787;
  --accent2: #58a6ff;
  --danger: #ff7b72;
  --line: #2a313c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

/* ── dashboard ───────────────────────────── */
.hero h1 {
  margin: 0 0 4px;
  font-size: 34px;
  letter-spacing: 1px;
}

.hero .sub {
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  text-transform: lowercase;
}

.tagline {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 22px;
}

.tagline em {
  color: var(--muted);
  font-style: normal;
  opacity: .8;
}

.bigbtn {
  display: block;
  text-align: center;
  padding: 18px;
  border-radius: 16px;
  background: var(--accent);
  color: #06120a;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 26px;
  box-shadow: 0 8px 24px rgba(126, 231, 135, .18);
}

.hint {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 26px;
}

.hint code {
  background: #0b0e13;
  padding: 1px 5px;
  border-radius: 5px;
}

button.bigbtn {
  width: 100%;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button.bigbtn:disabled {
  opacity: 0.55;
  cursor: default;
}

.mic-status {
  text-align: center;
  font-size: 14px;
  margin: -14px 0 26px;
  min-height: 1em;
}

.mic-status.ok {
  color: var(--accent);
}

.mic-status.ask {
  color: var(--muted);
}

.mic-status.bad {
  color: var(--danger);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

ul.notes,
ul.sessions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notes li a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  color: var(--txt);
  text-decoration: none;
  flex-wrap: wrap;
}

.notes li:last-child a {
  border-bottom: none;
}

.np {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: -2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reflect-meta {
  background: var(--bg2);
}

.last-note {
  color: var(--txt);
  font-size: 14px;
  margin: 0;
}

.last-note #lastRefl {
  color: var(--accent);
}

.date {
  font-weight: 700;
  min-width: 96px;
}

.mood {
  font-size: 18px;
}

.moodword {
  color: var(--accent2);
}

.tags {
  color: var(--muted);
  font-size: 13px;
  margin-left: auto;
}

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

.sessions li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.sessions li:last-child {
  border-bottom: none;
}

.sessions a {
  color: var(--accent2);
  text-decoration: none;
}

.pill {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  color: var(--muted);
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 30px;
}

/* ── call page ───────────────────────────── */
.call .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.call-head {
  width: 100%;
  text-align: center;
}

.call-head h1 {
  font-size: 22px;
  margin: 0;
}

.call-head .sub {
  color: var(--muted);
  font-weight: 400;
}

.status {
  margin-top: 6px;
  font-size: 15px;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg2);
  display: inline-block;
}

.status.listening {
  color: var(--accent2);
}

.status.thinking {
  color: #f0c674;
}

.status.speaking {
  color: var(--accent);
}

.status.ended {
  color: var(--muted);
}

.status.failed {
  color: var(--danger);
}

.orb {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 34px 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #243043, #131822);
  border: 1px solid var(--line);
  transition: all .3s ease;
}

.orb .orb-dot {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .5;
}

.orb.listening {
  border-color: var(--accent2);
}

.orb.listening .orb-dot {
  background: var(--accent2);
  opacity: 1;
  animation: pulse 1.6s infinite;
}

.orb.thinking {
  border-color: #f0c674;
}

.orb.thinking .orb-dot {
  background: #f0c674;
  opacity: .9;
  animation: pulse 1.2s infinite;
}

.orb.speaking {
  border-color: var(--accent);
}

.orb.speaking .orb-dot {
  background: var(--accent);
  opacity: 1;
  animation: pulse .8s infinite;
}

.orb.ended .orb-dot {
  background: var(--accent);
  opacity: .7;
}

.orb.failed .orb-dot {
  background: var(--danger);
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }

  100% {
    transform: scale(1);
  }
}

.transcript {
  width: 100%;
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.45;
}

.line.user {
  align-self: flex-end;
  background: var(--accent2);
  color: #06121f;
}

.line.bot {
  align-self: flex-start;
  background: var(--bg2);
  border: 1px solid var(--line);
}

.controls {
  margin-top: 8px;
}

.hangup {
  background: var(--danger);
  color: #1b0807;
  border: none;
  padding: 13px 30px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.hangup:disabled {
  opacity: .4;
  cursor: default;
}

.start {
  background: var(--accent, #4c8dff);
  color: #06121f;
  border: none;
  padding: 13px 30px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.start:disabled {
  opacity: .4;
  cursor: default;
}

.token-entry {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.token-entry input {
  background: #161b22;
  color: #e6edf3;
  border: 1px solid #2a313c;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
}

.token-entry input:focus {
  outline: none;
  border-color: var(--accent, #4c8dff);
}

.err {
  color: var(--danger);
  font-size: 14px;
  min-height: 1em;
}

/* ── note page ───────────────────────────── */
.note .back {
  color: var(--accent2);
  text-decoration: none;
  font-size: 14px;
}

.big-mood {
  font-size: 56px;
  text-align: center;
  margin: 6px 0 4px;
}

.md {
  line-height: 1.7;
  font-size: 16px;
}

.md h1 {
  font-size: 26px;
}

.md h2 {
  margin-top: 26px;
  color: var(--accent);
  font-size: 18px;
}

.md hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}

.md strong {
  color: var(--txt);
}

.md em {
  color: var(--muted);
}

.md code {
  background: #0b0e13;
  padding: 1px 5px;
  border-radius: 5px;
}

/* Thinking section is the heart of 自省 — give it a visual anchor distinct
   from the other note sections, both in the side-panel note card and on the
   standalone note page (markdown-rendered). Medium intensity (decision A): a
   soft left rule + the warm accent + a 💭 marker, without breaking the journal's
   overall calm. */
.nc-sec.is-thinking {
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  margin-left: -2px;
}

.nc-sec.is-thinking .nc-h {
  color: var(--accent);
}

.nc-sec.is-thinking .nc-h::before {
  content: "💭 ";
}

.md h2.thinking-sec {
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin-left: -13px;
}

.md h2.thinking-sec::before {
  content: "💭 ";
}

/* ── side panel (settings + history) ─────────────────────────────────────── */
.panel-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--txt);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(92vw, 420px);
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
}

.panel.open {
  transform: translateX(0);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.panel-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}

.panel-tab.active {
  color: var(--txt);
  border-bottom-color: var(--accent);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.pane {
  display: block;
}

.panel-field {
  margin-bottom: 16px;
}

.panel-field label {
  display: block;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
}

.panel-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.panel-field textarea {
  width: 100%;
  background: var(--bg2);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.panel-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.panel-save {
  background: var(--accent);
  color: #06120a;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.panel-ghost {
  background: var(--bg2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}

.panel-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  min-height: 1em;
}

.panel-subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.subtab {
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.subtab.active {
  color: var(--txt);
  border-color: var(--accent);
  background: var(--bg2);
}

.history-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}

.history-item:hover {
  border-color: var(--accent);
  background: var(--bg2);
}

.hi-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.hi-date {
  font-weight: 700;
  font-size: 14px;
}

.hi-preview {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-back {
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
  font-size: 14px;
  padding: 0 0 12px;
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.hline {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.hline.user {
  align-self: flex-end;
  background: var(--accent2);
  color: #06121f;
}

.hline.bot {
  align-self: flex-start;
  background: var(--bg2);
  border: 1px solid var(--line);
}

.note-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.nc-mood {
  font-size: 24px;
}

.nc-mood .moodword {
  font-size: 16px;
  margin-left: 6px;
}

.nc-date {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 12px;
}

.nc-summary {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.nc-sec {
  margin-bottom: 10px;
}

.nc-h {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  margin-bottom: 2px;
}

.nc-b {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.nc-tags {
  color: var(--accent2);
  font-size: 13px;
  margin-top: 8px;
}