/* FeelTally — one stylesheet, no build step.
   Palette: the Inside Out 2 emotion colours (per-emotion, set inline as --c).
   Surface stays light and warm so the colours do the talking (C28). */

:root {
  --canvas: #FBF6EE;
  --card: #FFFFFF;
  --ink: #241F2A;
  --ink2: #423C4E;
  --muted: #655D72;
  --border: #EDE3D6;
  --soft: #F4EDE2;
  --good: #2F9E6B;
  --bar: #E8DFD2;
  --radius: 16px;
  --shadow: 0 2px 6px rgba(36, 31, 42, .05);
}

* { box-sizing: border-box; }


/* An author `display:` rule beats the user-agent's [hidden] rule, so a hidden cue box would still
   render as an empty coloured strip. Keep this above every layout rule. */
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 32px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
  padding-top: max(12px, env(safe-area-inset-top));
}
.logo {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  background: var(--ink); color: var(--canvas);
  display: flex; align-items: center; justify-content: center;
}
.brand { font-weight: 780; font-size: 16px; letter-spacing: -.2px; }
.date { font-size: 12px; color: var(--muted); font-weight: 600; }
.nav { margin-left: auto; display: flex; gap: 6px; }
.navbtn {
  font: inherit; font-size: 13px; font-weight: 650; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 7px 12px; cursor: pointer;
}
.navbtn.on { background: var(--soft); color: var(--ink); border-color: var(--border); }

main { padding: 14px 14px 0; max-width: 1360px; margin: 0 auto; }

/* ---------- cards ---------- */

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.slabel {
  margin: 0 0 8px; font-size: 10.5px; font-weight: 750; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.daytop { display: flex; align-items: flex-end; gap: 10px; }
.score { font-size: 40px; font-weight: 800; letter-spacing: -1.4px; line-height: .95; }
.score.dim { color: var(--muted); }
.meta { margin-left: auto; text-align: right; font-size: 12px; font-weight: 650; color: var(--ink2); line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 11.5px; font-weight: 650; border-radius: 999px;
  padding: 4px 9px; background: var(--soft); color: var(--ink2);
}
.rate {
  display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border); flex-wrap: wrap;
}
.rate b { font-size: 12.5px; }
.rate .hint { font-size: 11.5px; color: var(--muted); }
.dots { display: flex; gap: 3px; margin-left: auto; }
.dot {
  width: 15px; height: 15px; border-radius: 50%; padding: 0;
  background: var(--bar); border: none; cursor: pointer;
}
.dot.on { background: var(--ink); }

/* ---------- the quiet cues ---------- */

