:root {
  color-scheme: dark;
  --bg: #171c1b;
  --panel: #202624;
  --ink: #f3f2ea;
  --muted: #89928c;
  --line: #35403a;
  --gold: #d9b970;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; color: inherit; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.ritual {
  width: min(100%, 480px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: 20px minmax(0, 1fr) auto;
  gap: 8px;
}
#countdown { color: var(--muted); font-size: 14px; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.jar-stage { position: relative; min-height: 0; display: grid; place-items: center; }
#jar-glass { width: 100%; height: 100%; min-height: 0; display: grid; place-items: center; }
.jar { display: block; height: 100%; width: 100%; max-width: 360px; }
.glass { fill: #222b28; stroke: #778780; stroke-width: 1.5; }
.rim { fill: none; stroke: #a6b2a9; stroke-width: 2.5; }
.jar-streak, .jar-count { fill: var(--ink); font-size: 44px; font-weight: 400; font-variant-numeric: tabular-nums; }
.jar-count { fill: var(--muted); font-size: 36px; }
#day-phrase {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 20px;
  display: grid;
  place-content: center;
  background: rgba(23, 28, 27, .87);
  text-align: center;
  font-size: clamp(26px, 7.5vw, 36px);
  line-height: 1.22;
  letter-spacing: -.7px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.is-finished #day-phrase { opacity: 1; visibility: visible; }
.just-finished #day-phrase { animation: phrase-in 300ms ease-out 300ms both; }
#day-form { display: grid; gap: 8px; min-width: 0; }
.body-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.body-tap {
  min-width: 0;
  min-height: 96px;
  padding: 8px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border-radius: 12px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.body-tap:active { background: var(--panel); }
.count { font-size: clamp(25px, 9vw, 38px); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.many-digits .count { font-size: 20px; }
.glyph { font-size: 24px; }
[data-counter="pushups"] { color: var(--muted); }
[data-counter="pushups"].target { color: var(--ink); }
[data-counter="pushups"].ideal { color: var(--gold); }
.day-circle { width: 34px; height: 34px; border: 2px solid var(--muted); border-radius: 50%; }
#day-toggle[aria-pressed="true"] .day-circle { background: var(--ink); border-color: var(--ink); }
#gate { min-width: 0; }
#gate-question { margin: 0 0 6px; font-size: 14px; line-height: 18px; overflow-wrap: anywhere; }
.gate-answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gate-answers button { height: 64px; background: var(--panel); border-radius: 12px; font-size: 18px; }
.tomorrow { min-width: 0; display: grid; gap: 4px; }
#yesterday { display: flex; align-items: center; gap: 10px; min-width: 0; height: 32px; padding: 0 4px; color: var(--muted); background: transparent; text-align: left; }
#yesterday > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.tick-circle { flex: 0 0 22px; height: 22px; border: 1.5px solid var(--muted); border-radius: 50%; }
#yesterday[aria-pressed="true"] .tick-circle::after { content: "✓"; display: block; text-align: center; font-size: 15px; line-height: 19px; }
#yesterday[aria-pressed="true"] > span:last-child { text-decoration: line-through; }
#tomorrow { width: 100%; min-width: 0; height: 52px; border: 0; border-radius: 10px; padding: 10px 12px; color: var(--ink); background: var(--panel); font-size: 20px; }
#tomorrow::placeholder { color: var(--muted); opacity: 1; }
#done { width: 100%; height: 64px; padding: 12px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 20px; font-weight: 600; }
#done:disabled { opacity: .3; }
.error { margin: 0; font-size: 13px; color: var(--gold); overflow-wrap: anywhere; }
.error:empty { display: none; }
.stone-drop { animation: stone-drop 300ms ease-out; }
@keyframes stone-drop { from { transform: translateY(-210px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes phrase-in { from { opacity: 0; } to { opacity: 1; } }
/* Keep the existing PIN screen's layout and controls. */
.auth { width: min(100%, 400px); padding: 48px 24px; margin: 10vh auto; }
.auth h1 { font-size: 30px; font-weight: 500; margin-bottom: 32px; }
.auth form label { display: block; font-size: 14px; color: var(--muted); }
.auth input { width: 100%; max-width: 100%; min-width: 0; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); padding: 14px 12px; min-height: 52px; }
.auth button { width: 100%; background: var(--ink); color: var(--bg); margin-bottom: 24px; min-height: 52px; padding: 12px 20px; border: 1px solid var(--line); border-radius: 12px; }
.auth .error { margin: 13px 0; }
a { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { *, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .ritual { padding-left: 14px; padding-right: 14px; } .body-tap { gap: 4px; } }
