/* Winter Arc: grind mode */
:root {
  --bg: #141412;
  --surface: #1B1A18;
  --line: #2A2926;
  --chalk: #EDEAE3;
  --soft: #B8B4AA;
  --muted: #8C8980;
  --dim: #55524B;
  --empty: #1F1E1C;
  --accent: #FF5A1F;
  --accent-2: #FF7A45;
  --l1: #5A3A2A;
  --l2: #A8481F;
  --l3: #D4511F;
  --ok: #6FCF7F;
  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--chalk); font-family: var(--body); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }
.content { padding: 16px 20px calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 640px; margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.date { font-family: var(--cond); font-size: 17px; font-weight: 600; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: var(--bg); font-family: var(--cond); font-weight: 700; font-size: 16px; padding: 5px 10px; border-radius: 2px; white-space: nowrap; }
.chip.off { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 2px; }
.icon-btn:hover { color: var(--chalk); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: rgba(20, 20, 18, .96); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; justify-content: center; color: var(--muted); text-decoration: none; font-family: var(--cond); font-size: 13px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* ---------- type ---------- */
.day { white-space: nowrap; font-family: var(--display); font-weight: 400; font-size: clamp(112px, 36vw, 150px); line-height: .82; letter-spacing: -2px; margin: 18px 0 0; }
.day small { font-size: .3em; color: var(--dim); letter-spacing: 0; margin-left: 10px; }
.page-title { font-family: var(--display); font-weight: 400; font-size: 64px; line-height: .9; margin: 14px 0 0; }
.lede { font-family: var(--cond); font-size: 17px; font-weight: 600; color: var(--muted); margin: 8px 0 0; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-family: var(--cond); font-size: 16px; font-weight: 600; color: var(--muted); }
.weeks { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.weeks i { height: 6px; background: var(--line); }
.weeks i.past { background: var(--accent); }
.weeks i.now { background: var(--chalk); }

.sec { margin-top: 30px; }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid var(--chalk); padding-bottom: 8px; }
.sec-head h2 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1; margin: 0; letter-spacing: .3px; }
.sec-head .aside { font-family: var(--cond); font-size: 18px; font-weight: 700; color: var(--muted); }
.sec-head .aside.hot { color: var(--accent); }
.link-btn { text-decoration: none; border: 0; background: none; padding: 6px 0; font-family: var(--cond); font-size: 17px; font-weight: 700; color: var(--accent); }
.link-btn.quiet { color: var(--muted); font-weight: 600; }
.note { font-family: var(--cond); font-size: 15px; color: var(--muted); }

/* ---------- viewing banner ---------- */
.viewing { margin-top: 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--accent); font-family: var(--cond); font-size: 16px; font-weight: 600; }

/* ---------- habits ---------- */
.habits { list-style: none; margin: 0; padding: 0; }
.habit { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 0; text-align: left; color: var(--soft); }
.habit .box { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border: 2px solid var(--dim); color: var(--bg); }
.habit .nm { flex: 1; font-size: 18px; font-weight: 600; min-width: 0; }
.habit .stk { font-family: var(--cond); font-size: 15px; font-weight: 600; color: var(--dim); white-space: nowrap; }
.habit .stk.hot { color: var(--accent); }
.habit.done { color: var(--chalk); }
.habit.done .box { background: var(--accent); border-color: var(--accent); }
.habit .box svg { opacity: 0; transform: scale(.4); transition: transform .15s ease-out, opacity .15s; }
.habit.done .box svg { opacity: 1; transform: none; }
.habit.editing { cursor: default; }
.habit .del { margin-left: auto; }
.add-row { display: flex; gap: 8px; margin-top: 12px; }
.add-row input { flex: 1; min-width: 0; }

