:root {
  color-scheme: dark;
  --ink: #f7f2e9;
  --muted: #9c948a;
  --panel: #201f1d;
  --panel-2: #2a2825;
  --line: #393632;
  --orange: #ff5a1f;
  --orange-soft: #5a2c1c;
  --green: #5ed09b;
  --danger: #ff756f;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #11110f;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button,
textarea { font: inherit; }

button { color: inherit; }

#app {
  width: 100vw;
  height: 100vh;
  max-width: 240px;
  max-height: 282px;
  margin: auto;
  display: grid;
  grid-template-rows: 45px minmax(0, 1fr) 42px;
  background:
    radial-gradient(circle at 80% -20%, rgba(255, 90, 31, .22), transparent 45%),
    #151513;
  border: 1px solid #272522;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 5px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 1px;
  color: var(--orange);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .14em;
}

h1 {
  margin: 0;
  font-size: 16px;
  line-height: 1;
  letter-spacing: -.03em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(94, 208, 155, .12);
}

.status-dot.busy {
  background: var(--orange);
  animation: pulse 1s infinite;
}

.screen {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: 8px 9px 10px;
}

.screen::-webkit-scrollbar { display: none; }

.hero-card,
.card {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
}

.hero-card { padding: 10px; }

.hero-row,
.row,
.section-head,
.entry-meta,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.day-score {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.day-score strong { font-size: 26px; line-height: 1; }
.day-score span { color: var(--muted); font-size: 9px; }

.mood-big { font-size: 25px; }

.progress {
  height: 4px;
  margin: 8px 0 3px;
  overflow: hidden;
  border-radius: 99px;
  background: #0f0f0e;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), #ffaf45);
}

.hint,
.muted {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 6px;
  margin-top: 7px;
}

.record-cta { font-size: 10px; }

.voice-hint {
  margin: 4px 1px 0;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}

.btn {
  min-height: 35px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.btn:active { transform: scale(.97); }
.btn.primary { border-color: var(--orange); background: var(--orange); color: white; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 27px; padding: 4px 8px; font-size: 9px; }
.btn:disabled { opacity: .5; }

.section-head { margin: 9px 1px 5px; }
.section-head h2 { margin: 0; font-size: 10px; }

.entry-list { display: grid; gap: 5px; }

.entry {
  padding: 7px 8px;
  border-left: 2px solid var(--orange);
  border-radius: 7px;
  background: rgba(255, 255, 255, .045);
}

.entry p {
  margin: 3px 0 0;
  font-size: 10px;
  line-height: 1.28;
  white-space: pre-wrap;
}

.entry-meta { color: var(--muted); font-size: 8px; }
.empty { padding: 14px 7px; text-align: center; color: var(--muted); font-size: 10px; }

.capture-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 69px;
  resize: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  line-height: 1.3;
}

textarea:focus { border-color: var(--orange); }

.dictate {
  width: 100%;
  min-height: 38px;
  margin: 6px 0;
  border: 1px solid var(--orange);
  border-radius: 10px;
  background: var(--orange-soft);
  font-size: 10px;
  font-weight: 800;
}

.dictate.listening { background: var(--orange); animation: pulse 1s infinite; }

.dictate:disabled { opacity: .75; }

.voice-status {
  min-height: 20px;
  margin: -1px 3px 6px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
  text-align: center;
}

.mood-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin: 4px 0 7px;
}

.mood-btn {
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-size: 15px;
}

.mood-btn.selected { border-color: var(--orange); background: var(--orange-soft); }

.summary-card {
  padding: 9px;
  border-radius: 10px;
  background: linear-gradient(145deg, #2b211c, #1f1d1a);
  border: 1px solid #513326;
}

.summary-card h2 { margin: 0 0 5px; font-size: 12px; }
.summary-card p { margin: 0; color: #ded7cc; font-size: 10px; line-height: 1.35; }

.insight-grid { display: grid; gap: 5px; margin-top: 6px; }

.insight {
  padding: 6px 7px;
  border-radius: 7px;
  background: rgba(255,255,255,.045);
}

.insight b { display: block; margin-bottom: 2px; color: var(--orange); font-size: 8px; text-transform: uppercase; }
.insight span { font-size: 9px; line-height: 1.25; }

.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-bottom: 7px; }
.day-pill { padding: 5px 0; border-radius: 7px; background: var(--panel); text-align: center; }
.day-pill b { display: block; font-size: 8px; }
.day-pill span { display: block; margin-top: 2px; font-size: 12px; }
.day-pill.today { outline: 1px solid var(--orange); }

.loading {
  min-height: 94px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}

.spinner {
  width: 23px;
  height: 23px;
  margin: auto;
  border: 3px solid var(--line);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: #121210;
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 8px;
  line-height: 1;
}

.nav-item span { display: block; margin-bottom: 3px; font-size: 13px; }
.nav-item.active { color: var(--orange); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  z-index: 9;
  max-width: 210px;
  padding: 6px 9px;
  transform: translate(-50%, 12px);
  border-radius: 8px;
  background: #f2ece2;
  color: #181715;
  font-size: 9px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }

@media (min-width: 241px), (min-height: 283px) {
  body { display: grid; place-items: center; background: #0b0b0a; }
  #app { box-shadow: 0 20px 70px rgba(0,0,0,.5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
