:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1c1f23;
  --muted: #7a828c;
  --accent: #2f6fed;
  --danger: #d1443c;
  --ok: #2c9c62;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1c1f24;
    --border: #2b3038;
    --text: #e7eaee;
    --muted: #949ca7;
    --accent: #6f9dff;
    --danger: #f0736a;
    --ok: #5ac48b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.muted,
.dot {
  color: var(--muted);
  font-size: 12px;
}

/* Layout */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0 auto;
  max-width: 900px;
  padding: 20px;
}

/* Topbar */
.topbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-bottom: 12px;
}

.topbar__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.topbar__meta {
  align-items: center;
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px;
}

/* Status */
.status {
  font-size: 12px;
  color: var(--muted);
}

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

/* Pulsing dot: shows at a glance that the realtime stream is connected. */
.status--live::before {
  animation: pulse 2s ease-in-out infinite;
  background: var(--ok);
  border-radius: 50%;
  content: '';
  display: inline-block;
  height: 7px;
  margin-right: 5px;
  vertical-align: baseline;
  width: 7px;
}

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

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status--live::before {
    animation: none;
  }
}

/* Editor */
.note {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.65;
  min-height: 0;
  outline: none;
  padding: 16px 20px;
  resize: none;
  width: 100%;
}

.note:focus {
  border-color: var(--accent);
}

.note:disabled {
  opacity: 0.6;
}

/* Buttons */
.btn {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 12px;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--muted);
}

/* Toast */
.toast {
  background: var(--text);
  border-radius: 8px;
  bottom: 24px;
  color: var(--panel);
  font-size: 13px;
  left: 50%;
  opacity: 0;
  padding: 8px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

@media (max-width: 600px) {
  .app {
    padding: 12px;
  }
}
