:root {
  color-scheme: dark;
  --bg: #070708;
  --panel: #111114;
  --panel-2: #17171b;
  --panel-3: #1d1d22;
  --line: #2a2a31;
  --line-soft: rgba(255, 255, 255, 0.07);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #8b5cf6;
  --accent-2: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --blue: #38bdf8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% -120px, rgba(139, 92, 246, 0.16), transparent 280px),
    linear-gradient(180deg, #0c0c0f 0%, #070708 48%);
  color: var(--text);
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 55%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

.mobile-app {
  position: relative;
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom));
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -14px -14px 14px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 7, 8, 0.82);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.brand-mark,
.command-mark,
.lens-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #1c1c21, #101014);
  color: #f7f7f8;
  font-size: 12px;
  font-weight: 750;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.top-actions,
.button-row,
.composer-toolbar,
.demo-actions,
.candidate-actions,
.memory-actions,
.oauth-actions,
.model-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-actions {
  flex-wrap: nowrap;
}

.page-hero {
  padding: 18px 2px 6px;
}

.page-hero.compact {
  padding-top: 12px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 32px;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
}

p {
  line-height: 1.6;
}

.demo-hint,
.demo-hint-chip,
.privacy-chip,
.subtle-label {
  color: var(--muted);
}

.demo-hint {
  font-size: 13px;
}

.demo-hint-chip,
.privacy-chip,
.subtle-label,
.model-status-chip,
.oauth-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  white-space: nowrap;
}

.model-status-chip.ready,
.oauth-status.connected {
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
  background: rgba(34, 197, 94, 0.1);
}

.model-status-chip.mock {
  border-color: rgba(245, 158, 11, 0.28);
  color: #facc15;
  background: rgba(245, 158, 11, 0.08);
}

.surface {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
  box-shadow: var(--shadow);
}

.section-heading,
.commitment-item-header,
.work-record-header,
.memory-group-header,
.mirror-history-header,
.draft-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading.compact {
  margin-top: 14px;
}

.section-heading h2,
.section-heading .eyebrow,
.section-heading p {
  margin-bottom: 0;
}

.text-link,
.primary-link {
  color: #d8b4fe;
  font-size: 13px;
  font-weight: 700;
}

.primary-link {
  display: inline-flex;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid rgba(139, 92, 246, 0.42);
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.14);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stat-card {
  min-width: 0;
  padding: 11px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-card span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1;
}

.quick-stack,
.lens-list,
.commitment-list,
.memory-list,
.mirror-history-list,
.work-record-list,
.candidate-list,
.oauth-source-list {
  display: grid;
  gap: 10px;
}

.command-row,
.lens-button,
.oauth-source,
.work-record-item,
.commitment-item,
.memory-item,
.mirror-history-item,
.candidate-item,
.memory-group {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(17, 17, 20, 0.75);
}

.command-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.command-row strong,
.command-row small,
.lens-card-main strong,
.lens-card-main small {
  display: block;
}

.command-row small,
.lens-card-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sync-strip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.sync-strip strong {
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(12, 12, 15, 0.92);
  backdrop-filter: blur(20px);
}

.bottom-nav a {
  display: grid;
  min-height: 42px;
  place-items: center;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.bottom-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

button,
.small-button,
.primary-button,
.ghost-button,
.danger-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.small-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.primary-button,
.ghost-button,
.danger-button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 750;
}

.primary-button {
  border-color: rgba(139, 92, 246, 0.5);
  background: linear-gradient(180deg, #7c3aed, #5b21b6);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.05);
}

.danger-button {
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
}

.save {
  border-color: rgba(34, 197, 94, 0.32);
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
}

.full {
  width: 100%;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.field-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #0b0b0d;
}

input,
select {
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16);
}

summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