/* ---------- arc grid ---------- */
.arc { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; margin-top: 18px; }
.cell { aspect-ratio: 1; border: 0; padding: 0; background: var(--empty); border-radius: 0; }
.cell.l0 { background: var(--line); }
.cell.l1 { background: var(--l1); }
.cell.l2 { background: var(--l2); }
.cell.l3 { background: var(--l3); }
.cell.l4 { background: var(--accent); }
.cell.today { outline: 2px solid var(--chalk); outline-offset: 1px; }
.cell.sel { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.cell:disabled { cursor: default; }
.legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-family: var(--cond); font-size: 14px; color: var(--muted); }
.legend i { width: 12px; height: 12px; display: inline-block; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.stat { padding: 14px 0; display: flex; flex-direction: column; min-width: 0; }
.stat + .stat { padding-left: 14px; border-left: 1px solid var(--line); }
.stat b { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 1; }
.stat b.hot { color: var(--accent); }
.stat span { font-family: var(--cond); font-size: 15px; font-weight: 600; color: var(--muted); }

/* ---------- lists & rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.datebox { width: 44px; flex: none; display: flex; flex-direction: column; align-items: center; }
.datebox b { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1; }
.datebox span { font-family: var(--cond); font-size: 13px; font-weight: 600; color: var(--muted); }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-body strong { font-size: 17px; font-weight: 600; }
.row-body .sub { font-family: var(--cond); font-size: 15px; color: var(--muted); }
.row-body .pre { white-space: pre-wrap; font-size: 15px; color: var(--soft); margin-top: 2px; }
.tag { align-self: flex-start; font-family: var(--cond); font-size: 13px; font-weight: 700; padding: 1px 7px; background: var(--line); color: var(--soft); }
.del { width: 36px; height: 36px; flex: none; border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; }
.del:hover { color: var(--accent); }
.empty { margin-top: 16px; padding: 22px; border: 1.5px dashed var(--line); color: var(--muted); font-family: var(--cond); font-size: 17px; text-align: center; }

.consist { list-style: none; margin: 0; padding: 0; }
.consist li { display: grid; grid-template-columns: minmax(0, 1fr) 48px; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.consist .nm { font-weight: 600; }
.consist .pct { font-family: var(--cond); font-size: 16px; font-weight: 700; text-align: right; }
.bar { grid-column: 1 / -1; height: 6px; background: var(--line); }
.bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- forms ---------- */
.form { display: grid; gap: 12px; margin-top: 16px; }
.form .two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label.f { display: flex; flex-direction: column; gap: 5px; font-family: var(--cond); font-size: 15px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: 46px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 0; padding: 10px 12px; font-size: 16px; color: var(--chalk); -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.8); }
.btn { min-height: 46px; padding: 0 18px; border: 0; background: var(--accent); color: var(--bg); font-family: var(--cond); font-size: 18px; font-weight: 700; border-radius: 0; white-space: nowrap; }
.btn:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 2px var(--chalk); }
.btn.ghost:hover { color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn.danger { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.scale-row { display: flex; gap: 28px; flex-wrap: wrap; margin: 18px 0; }
.scale { display: flex; gap: 6px; margin-top: 6px; }
.scale button { width: 46px; height: 46px; border: 1.5px solid var(--line); background: var(--surface); font-family: var(--display); font-size: 20px; }
.scale button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.daynav { display: flex; align-items: center; gap: 4px; }
.daynav .d { font-family: var(--cond); font-size: 18px; font-weight: 700; min-width: 120px; text-align: center; }

/* ---------- goals ---------- */
.goal { margin-top: 16px; border: 2px solid var(--line); padding: 16px 18px; }
.goal.main { border-color: var(--chalk); }
.goal-top { display: flex; align-items: flex-start; gap: 10px; }
.goal h3 { flex: 1; margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.05; text-transform: uppercase; }
.goal .kicker { font-family: var(--cond); font-size: 15px; font-weight: 600; color: var(--muted); }
.goal .bar { margin-top: 12px; height: 8px; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }
.steps label { flex: 1; }
.steps li.done label { color: var(--muted); text-decoration: line-through; }
.star[aria-pressed="true"] { color: var(--accent); }

/* ---------- chart ---------- */
.chart { display: block; width: 100%; height: 150px; margin-top: 12px; }
.chart-axis { display: flex; justify-content: space-between; font-family: var(--cond); font-size: 14px; color: var(--muted); margin-top: 4px; }
.big-change { font-family: var(--cond); font-size: 18px; font-weight: 700; }

/* ---------- settings ---------- */
.set-block { margin-top: 30px; }
.set-block p { color: var(--soft); margin: 12px 0 0; max-width: 56ch; }
.sync { display: inline-flex; align-items: center; gap: 8px; font-family: var(--cond); font-size: 15px; font-weight: 600; color: var(--muted); }
.sync i { width: 8px; height: 8px; background: var(--dim); display: inline-block; }
.sync.ok i { background: var(--ok); }
.sync.busy i { background: var(--accent); }
.sync.warn i { background: #E8B04A; }

/* ---------- sign in ---------- */
.signin { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px calc(32px + env(safe-area-inset-bottom, 0px)); max-width: 460px; margin: 0 auto; }
.signin .word { font-family: var(--display); font-size: 88px; line-height: .86; margin: 0; }
.signin .word span { display: block; }
.signin .bar-accent { width: 100%; height: 10px; background: var(--accent); margin: 18px 0 26px; }
.signin p { color: var(--soft); margin: 0 0 18px; }
.signin .err { color: var(--accent); font-family: var(--cond); font-size: 16px; font-weight: 600; margin-top: 10px; min-height: 1.4em; }
.code-input { font-family: var(--display) !important; font-size: 30px !important; letter-spacing: 8px; text-align: center; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--chalk); color: var(--bg); font-family: var(--cond); font-size: 16px; font-weight: 700; padding: 10px 16px; z-index: 30; pointer-events: none; }

/* ---------- desktop ---------- */
.desk-only { display: none; }
@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .tabbar, .mob-only { display: none !important; }
  .desk-only { display: revert; }
  .sidebar { display: flex; flex-direction: column; gap: 36px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 36px 20px 28px; }
  .wordmark { font-family: var(--display); font-size: 34px; line-height: .9; margin: 0; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; color: var(--soft); text-decoration: none; font-family: var(--cond); font-size: 19px; font-weight: 600; }
  .side-nav a:hover { color: var(--chalk); background: var(--surface); }
  .side-nav a[aria-current="page"] { background: var(--accent); color: var(--bg); font-weight: 700; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
  .content { max-width: 1240px; margin: 0; padding: 36px 48px 48px; width: 100%; }
  .topbar .chip, .topbar .icon-btn { display: none; }
  .day { font-size: clamp(120px, 12.5vw, 184px); letter-spacing: -3px; margin-top: 10px; }
  .day small { font-size: 48px; }
  .hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; }
  .hero-stats { display: flex; gap: 40px; padding-bottom: 6px; }
  .hero-stats div { display: flex; flex-direction: column; }
  .hero-stats b { font-family: var(--display); font-weight: 400; font-size: 64px; line-height: 1; }
  .hero-stats b.hot { color: var(--accent); }
  .hero-stats span { white-space: nowrap; font-family: var(--cond); font-size: 16px; font-weight: 600; color: var(--muted); }
  .phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 24px; }
  .phases div { display: flex; flex-direction: column; gap: 6px; font-family: var(--cond); font-size: 16px; font-weight: 600; color: var(--muted); }
  .phases i { height: 8px; background: var(--line); position: relative; overflow: hidden; }
  .phases i b { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
  .phases div.on { color: var(--chalk); font-weight: 700; }
  .dash { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, .95fr); gap: 40px; margin-top: 12px; align-items: start; }
  .dash > .sec, .dash > div > .sec:first-child { margin-top: 30px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  .page-title { font-size: 96px; margin-top: 4px; }
  .toast { bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
