/* MIRROR — the time card.
   A physical record of days, punched and stamped. Not a terminal. */

:root {
  --card: #CFCCC0;      /* card stock */
  --ink: #1E1F1A;       /* deep ink */
  --faded: #6B6C62;     /* faded ink */
  --rule: #A5A296;      /* rule lines */
  --red: #A32A21;       /* stamp red — the one saturated thing */
  --card-hi: #D9D6CB;   /* a slightly lifted stock, for the current row */

  --display: "Saira Condensed", "Arial Narrow", sans-serif;
  --body: "Libre Franklin", system-ui, -apple-system, sans-serif;
  --mono: "Courier Prime", ui-monospace, "Courier New", monospace;

  --maxw: 620px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--card);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  /* faint paper tooth */
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(30,31,26,0.012) 3px, rgba(30,31,26,0.012) 4px);
  min-height: 100dvh;
}

.screen { min-height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- shared bits ---------- */
.brandmark {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: clamp(28px, 7vw, 44px);
  color: var(--ink);
}
.brandmark.small { font-size: 20px; letter-spacing: 0.18em; }

.btn {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 17px;
  padding: 12px 22px;
  border: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.06s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--card); }
.btn-primary:hover { background: #000; }
.btn-ghost:hover { background: rgba(30,31,26,0.06); }
.btn:disabled { opacity: 0.4; cursor: default; }

.linkbtn {
  background: none; border: none; color: var(--faded);
  font-family: var(--body); font-size: 14px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; padding: 6px;
}
.linkbtn:hover { color: var(--ink); }
.linkbtn.danger { color: var(--red); }

.iconbtn {
  background: none; border: none; color: var(--ink);
  font-size: 20px; cursor: pointer; padding: 6px 8px; line-height: 1;
}

.counter {
  font-family: var(--mono); font-size: 12px; color: var(--faded);
  letter-spacing: 0.02em;
}

.ask-input, textarea, input[type="text"] {
  width: 100%;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.15;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--rule);
  padding: 8px 2px;
  resize: none;
  outline: none;
}
.ask-input:focus { border-bottom-color: var(--ink); }
.ask-input::placeholder { color: var(--rule); font-weight: 600; }

.ask-label {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: clamp(22px, 5.5vw, 30px);
  margin-bottom: 10px;
}
.ask-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; gap: 12px;
}

/* ===================== FRONT DOOR ===================== */
.fd-wrap {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: max(28px, 6vh) 22px 40px;
  display: flex; flex-direction: column; gap: 26px; flex: 1;
}
.fd-head { text-align: left; }
.fd-kicker {
  font-family: var(--mono); font-size: 13px; color: var(--faded);
  margin: 6px 0 0; letter-spacing: 0.02em;
}
.fd-panel {
  border-top: 2px solid var(--ink);
  padding-top: 20px;
}
.fd-turn {
  border-top: 1px dashed var(--rule);
  padding-top: 22px; margin-top: 6px;
}
.turn-line {
  font-family: var(--display); font-weight: 800; font-size: 26px;
  margin: 0; text-transform: uppercase; letter-spacing: 0.03em;
}
.turn-sub { color: var(--faded); margin: 6px 0 18px; font-size: 16px; }
.fd-foot { margin-top: auto; text-align: center; }

/* verdict card (shared by front door + report) */
.verdict { display: flex; flex-direction: column; gap: 16px; }
.verdict-block .vlabel {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--faded); text-transform: uppercase; margin-bottom: 5px;
}
.verdict-block .vsaid {
  font-family: var(--display); font-weight: 700; font-size: clamp(20px, 5vw, 26px);
  line-height: 1.12;
}
.verdict-block .vunder { font-size: 16.5px; line-height: 1.5; }
.verdict-block .vpattern {
  font-size: 15px; line-height: 1.45; color: var(--ink);
  border-left: 3px solid var(--red); padding-left: 12px;
}
.softness {
  display: flex; align-items: baseline; gap: 12px;
  border-top: 1px solid var(--rule); padding-top: 14px;
}
.softness .snum {
  font-family: var(--mono); font-weight: 700; font-size: 30px; color: var(--ink);
}
.softness .slabel { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--faded); text-transform: uppercase; }
.softbar { flex: 1; height: 8px; background: rgba(30,31,26,0.1); position: relative; }
.softbar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }

/* safety-branch card, when persona is dropped */
.care {
  border: 2px solid var(--ink); padding: 20px; background: var(--card-hi);
  display: flex; flex-direction: column; gap: 12px;
}
.care .clabel { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--faded); text-transform: uppercase; }
.care p { margin: 0; font-size: 16.5px; line-height: 1.5; }

