/* ============================================================================
   Signal — on-the-spot fuel. Dark, quiet, one line at a time.
   Design intent: a command-line / operator console, not an affirmation poster.
   Near-black backdrop, a single faint accent (signal cyan), big restrained type.
   ========================================================================== */

:root {
  --bg:        #0B0D10;   /* near-black backdrop */
  --bg-lift:   #12161B;   /* faint lift for chips/cards */
  --ink:       #ECEFF3;   /* primary text */
  --ink-dim:   #7C8794;   /* secondary text */
  --ink-faint: #424B55;   /* hairlines, idle glyphs */
  --accent:    #36D6C3;   /* "signal" cyan — used sparingly */
  --accent-dim:#1C6B63;
  --radius:    16px;
  --tap:       44px;      /* min touch target */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

/* A very subtle radial so the stage doesn't read as a flat void. */
body {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(54,214,195,0.06), transparent 60%),
    var(--bg);
}

/* View switching: show only the active view. */
[data-view-target] { display: none; }
html[data-view="now"]    [data-view-target="now"]    { display: flex; }
html[data-view="pinned"] [data-view-target="pinned"] { display: flex; }

/* ============================== NOW (the stage) ============================== */
.stage {
  flex-direction: column;
  min-height: 100%;
  padding:
    calc(var(--safe-t) + 24px)
    calc(var(--safe-r) + 22px)
    calc(var(--safe-b) + 18px)
    calc(var(--safe-l) + 22px);
}

/* The whole line is the tap target: tap = next. */
.line {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.line-text {
  font-size: clamp(28px, 7.2vw, 44px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.015em;
  max-width: 18ch;
  /* The fade/slide animation on each new line. */
  animation: rise 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.line-author {
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}
.line-author::before { content: "— "; color: var(--ink-faint); }

/* The meaning: quiet explanatory text under the line, revealed by ?. */
.line-meaning {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink-dim);
  max-width: 34ch;
  padding-left: 12px;
  border-left: 2px solid var(--accent-dim);
  animation: rise 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* A faint hint that the surface is tappable, shown once. */
.line::after {
  content: "tap for the next";
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--safe-b) + 92px);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  pointer-events: none;
  opacity: 0;
}
html[data-hint="1"] .line::after { opacity: 1; transition: opacity 400ms; }

/* ------------------------------ controls ------------------------------ */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.ctl {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border: 1px solid var(--ink-faint);
  border-radius: 50%;
  background: var(--bg-lift);
  color: var(--ink-dim);
  font-size: 18px;
  cursor: pointer;
  transition: transform 120ms, color 120ms, border-color 120ms;
}
.ctl:active { transform: scale(0.9); }
.ctl:disabled { opacity: 0.35; pointer-events: none; }
#why[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-dim); }
#pin[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-dim); }
#pin[aria-pressed="true"] .ctl-glyph::before { content: "★"; }
#pin[aria-pressed="true"] .ctl-glyph { font-size: 0; }
#pin[aria-pressed="true"] .ctl-glyph::before { font-size: 18px; }

/* ------------------------------ moods ------------------------------ */
.moods { margin-top: 14px; }

.mood-toggle {
  width: var(--tap); height: 34px;
  border: 1px solid var(--ink-faint);
  border-radius: 999px;
  background: var(--bg-lift);
  color: var(--ink-dim);
  font-size: 18px; line-height: 1;
  cursor: pointer;
}
.moods[data-open="true"] .mood-toggle { color: var(--accent); border-color: var(--accent-dim); }

.mood-row {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.moods[data-open="true"] .mood-row { display: flex; }

.chip {
  padding: 8px 14px;
  min-height: 34px;
  border: 1px solid var(--ink-faint);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 14px; font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.chip[aria-pressed="true"] {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ============================== PINNED ============================== */
.pinned {
  flex-direction: column;
  min-height: 100%;
  padding:
    calc(var(--safe-t) + 8px)
    calc(var(--safe-r) + 18px)
    calc(var(--safe-b) + 18px)
    calc(var(--safe-l) + 18px);
}
.pinned-head { display: flex; align-items: center; gap: 6px; height: 48px; }
.back {
  width: var(--tap); height: var(--tap);
  border: 0; background: none; color: var(--ink-dim);
  font-size: 30px; line-height: 1; cursor: pointer;
}
.pinned-title { font-size: 17px; font-weight: 600; letter-spacing: 0.02em; margin: 0; }

.pinned-list { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; }
.pinned-item {
  position: relative;
  padding: 18px 44px 18px 16px;
  margin-bottom: 10px;
  background: var(--bg-lift);
  border: 1px solid var(--ink-faint);
  border-radius: var(--radius);
  font-size: 18px; line-height: 1.3;
}
.pinned-item .who { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-dim); }
.pinned-item .unpin {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-faint);
  font-size: 17px; cursor: pointer;
}
.pinned-item .unpin:active { color: var(--accent); }

.pinned-empty {
  margin: 40px 20px; color: var(--ink-dim);
  font-size: 16px; line-height: 1.45; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .line-text, .line-meaning { animation: none; }
  .ctl, .chip { transition: none; }
}