.cue, .cooldown {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  font-size: 12.5px; font-weight: 650; border-radius: 13px; padding: 9px 12px;
}
.cue { background: #FFF6E0; border: 1px solid #F3DFAE; color: #6E4E0C; }
.cue.cue-note { background: var(--soft); border-color: var(--border); color: var(--ink2); }
.cooldown { background: var(--soft); border: 1px solid var(--border); color: var(--muted); }

/* ---------- the buttons ---------- */

.grp { margin-bottom: 10px; }
.gname { margin: 0 0 6px 3px; font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }

.b {
  position: relative; border: none; cursor: pointer; font: inherit;
  border-radius: 15px; padding: 11px 4px 10px; color: #fff; font-weight: 750; font-size: 12.5px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .13);
  transition: transform .08s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.b.wide { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 9px; padding: 14px; font-size: 14px; }
.b .mark { color: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .16)); }
.b .holdbar {
  position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px;
  border-radius: 3px; background: rgba(255, 255, 255, .35); opacity: 0;
}
.b .holdbar > i { display: block; height: 100%; width: 0; background: #fff; border-radius: 3px; }
.b .holdbar > i::after { content: ""; }

.b.holding { transform: scale(.97); }
.b.holding .holdbar { opacity: 1; }
.b.holding .holdbar > i { animation: fill 450ms linear forwards; }
.b.armed { outline: 3px solid rgba(255, 255, 255, .9); outline-offset: -6px; }
@keyframes fill { from { width: 0; } to { width: 100%; } }

/* Disabled by the 30-minute rule. The button keeps its own colour — desaturated, not greyed —
   so a cooldown never reads as a palette decision (his correction on the first mockup). */
.b.cool { filter: saturate(.30) opacity(.55); box-shadow: none; cursor: not-allowed; }
.b.cool .mark { filter: none; }

/* ---------- timeline ---------- */

.tl { display: flex; flex-direction: column; gap: 8px; }
.e { display: flex; align-items: flex-start; gap: 8px; }
.e.pop { animation: pop 400ms ease; }
@keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.e .t { width: 38px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding-top: 4px; }
.orb {
  width: 26px; height: 26px; border-radius: 9px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.e .body { font-size: 12.5px; font-weight: 700; padding-top: 1px; }
.e .body em { display: block; font-style: normal; font-weight: 550; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.int {
  font-size: 10px; font-weight: 750; padding: 2px 6px; border-radius: 6px;
  background: var(--soft); color: var(--ink2); margin-left: 5px;
}
.mini {
  margin-left: auto; border: 1px solid var(--border); background: var(--card);
  color: var(--muted); border-radius: 9px; width: 26px; height: 26px;
  font-size: 14px; font-weight: 700; line-height: 1; cursor: pointer;
}
.more, .empty { margin: 6px 0 0 46px; font-size: 11.5px; color: var(--muted); font-weight: 650; }
.empty { margin-left: 0; }

.note-edit { display: flex; gap: 6px; margin: 8px 0 0 46px; flex-wrap: wrap; }
.note-edit input {
  flex: 1 1 140px; font: inherit; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #FFFDF6;
}
.note-edit button {
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 8px 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card); cursor: pointer;
}
.note-edit .save { background: var(--ink); color: #fff; border-color: var(--ink); }
.note-edit .del { color: #9B2C2C; }

/* ---------- the 7-day strip ---------- */

.strip { display: flex; align-items: flex-end; height: 46px; gap: 2px; }
.sd { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.sbar { display: block; width: 15px; border-radius: 4px; background: var(--ink); opacity: .8; }
.sbar.neg { background: #C6BCAB; opacity: 1; }
.sbar.today { background: var(--good); opacity: 1; }
.sday { font-size: 9.5px; font-weight: 750; color: var(--muted); font-style: normal; }
.cap, .hintline { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); }
.hintline { margin: 0 0 10px; }

/* ---------- copy ---------- */

.copy {
  width: 100%; border: none; border-radius: var(--radius); cursor: pointer; font: inherit;
  background: var(--ink); color: #fff; font-weight: 750; font-size: 14px; padding: 15px;
  display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 8px;
}
.copy .mark { color: #fff; }
.copy.ok { background: var(--good); }

/* ---------- backup nag, settings ---------- */

.backup { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 650; background: #FFF6E0; border-color: #F3DFAE; color: #6E4E0C; }
.linkish { background: none; border: none; font: inherit; font-weight: 750; color: #6E4E0C; text-decoration: underline; cursor: pointer; margin-left: auto; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
button.primary, .row button, [data-action="install"] {
  font: inherit; font-size: 13.5px; font-weight: 700; padding: 11px 14px; cursor: pointer;
  border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--ink);
}
button.primary, .row button.primary, .preview + button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.preview-wrap { margin-top: 12px; }
.preview-wrap summary { font-size: 12.5px; font-weight: 650; color: var(--muted); cursor: pointer; }
.preview {
  margin: 8px 0 0; padding: 11px; background: var(--soft); border-radius: 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-x: auto;
}
.preview .warn, .warn { color: #9B2C2C; }
.preview p, [data-import-result] p { font-size: 12.5px; }
.preview, .ok-note { color: var(--ink2); }
.ok-note { display: block; font-size: 12.5px; font-weight: 650; color: var(--good); margin-top: 8px; }

.labels { display: flex; flex-direction: column; gap: 8px; }
.lbl { display: flex; align-items: center; gap: 8px; }
.lbl input[type="text"] {
  flex: 1; font: inherit; font-size: 13.5px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--card); min-width: 90px;
}
.lbl .hide { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 650; }

/* ---------- desktop: the same screen, wide (the approved 1440px layout) ---------- */

@media (min-width: 900px) {
  .grid-desk { display: grid; grid-template-columns: 392px minmax(0, 1fr); gap: 18px; align-items: start; }
  .topbar { padding: 14px 34px; }
  main { padding: 20px 34px 0; }
  .b { font-size: 13.5px; padding: 13px 6px 12px; }
  .b .mark { width: 26px; height: 26px; }
  .card { padding: 16px; }
  .score { font-size: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- phone order: the buttons come first (his 2026-09-28 note) ----------
   The two columns are laid out with `display: contents` so their cards can be reordered on a
   phone, while the wide layout keeps the approved column split untouched. */
@media (max-width: 899px) {
  .grid-desk { display: flex; flex-direction: column; gap: 12px; }
  .col-a, .col-b { display: contents; }
  .logcard     { order: 1; }
  [data-cue]   { order: 2; }
  [data-cooldown] { order: 3; }
  .scorecard   { order: 4; }
  .stripcard   { order: 5; }
  .copy        { order: 6; }
  .copy + .hintline { order: 7; }
  .tlcard      { order: 8; }
  .backup      { order: 9; }
  .logcard .slabel { margin-bottom: 2px; }
}