/* ===================== THE APP ===================== */
.app-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 2px solid var(--ink);
}
.tally {
  font-family: var(--mono); font-size: 15px; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.tally-sep { color: var(--rule); }
.tally-streak::before { content: "▲ "; color: var(--faded); }
.tally-ratio { color: var(--faded); }

.record {
  flex: 1; overflow-y: auto;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 0 20px;
}
.record-title {
  display: grid; grid-template-columns: 92px 1fr 96px;
  gap: 10px; align-items: end;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  color: var(--faded); text-transform: uppercase;
  padding: 14px 0 8px; border-bottom: 2px solid var(--ink);
  position: sticky; top: 0; background: var(--card);
}
.rows { display: flex; flex-direction: column; }

.row {
  display: grid; grid-template-columns: 92px 1fr 96px;
  gap: 10px; align-items: center;
  min-height: 58px; padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.row .r-date {
  font-family: var(--mono); font-size: 13px; color: var(--faded); line-height: 1.25;
}
.row .r-date b { display: block; color: var(--ink); font-size: 15px; }
.row .r-decl {
  font-family: var(--display); font-weight: 600; font-size: 18px; line-height: 1.12;
  color: var(--ink); overflow-wrap: anywhere;
}
.row.didnt .r-decl { color: var(--faded); }
.row .r-stamp { display: flex; justify-content: flex-end; }

/* the stamp */
.stamp {
  font-family: var(--display); font-weight: 800; letter-spacing: 0.04em;
  font-size: 15px; text-transform: uppercase;
  border: 2px solid var(--ink); color: var(--ink);
  padding: 3px 8px; line-height: 1;
  transform: rotate(-4deg);
  opacity: 0.92;
}
.stamp.didnt { color: var(--red); border-color: var(--red); transform: rotate(3deg); }
.stamp.legit { border-style: dashed; font-size: 12px; }
.stamp.care { border-color: var(--faded); color: var(--faded); border-style: dotted; font-size: 12px; transform: none; }

/* the press-and-settle animation */
@keyframes press {
  0%   { transform: scale(2.1) rotate(-14deg); opacity: 0; }
  55%  { transform: scale(0.9) rotate(-4deg); opacity: 1; }
  72%  { transform: scale(1.06) rotate(-3deg); }
  100% { transform: scale(1) rotate(-4deg); opacity: 0.92; }
}
@keyframes press-red {
  0%   { transform: scale(2.1) rotate(12deg); opacity: 0; }
  55%  { transform: scale(0.9) rotate(3deg); opacity: 1; }
  72%  { transform: scale(1.06) rotate(2deg); }
  100% { transform: scale(1) rotate(3deg); opacity: 0.92; }
}
.stamp.pressing { animation: press 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) both; transform-origin: center; }
.stamp.didnt.pressing { animation-name: press-red; }

@media (prefers-reduced-motion: reduce) {
  .stamp.pressing { animation: none !important; }
}

/* ---------- the current day ---------- */
.today {
  border-top: 3px solid var(--ink);
  background: var(--card-hi);
  width: 100%;
  padding: 20px max(20px, calc((100% - var(--maxw)) / 2 + 20px)) max(24px, env(safe-area-inset-bottom));
}
.today-inner { max-width: var(--maxw); margin: 0 auto; }

.today .day-label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  color: var(--faded); text-transform: uppercase; margin-bottom: 12px;
  display: flex; justify-content: space-between;
}

.report-decl {
  font-family: var(--display); font-weight: 700; font-size: clamp(20px, 5vw, 26px);
  line-height: 1.14; margin-bottom: 16px;
}
.report-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-delivered { }
.btn-didnt { border-color: var(--red); color: var(--red); }
.btn-didnt:hover { background: var(--red); color: var(--card); }

.prompt-label {
  font-family: var(--display); font-weight: 700; font-size: 22px; margin: 4px 0 10px;
}
.today .ask-input { font-size: clamp(18px, 4.5vw, 24px); }

.locked-note {
  font-family: var(--mono); font-size: 12px; color: var(--faded); margin-top: 10px;
}

.today .verdict { margin-top: 4px; }
.done-row { display: flex; gap: 12px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

.spinner {
  font-family: var(--mono); font-size: 13px; color: var(--faded);
  letter-spacing: 0.06em;
}
.spinner::after { content: "…"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: "."; } 33% { content: ".."; } 66% { content: "..."; } }

/* ===================== SETTINGS SHEET ===================== */
.sheet {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(30,31,26,0.32);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-inner {
  width: 100%; max-width: var(--maxw);
  background: var(--card); border: 2px solid var(--ink); border-bottom: none;
  padding: 20px 22px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 4px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-family: var(--display); font-weight: 800; letter-spacing: 0.06em; margin: 0; font-size: 24px; text-transform: uppercase; }
.setrow {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--rule);
}
.setlabel { font-family: var(--display); font-weight: 700; font-size: 18px; }
.setnote { font-size: 13px; color: var(--faded); margin-top: 2px; }

.toggle {
  width: 52px; height: 30px; border: 2px solid var(--ink); background: transparent;
  border-radius: 0; position: relative; cursor: pointer; flex: none; padding: 0;
}
.toggle > span {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  background: var(--ink); transition: left 0.14s ease;
}
.toggle[aria-checked="true"] { background: var(--ink); }
.toggle[aria-checked="true"] > span { left: 24px; background: var(--card); }

.sheet-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.sheet-actions .btn { font-size: 14px; padding: 10px 16px; flex: 1; min-width: 140px; }
.sheet-note { font-size: 13px; color: var(--faded); margin: 12px 0 0; line-height: 1.4; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--card); font-family: var(--mono); font-size: 13px;
  padding: 10px 16px; z-index: 40; max-width: 90vw;
}