details[open] summary {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.lens-button {
  display: grid;
  gap: 10px;
}

.lens-card-main {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.thinking-model-card.active {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.12);
}

.chat-surface {
  border-color: rgba(139, 92, 246, 0.22);
}

.chat-messages {
  display: grid;
  max-height: 230px;
  overflow: auto;
  gap: 8px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.chat-message {
  display: flex;
}

.chat-message span {
  display: inline-block;
  max-width: 92%;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  line-height: 1.5;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message.user span {
  border-color: rgba(139, 92, 246, 0.35);
  color: var(--text);
  background: rgba(139, 92, 246, 0.16);
}

.chat-message.assistant span {
  color: #d4d4d8;
}

.chat-message.system span,
.chat-message.system {
  color: var(--faint);
}

.voice-button {
  display: grid;
  width: 100%;
  min-height: 72px;
  place-items: center;
  border-color: rgba(139, 92, 246, 0.38);
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.28), rgba(139, 92, 246, 0.11)),
    #111114;
  font-size: 16px;
  font-weight: 800;
}

.voice-button.is-listening {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.16);
}

.voice-status {
  margin: 9px 0 12px;
  text-align: center;
}

.composer-toolbar {
  margin-bottom: 10px;
}

.composer-drawer {
  margin-bottom: 10px;
}

.result-zone {
  display: grid;
  gap: 12px;
}

.reflection-card,
.action-demo-zone,
.draft-output,
.mirror-output {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
}

.reflection-card p:last-child,
.action-demo-zone p:last-child,
.mirror-output p:last-child {
  margin-bottom: 0;
}

.evidence-list,
.demo-list {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  padding-left: 18px;
  color: #d4d4d8;
  font-size: 13px;
}

.question {
  color: #e9d5ff;
  font-weight: 700;
}

.option-row,
.feedback-grid,
.adjustment-presets {
  display: grid;
  gap: 8px;
}

.option-button {
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  text-align: left;
}

.option-type {
  display: inline-flex;
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
}

.option-action {
  border-color: rgba(34, 197, 94, 0.28);
}

.option-action .option-type {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.14);
}

.option-adjust {
  border-color: rgba(56, 189, 248, 0.28);
}

.option-adjust .option-type {
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.13);
}

.option-correction {
  border-color: rgba(239, 68, 68, 0.28);
}

.option-correction .option-type {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.13);
}

.adjustment-preset {
  width: 100%;
  padding: 10px;
  text-align: left;
}

.adjustment-preset strong,
.adjustment-preset span {
  display: block;
}

.adjustment-preset span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.adjustment-preset.active {
  border-color: rgba(56, 189, 248, 0.48);
  background: rgba(56, 189, 248, 0.1);
}

.candidate-item textarea,
.draft-textarea {
  margin: 10px 0;
}

.candidate-meta,
.memory-meta {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.commitment-item.selected {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.1);
}

.commitment-item-header span,
.work-record-header span,
.mirror-history-header span,
.draft-meta span {
  color: var(--faint);
  font-size: 12px;
  text-align: right;
}

.commitment-item p,
.work-record-item p,
.memory-item p,
.mirror-history-item p {
  margin: 8px 0;
  color: #d4d4d8;
}

.draft-textarea {
  min-height: 300px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.draft-next {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.draft-next span {
  padding: 5px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
}

.filter-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.filter-button {
  min-height: 34px;
  padding: 7px 10px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-button.active {
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.48);
  background: rgba(139, 92, 246, 0.14);
}

.memory-group-header {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.memory-group-body {
  display: grid;
  gap: 9px;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.switch-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.oauth-source {
  display: grid;
  gap: 10px;
}

.oauth-source p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

code {
  color: #e9d5ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

@media (max-width: 374px) {
  .mobile-app {
    padding-right: 10px;
    padding-left: 10px;
  }

  h1 {
    font-size: 28px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-actions .danger-button {
    display: none;
  }
}

@media (min-width: 720px) {
  body {
    background:
      radial-gradient(circle at 50% -160px, rgba(139, 92, 246, 0.15), transparent 340px),
      #070708;
  }

  .mobile-app {
    padding-top: 18px;
  }

  .bottom-nav,
  .mobile-topbar {
    border-right: 1px solid var(--line-soft);
    border-left: 1px solid var(--line-soft);
  }
}
