:root {
  --bg: #0A0A0B;
  --surface: #151517;
  --surface-2: #202023;
  --surface-3: #2B2B2F;
  --line: rgba(255, 255, 255, .07);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #F4F4F0;
  --muted: #8E8E94;
  --faint: #55555B;
  --volt: #D4FF3F;
  --on-volt: #0A0A0B;
  --warn: #FF9447;
  --danger: #FF5F5F;
  --sat: #7FB2FF;
  --sun: #FF7B7B;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --gutter: 18px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --display: "Barlow Condensed", "Pretendard Variable", Pretendard, -apple-system, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  line-height: 1.4;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button:disabled { cursor: default; }
input { font: inherit; font-size: 16px; color: inherit; }
[hidden] { display: none !important; }

/* Shared type */
.d {
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.kicker {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- shell ---------- */
/* Pinned to the viewport edges rather than height: 100dvh, which iOS home-screen apps
   can report wrong. (The bottom gap on iPhone came from status-bar-style
   black-translucent; index.html now uses black.) */
html, body { height: 100%; }
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.views {
  position: relative;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Up/down stays native scrolling; sideways drags page between tabs (app.js). */
  touch-action: pan-y pinch-zoom;
}
/* The neighbouring tab, pulled in from the side while paging. */
.view.peek { position: absolute; left: 0; right: 0; }
.views.paging .view { will-change: transform; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 18px)
    max(var(--gutter), env(safe-area-inset-right, 0px))
    calc(max(calc(env(safe-area-inset-bottom, 0px) + 4px), 12px) + 64px + 28px)
    max(var(--gutter), env(safe-area-inset-left, 0px));
}

/* Floating capsule over the content, like the iOS app: the page scrolls under it. */
.tabbar {
  --i: 0;
  position: absolute;
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(calc(env(safe-area-inset-bottom, 0px) + 4px), 12px);
  z-index: 20;
  max-width: 528px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 5px;
  border-radius: 999px;
  background: rgba(32, 32, 35, .72);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 10px 30px rgba(0, 0, 0, .45);
  user-select: none;
  -webkit-user-select: none;
}
/* The selected-tab pill slides between tabs. */
.tabbar::before {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px) / 5);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 300ms var(--ease-out);
}
.tab {
  position: relative;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  touch-action: manipulation;
  transition: color 160ms var(--ease-out);
}
.tab svg { width: 22px; height: 22px; transition: transform 140ms var(--ease-out); }
.tab:active svg { transform: scale(.88); }
.tab[aria-current="page"] { color: var(--volt); }

/* ---------- headings ---------- */
.head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.head .kicker { color: var(--volt); margin-bottom: 6px; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
h1 .d { font-size: 26px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.nav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  transition: transform 120ms var(--ease-out), opacity 160ms;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active:not(:disabled) { transform: scale(.9); }
.icon-btn:disabled { opacity: .3; }
.pill {
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  color: var(--volt);
  transition: transform 120ms var(--ease-out);
}
.pill:active { transform: scale(.95); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 2px 12px;
}
.section-head h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.section-head .kicker { font-size: 12px; color: var(--faint); }

/* ---------- today: hero ---------- */
.hero {
  background: var(--surface);
  border-radius: 22px;
  padding: 18px 18px 18px;
  margin-bottom: 28px;
}
.hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.hero .kicker { font-size: 12px; margin-bottom: 4px; }
.streak { display: flex; align-items: baseline; gap: 6px; }
.streak .d { font-size: 76px; line-height: .86; color: var(--volt); }
.streak.zero .d { color: var(--faint); }
.streak-unit { font-size: 16px; font-weight: 800; }
.season { text-align: right; }
.season .d { font-size: 34px; line-height: 1; }
.season .d small { font-size: 19px; color: var(--muted); }

.week-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.week-head b { font-weight: 800; color: var(--text); }
.week-head small { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--faint); }
.week-head .met { color: var(--volt); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 0; }
.wk-dot { transition: transform 120ms var(--ease-out), background-color 180ms; }
.wk:active:not(:disabled) .wk-dot { transform: scale(.88); }
.wk-label { font-size: 11px; font-weight: 700; color: var(--muted); }
.wk-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 16px;
}
.wk-dot svg { width: 16px; height: 16px; }
.wk.on .wk-dot { background: var(--volt); color: var(--on-volt); }
.wk.today .wk-label { color: var(--volt); }
.wk.today:not(.on) .wk-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--volt); color: var(--volt); }
.wk.future .wk-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--faint); }

/* ---------- today: part tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 340px) {
  .tiles { grid-template-columns: 1fr 1fr; }
}

.tile {
  --c: #888;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 112px;
  padding: 12px 11px 11px;
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  transition:
    transform 140ms var(--ease-out),
    background-color 200ms,
    color 200ms;
}
.tile:active { transform: scale(.97); }

.tile-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 13px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--c); /* the part's own color, no marker bar */
  white-space: nowrap;
  overflow: hidden;
}
.tile-name {
  margin-top: 8px;
  max-width: 100%;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  margin-top: auto;
  padding-top: 10px;
}
.tile-sub { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tile-sub.stale { color: var(--warn); }

.tile-check {
  flex-shrink: 0;
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: var(--volt);
}
.tile-check svg { width: 12px; height: 12px; opacity: 0; }

.tile[aria-pressed="true"] { background: var(--volt); color: var(--on-volt); }
.tile[aria-pressed="true"] .tile-tag,
.tile[aria-pressed="true"] .tile-sub { color: rgba(10, 10, 11, .62); }
.tile[aria-pressed="true"] .tile-check { background: var(--on-volt); box-shadow: none; }
.tile[aria-pressed="true"] .tile-check svg { opacity: 1; }
.tile.pop { animation: tile-pop 340ms var(--ease-out); }
/* Holding a part tile shrinks it slowly; at the end the edit sheet opens. */
.tile.holding { transform: scale(.94); transition-duration: 480ms; }
.add-tile {
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1.5px dashed var(--line-strong);
  color: var(--muted);
}
.add-plus svg { width: 26px; height: 26px; }
.add-tile .tile-sub { color: var(--muted); }
.section-head .hint { font-size: 12px; font-weight: 600; color: var(--faint); }
@keyframes tile-pop {
  0% { transform: scale(.95); }
  55% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

.photo-cta {
  width: 100%;
  height: 56px;
  margin-top: 12px;
  padding: 0 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--volt);
  color: var(--on-volt);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: transform 140ms var(--ease-out), background-color 200ms, color 200ms;
}
.photo-cta svg { width: 22px; height: 22px; flex-shrink: 0; }
.photo-cta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-cta:active { transform: scale(.98); }
.photo-cta.idle { background: var(--surface); color: var(--muted); }
.photo-cta.has-photo {
  justify-content: flex-start;
  gap: 12px;
  padding-left: 8px;
  background: var(--surface);
  color: var(--text);
}
.photo-cta.has-photo img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--volt);
}

/* Days with a saved 오운완 photo show it in place of the plain circle. */
.wk.photo .wk-dot {
  background: center / cover no-repeat var(--ph);
  box-shadow: 0 0 0 2px var(--volt);
}
.day.photo .num,
.day.attended.photo .num,
.day.today.photo .num {
  background: linear-gradient(rgba(0, 0, 0, .3), rgba(0, 0, 0, .3)), center / cover no-repeat var(--ph);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
  box-shadow: 0 0 0 2px var(--volt);
}

.sheet-photo { margin-bottom: 14px; }
.sheet-photo img {
  display: block;
  width: 100%;
  max-height: 46dvh;
  object-fit: contain;
  border-radius: 16px;
  background: var(--surface);
}
.sheet-photo-actions { display: flex; gap: 8px; margin-top: 10px; }
.sheet-photo-actions .btn { flex: 1; }
/* Whether the server has this day's photo too. */
.photo-status { margin: 10px 2px 0; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.photo-status.ok { color: var(--faint); }
.photo-status.warn { color: var(--warn); }
.btn.danger { color: var(--danger); }
.sheet .photo-cta { margin-top: 10px; }

.photo-editor {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: #000;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
}
.pe-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.pe-bar .kicker { color: var(--volt); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); }
.seg button {
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  transition: background-color 160ms, color 160ms;
}
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--volt); }

/* The photo screen doubles as the monthly recap preview. */
.photo-editor:not(.recap) .pe-title { display: none; }
.photo-editor.recap #photo-format,
.photo-editor.recap [data-action="photo-retake"] { display: none; }
.photo-editor.recap #photo-flip { visibility: hidden; }
.photo-editor.recap .pe-actions { grid-template-columns: 1fr; }

.pe-flip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--muted);
  transition: background-color 160ms, color 160ms, transform 120ms var(--ease-out);
}
.pe-flip svg { width: 18px; height: 18px; }
.pe-flip[aria-pressed="true"] { background: var(--volt); color: var(--on-volt); }
.pe-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 16px; }
.pe-stage img { max-width: 100%; max-height: 100%; border-radius: 14px; object-fit: contain; }
.pe-loading { font-size: 15px; font-weight: 600; color: var(--muted); text-align: center; }

.pe-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 8px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
}
.pe-actions .btn { height: 52px; font-size: 16px; }
.pe-actions .btn:disabled { opacity: .4; }

.tiles.compact .tile { min-height: 92px; }
.tiles.compact .tile-name { font-size: 18px; margin-top: 7px; }

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 12px 12px 16px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(212, 255, 63, .22);
  font-size: 14px;
  font-weight: 600;
}
.banner.update { margin: 0 0 16px; box-shadow: inset 0 0 0 1.5px var(--volt); }

/* ---------- calendar ---------- */
.month-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 2px 14px;
}
.month-stat .d { font-size: 48px; line-height: .9; color: var(--volt); }
.month-stat .unit { font-size: 15px; font-weight: 800; }
.month-stat .of { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--muted); }

.cal {
  background: var(--surface);
  border-radius: 22px;
  padding: 12px 6px 8px;
  touch-action: pan-y;
}
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-week span { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 2px 0 10px; }
.cal-week .sat { color: var(--sat); }
.cal-week .sun { color: var(--sun); }

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: 3px 0 6px;
  border-radius: 12px;
  transition: transform 120ms var(--ease-out);
}
.day:active:not(:disabled) { transform: scale(.9); }
.day .num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.day.sat .num { color: var(--sat); }
.day.sun .num { color: var(--sun); }
.day.attended .num { background: var(--volt); color: var(--on-volt); font-weight: 800; }
.day.today .num { box-shadow: inset 0 0 0 2px var(--volt); color: var(--volt); }
.day.today.attended .num { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--volt); color: var(--on-volt); }
.day:disabled { opacity: .28; }
.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 34px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; }

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 22px;
  margin-top: 12px;
  padding: 6px 16px;
  border-radius: 18px;
  background: var(--surface);
}
.legend-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; font-size: 14px; font-weight: 700; min-width: 0; }
.legend-row i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; } /* same dot as under each date */
.legend-row b { margin-left: auto; font-size: 20px; line-height: 1; }
.legend-row.zero { color: var(--muted); }
.legend-row.zero b { color: var(--faint); }

/* ---------- stats ---------- */
.stat-hero { margin: 4px 2px 28px; }
.stat-hero .label { font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.mega { display: flex; align-items: baseline; gap: 4px; }
.mega .d.num { font-size: 116px; line-height: .8; font-weight: 900; color: var(--volt); letter-spacing: -.02em; font-variant-numeric: proportional-nums; }
.streak .d { font-variant-numeric: proportional-nums; }
.mega .d.den { font-size: 36px; color: var(--muted); }
.mega .unit { font-size: 16px; font-weight: 800; margin-left: 4px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); margin: 20px 0 10px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 3px; background: var(--volt); }
.sub { font-size: 13px; font-weight: 500; color: var(--muted); }

.block { background: var(--surface); border-radius: 22px; padding: 18px 16px 16px; margin-bottom: 12px; }

.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
.bar-track {
  height: 140px;
  padding-top: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.bar-val { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 14px; line-height: 1; color: var(--muted); }
.bar { width: 100%; max-width: 16px; min-height: 3px; border-radius: 4px 4px 2px 2px; background: var(--surface-3); }
.bar-col.current .bar { background: var(--volt); }
.bar-col.current .bar-val, .bar-col.current .bar-month { color: var(--volt); }
.bar-col.future .bar { background: var(--surface-2); }
.bar-month { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }

.prow {
  display: grid;
  grid-template-columns: 5.6em 1fr 2.6em;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.prow-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; min-width: 0; }
.prow-name i { width: 4px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.prow-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-track { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.prow-track i { display: block; height: 100%; border-radius: 3px; }
.prow-count { font-size: 22px; line-height: 1; text-align: right; }
.prow.top .prow-count { color: var(--volt); }

/* ---------- settings ---------- */
.group { background: var(--surface); border-radius: 18px; margin-bottom: 26px; overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
}
.row + .row, .group > form { border-top: 1px solid var(--line); }
.row-label { display: flex; flex-direction: column; font-size: 15px; font-weight: 700; min-width: 0; }
.row-label small { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.row-label.inline { flex-direction: row; align-items: center; gap: 10px; }
.bar-mark { width: 4px; height: 16px; border-radius: 2px; flex-shrink: 0; }
.tag { font-family: var(--display); font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--faint); }

.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 22px;
  font-weight: 600;
  transition: transform 120ms var(--ease-out), opacity 160ms;
}
.stepper button:active:not(:disabled) { transform: scale(.9); }
.stepper button:disabled { opacity: .3; }
.stepper output { min-width: 58px; text-align: center; font-size: 24px; color: var(--volt); }
.stepper output small { font-family: var(--font); font-style: normal; font-size: 13px; font-weight: 700; color: var(--text); margin-left: 2px; }

.btn {
  flex-shrink: 0;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 800;
  transition: transform 120ms var(--ease-out);
}
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--volt); color: var(--on-volt); }
.btn.small { height: 34px; padding: 0 14px; font-size: 14px; }
.text-btn { font-size: 14px; font-weight: 700; padding: 8px 4px; }
.text-btn.danger { color: var(--danger); }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; padding: 2px 16px 16px; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c);
  transition: box-shadow 160ms, transform 120ms var(--ease-out);
}
.swatch:active { transform: scale(.88); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }

.note { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 14px 4px 0; }
.note.tight { margin: -14px 6px 26px; }
.install { display: block; font-size: 14px; line-height: 1.75; padding: 14px 16px; color: var(--muted); }
.install b { color: var(--text); }

/* ---------- sheet ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity 220ms;
}
.backdrop.open { opacity: 1; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-width: 560px;
  max-height: 86dvh;
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding:
    8px
    max(var(--gutter), env(safe-area-inset-right, 0px))
    calc(18px + env(safe-area-inset-bottom, 0px))
    max(var(--gutter), env(safe-area-inset-left, 0px));
  border-radius: 26px 26px 0 0;
  background: var(--bg);
  box-shadow: 0 -1px 0 var(--line-strong);
  transform: translateY(100%);
  transition: transform 320ms var(--ease-out);
}
.sheet.open { transform: none; }
.handle { width: 36px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 16px; }
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head .kicker { color: var(--volt); font-size: 12px; margin-bottom: 4px; }
.sheet-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.sheet .note { margin-top: 14px; }
.sheet .tile { background: var(--surface); }
.sheet .tile[aria-pressed="true"] { background: var(--volt); }
.part-form { display: grid; gap: 16px; }
.part-form .swatches { padding: 2px 2px 0; }
.part-form .photo-cta { margin-top: 2px; }
.part-buttons { display: grid; gap: 8px; }
.part-cancel { width: 100%; height: 52px; font-size: 16px; }
.part-delete { width: 100%; height: 48px; background: transparent; }
.sheet .swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(max(calc(env(safe-area-inset-bottom, 0px) + 4px), 12px) + 64px + 12px);
  z-index: 30;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--volt);
  color: var(--on-volt);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 180ms, transform 240ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- pointer devices only ---------- */
@media (hover: hover) and (pointer: fine) {
  .tile:hover:not([aria-pressed="true"]) { background: var(--surface-2); }
  .icon-btn:hover:not(:disabled), .pill:hover, .btn:hover { filter: brightness(1.12); }
  .day:hover:not(:disabled) { background: var(--surface-2); }
  .tab:hover { color: var(--muted); }
  .tab[aria-current="page"]:hover { color: var(--volt); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ---------- forms (account) ---------- */
.field { display: flex; gap: 8px; }
.field input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  outline: none;
}
.field input::placeholder { color: var(--faint); }
.field input:focus { border-color: var(--volt); }
.field .btn { height: 46px; }
.link-btn { padding: 6px 2px; font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.auth-switch { margin: 16px 0 4px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-switch .link-btn { margin-left: 4px; font-size: 14px; color: var(--text); }
.pw-form { display: grid; gap: 10px; padding: 14px 16px 16px; }
.pw-form input:not(.sr-only) {
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  outline: none;
}
.pw-form input::placeholder { color: var(--faint); }
.pw-form input:focus { border-color: var(--volt); }
.pw-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.link-btn.danger { color: var(--danger); }
.section-head .count { margin-left: 4px; font-family: var(--display); font-style: italic; font-weight: 800; color: var(--volt); }

.handle-field { align-items: center; padding-left: 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); }
.handle-field span { font-weight: 800; color: var(--muted); }
.handle-field input { border: 0; padding-left: 4px; }
.handle-field:focus-within { border-color: var(--volt); }

/* ---------- 기록: three pages ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; margin: 0 0 22px; border-radius: 999px; background: var(--surface); }
.seg button { height: 36px; border-radius: 999px; font-size: 14px; font-weight: 800; color: var(--muted); transition: background 160ms var(--ease-out), color 160ms var(--ease-out); }
.seg button[aria-selected="true"] { background: var(--volt); color: var(--on-volt); }
.season-row { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 4px; }
.season-row h2 { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.stat-hero.compact { margin-bottom: 18px; }
.stat-hero.compact .mega .d.num { font-size: 88px; }
.stat-hero.compact .mega .d.den { font-size: 30px; }
.stat-hero.compact .progress { margin-top: 14px; }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-tile { padding: 14px; border-radius: 16px; background: var(--surface); }
.stat-tile span { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat-tile b { display: block; margin-top: 6px; font-size: 30px; line-height: 1; }
.stat-tile b small { margin-left: 2px; font-family: var(--font); font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); }
.bars.compact .bar-track { height: 96px; }

.badge-count { display: flex; align-items: baseline; gap: 6px; margin: 0 2px; }
.badge-count .d { font-size: 44px; line-height: 1; color: var(--volt); }
.badge-count small { font-size: 15px; font-weight: 700; color: var(--muted); }
.badge-count + .badge-progress { margin: 10px 2px 26px; }
.next-badge { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border-radius: 16px; background: var(--surface); text-align: left; }
.next-badge + .next-badge { margin-top: 8px; }
.next-badge .medal { --size: 46px; }
.next-badge-body { flex: 1; min-width: 0; }
.next-badge-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.next-badge-top b { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-badge-top small { flex-shrink: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.next-badge .progress { display: block; margin: 8px 0 0; }
.badge-all { margin-top: 28px; }
.badge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 6px; margin-bottom: 26px; }
.badge-cell { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; padding: 4px 0; }
.badge-cell .medal { --size: 56px; }
.badge-cell > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; color: var(--faint); }
.badge-cell.on > span { color: var(--text); }
.badge-cell.current:not(.on) .medal { box-shadow: inset 0 0 0 2px var(--mc); color: var(--mc); }
.badge-cell:active .medal { transform: scale(.94); }
.badge-cell .medal { transition: transform 120ms var(--ease-out); }
.badge-detail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 8px 6px; text-align: center; }
.badge-detail h2 { margin-top: 8px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.badge-detail .progress { width: 70%; margin: 6px 0 0; }
.badge-detail .btn { width: 100%; margin-top: 14px; }
.badge-got { font-size: 14px; font-weight: 800; color: var(--volt); }

/* ---------- badges ---------- */
/* One colour (--mc) and shape per group: circle, rounded square, shield. */
.medal {
  --size: 62px;
  --mc: var(--volt);
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--faint);
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.medal.square { border-radius: 30%; }
.medal.shield { border-radius: 24% 24% 50% 50% / 24% 24% 46% 46%; }
.medal b { font-size: calc(var(--size) * .42); line-height: .9; padding-right: .06em; }
.medal small {
  margin-top: 2px;
  font-family: var(--display);
  font-size: calc(var(--size) * .15);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.medal.long-num b { font-size: calc(var(--size) * .3); }
.medal.long-unit small { font-size: calc(var(--size) * .13); letter-spacing: .04em; }
.medal.on { background: var(--mc); color: var(--on-volt); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px var(--mc); }
.medal.rainbow.on {
  --mc: #F4F4F0;
  background: conic-gradient(from 200deg, #FF5D5D, #FF9F43, #FFD43B, #3DDC97, #38D9F5, #4F9BFF, #A78BFA, #FF5D5D);
}
.medal.big { --size: 128px; }

.badges { margin-bottom: 30px; }
.badges .section-head small { margin-left: 2px; font-family: var(--display); font-style: italic; font-weight: 800; color: var(--faint); }
.badge-progress { margin: -2px 0 22px; }
.badge-group + .badge-group { margin-top: 22px; }
.badge-group-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.badge-group-head h3 { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.badge-group-head span { font-size: 13px; font-weight: 700; color: var(--faint); }
.badge-group-head b { font-size: 17px; color: var(--muted); }
/* Swipe sideways through a group; the row runs to the screen edges. */
.badge-row {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px))) 0 calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: 6px max(var(--gutter), env(safe-area-inset-right, 0px)) 2px max(var(--gutter), env(safe-area-inset-left, 0px));
  scroll-padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
}
.badge-row::-webkit-scrollbar { display: none; }
.badge { flex: 0 0 80px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-align: center; }
.badge .medal { margin-bottom: 6px; }
.badge > b { font-size: 12px; font-weight: 800; line-height: 1.3; color: var(--muted); }
.badge > small { font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--faint); }
.badge.on > b { color: var(--text); }
.badge.on > small { color: var(--muted); }
.badge-note { margin: -6px 0 6px; font-size: 12px; font-weight: 600; color: var(--faint); }
/* This month's challenge, still in progress: outlined in the month's colour. */
.badge.current:not(.on) .medal { box-shadow: inset 0 0 0 2px var(--mc); color: var(--mc); }
.badge.current:not(.on) > small { color: var(--text); }

/* ---------- check-in celebration ---------- */
.cheer {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top, 0px) + 24px)
    max(var(--gutter), env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + 16px)
    max(var(--gutter), env(safe-area-inset-left, 0px));
  background: var(--bg);
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
  overscroll-behavior: contain;
}
.cheer.open { opacity: 1; }
.cheer-body, .cheer-actions { width: 100%; max-width: 560px; margin: 0 auto; }
.cheer-body { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; overflow-y: auto; }
.cheer .kicker { color: var(--volt); }
.cheer-num {
  margin: 14px 0 10px -8px;
  font-size: clamp(150px, 54vw, 232px);
  line-height: .76;
  font-weight: 900;
  letter-spacing: -.03em;
  color: var(--volt);
}
.cheer-title { font-size: 30px; font-weight: 800; letter-spacing: -.035em; line-height: 1.2; }
.cheer-meta { margin-top: 10px; font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--muted); }
.cheer-badges { display: grid; gap: 14px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line-strong); }
.cheer-badge { display: flex; align-items: center; gap: 16px; padding-left: 5px; }
.cheer-badge-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cheer-badge-text b { font-size: 18px; font-weight: 800; }
.cheer-badge-text small { font-size: 13px; font-weight: 600; color: var(--muted); }
.cheer-medals { display: flex; flex-wrap: wrap; gap: 20px; margin: 22px 0 26px; padding: 5px 0 5px 5px; }
.cheer-actions { display: grid; gap: 8px; }
.cheer-actions .photo-cta { margin: 0; }
.cheer-actions .btn { height: 52px; font-size: 16px; }

/* Entrance: the lines rise in one after another, then the medals land. */
.cheer-body > * { opacity: 0; transform: translateY(16px); transition: opacity 320ms var(--ease-out), transform 520ms var(--ease-out); }
.cheer.open .cheer-body > * { opacity: 1; transform: none; }
.cheer.open .cheer-body > :nth-child(2) { transition-delay: 50ms; }
.cheer.open .cheer-body > :nth-child(3) { transition-delay: 110ms; }
.cheer.open .cheer-body > :nth-child(4) { transition-delay: 170ms; }
.cheer.open .cheer-body > :nth-child(5) { transition-delay: 420ms; }
.cheer .medal { transform: scale(.5); transition: transform 460ms cubic-bezier(.34, 1.56, .64, 1); }
.cheer.open .medal { transform: none; transition-delay: 520ms; }
.cheer-actions { opacity: 0; transition: opacity 300ms var(--ease-out) 250ms; }
.cheer.open .cheer-actions { opacity: 1; }

/* ---------- account form (settings) ---------- */
.auth-title { font-size: 16px; font-weight: 800; }
.auth-form .note { margin: 0 2px; }
.pw-form .form-note { margin: 0 2px; text-align: left; }
.auth-form .auth-switch { margin: 4px 0 0; }
.pw-form .handle-field input { height: 44px; border: 0; padding-left: 4px; }
.pw-form .handle-field input:focus { border: 0; }
.auth-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }

/* ---------- crew ---------- */
.crew-intro {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}
.crew-intro b { color: var(--text); }
.crew-empty { padding: 28px 10px; text-align: center; font-size: 14px; line-height: 1.7; color: var(--muted); }
.crew-empty .btn { margin-top: 12px; }
.code { font-family: var(--display); font-style: italic; font-size: 20px; letter-spacing: .1em; color: var(--volt); }
.more-btn { display: block; width: 100%; margin: 4px 0 14px; }
.crew-form { padding: 14px 16px; }
.crew-form + .section-head { margin-top: 6px; }
.crew-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: -6px 0 18px; }
.crew-chips::-webkit-scrollbar { display: none; }
.crew-chips .pill { flex-shrink: 0; }
.crew-chips .pill[aria-pressed="true"] { background: var(--volt); color: var(--on-volt); }

.crew-board { border-top: 1px solid var(--line); margin-bottom: 10px; }
.crew-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto 46px;
  align-items: center;
  gap: 10px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line);
}
.crew-rank { font-size: 24px; line-height: 1; color: var(--faint); text-align: center; }
.crew-row.lead .crew-rank { color: var(--volt); }
.crew-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-name small { flex-shrink: 0; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); font-size: 11px; font-weight: 800; color: var(--muted); }
.crew-row.me .crew-name small { background: var(--volt); color: var(--on-volt); }
.crew-dots { display: flex; gap: 4px; }
.crew-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); }
.crew-dots i.on { background: var(--volt); }
.crew-dots i.today { background: transparent; box-shadow: inset 0 0 0 1.5px var(--volt); }
.crew-dots i.future { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.crew-count { text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); }
.crew-count b { font-size: 26px; line-height: 1; margin-right: 1px; color: var(--text); }
.crew-row.lead .crew-count b { color: var(--volt); }
.crew-last { margin: 0 2px 26px; font-size: 13px; font-weight: 600; color: var(--muted); }
.crew-last b { color: var(--text); }
.crew-none { margin: -6px 4px 14px; }

/* Today's proofs: swipe sideways; the row runs to the screen edges. */
.proof-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px))) 14px calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px)));
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  scroll-padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
}
.proof-strip::-webkit-scrollbar { display: none; }
.proof {
  flex: 0 0 132px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 6px;
  align-items: center;
  scroll-snap-align: start;
  text-align: left;
  transition: transform 140ms var(--ease-out);
}
.proof:active { transform: scale(.97); }
.proof img { grid-column: 1 / -1; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; border-radius: 16px; background: var(--surface-2); }
.proof-who { font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proof-fire { font-size: 12px; font-weight: 800; color: var(--muted); }
.proof-fire.on { color: #FFB067; }
.crew-manage { margin-top: 22px; }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 36;
  display: flex;
  flex-direction: column;
  padding:
    calc(env(safe-area-inset-top, 0px) + 10px)
    max(var(--gutter), env(safe-area-inset-right, 0px))
    calc(env(safe-area-inset-bottom, 0px) + 18px)
    max(var(--gutter), env(safe-area-inset-left, 0px));
  background: var(--bg);
  opacity: 0;
  transition: opacity 200ms var(--ease-out);
}
.viewer.open { opacity: 1; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.viewer-who { display: flex; flex-direction: column; min-width: 0; }
.viewer-who b { font-size: 16px; font-weight: 800; }
.viewer-who small { font-size: 12px; font-weight: 600; color: var(--muted); }
.viewer-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.viewer-stage { display: grid; place-items: center; }
.viewer-stage img { max-width: 100%; max-height: 58dvh; border-radius: 14px; object-fit: contain; }
.viewer-actions { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; }
.viewer-actions small { font-size: 13px; font-weight: 600; color: var(--muted); }
.fire {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: transform 120ms var(--ease-out), background-color 160ms, color 160ms;
}
button.fire:active { transform: scale(.9); }
.fire.on { background: rgba(255, 122, 26, .22); color: #FFB067; }

/* ---------- exercise log ---------- */
.log-block { display: grid; gap: 6px; margin-top: 10px; }
.log-row, .log-add {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px 10px 16px;
  border-radius: 16px;
  text-align: left;
  transition: transform 140ms var(--ease-out);
}
.log-row:active, .log-add:active { transform: scale(.98); }
.log-row { background: var(--surface); }
.log-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.log-row b { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row small { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row svg { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.log-add { justify-content: center; border: 1.5px dashed var(--line-strong); color: var(--muted); font-size: 15px; font-weight: 800; }
.log-add svg { width: 18px; height: 18px; }
.log-add small { font-size: 12px; font-weight: 600; color: var(--faint); }
.sheet .log-block { margin-top: 12px; }

/* Swipe a row left for 수정 / 삭제 (app.js), like the iOS app. The buttons sit behind
   the row at its right end and show as the row slides aside. */
.swipe { position: relative; touch-action: pan-y pinch-zoom; -webkit-user-select: none; user-select: none; }
.swipe-front { position: relative; z-index: 1; }
.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  border-radius: 16px;
  overflow: hidden;
  visibility: hidden;
}
.swipe.shown .swipe-actions { visibility: visible; }
.swipe-btn {
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  touch-action: manipulation;
}
.swipe-btn svg { width: 17px; height: 17px; }
.swipe-btn.danger { background: var(--danger); color: #fff; }
.swipe-btn:active { filter: brightness(.88); }
.comment-swipe .swipe-actions { border-radius: 10px; }

.ex-search { margin-bottom: 12px; }
.ex-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; padding-bottom: 2px; }
.ex-chips::-webkit-scrollbar { display: none; }
.ex-chips .pill { flex-shrink: 0; }
.ex-chips .pill[aria-pressed="true"], .crew-chips .pill[aria-pressed="true"] { background: var(--volt); color: var(--on-volt); }
.ex-list { display: grid; }
.ex-row { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 9px 2px; border-bottom: 1px solid var(--line); text-align: left; }
.ex-row:active { background: var(--surface); }
.ex-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-row b { font-size: 15px; font-weight: 700; }
.ex-row small { font-size: 12px; font-weight: 600; color: var(--muted); }
.ex-row i { font-style: normal; font-size: 12px; font-weight: 800; color: var(--volt); flex-shrink: 0; }
.ex-row svg { width: 18px; height: 18px; color: var(--volt); }
.ex-custom b { color: var(--volt); }

.ex-last { margin: -6px 2px 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
.set-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.set-row { display: flex; align-items: center; gap: 8px; }
.set-no { width: 24px; flex-shrink: 0; font-size: 20px; color: var(--faint); text-align: center; }
.set-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 50px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.set-field:focus-within { border-color: var(--volt); }
.set-field input {
  flex: 1;
  width: 0;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-family: var(--display);
  font-style: italic;
  font-weight: 800;
  font-size: 22px;
  text-align: right;
}
.set-field input::placeholder { color: var(--faint); }
.set-field span { font-size: 13px; font-weight: 700; color: var(--muted); }
.set-del { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; color: var(--faint); }
.set-del svg { width: 16px; height: 16px; }
.set-del:active { background: var(--surface); }
.set-add { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 48px; margin: 10px 0 2px; }
.set-add svg { width: 16px; height: 16px; }

.ex-best { display: flex; align-items: baseline; gap: 10px; margin: -4px 2px 14px; }
.ex-best .kicker { color: var(--volt); font-size: 12px; }
.ex-best b { font-size: 26px; line-height: 1; }
.ex-best small { font-size: 13px; font-weight: 700; color: var(--muted); }
.ex-history { display: grid; gap: 6px; }
.ex-history .log-row { background: var(--surface); }

.lift-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; border-top: 1px solid var(--line); text-align: left; }
.lift-row:first-of-type { border-top: 0; }
.lift-name { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lift-name b { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lift-name small { font-size: 12px; font-weight: 600; color: var(--muted); }
.lift-best { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.lift-best b { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 19px; color: var(--volt); }
.lift-best small { font-size: 11px; font-weight: 700; color: var(--muted); }
.lift-empty { margin: 0 2px; }

/* Short paragraphs and titles split into even lines instead of leaving a word or two
   alone on the last line. (Phones without support just wrap as before.) */
h1, h2, .cheer-title, .note, .crew-intro, .row-label small, .badge-note, .install, .auth-switch,
.crew-empty, .ex-last, .cheer-meta, .crew-last { text-wrap: balance; }

/* Recommended routine at the top of the exercise picker. */
.ex-group { padding: 16px 2px 6px; font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.ex-group b { color: var(--volt); font-weight: 800; }
.ex-list > .ex-group:first-child { padding-top: 4px; }
.ex-row > .ex-no { flex: 0 0 22px; font-size: 20px; color: var(--volt); text-align: center; }
.ex-row.rec small { color: var(--text); opacity: .7; }
.rec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rec-head small { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.rec-shuffle { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 6px 10px; border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 800; color: var(--text); transition: transform 120ms var(--ease-out); }
.rec-shuffle:active { transform: scale(.94); }
.rec-shuffle svg { width: 14px; height: 14px; }

/* Multi-select in the exercise picker. */
.ex-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
  color: transparent;
}
.ex-check svg { width: 13px; height: 13px; color: inherit; }
.ex-row.sel .ex-check { background: var(--volt); box-shadow: none; color: var(--on-volt); }
.ex-row.sel { background: rgba(212, 255, 63, .06); }
.ex-row > .ex-check { flex: 0 0 24px; display: grid; place-items: center; }
.ex-confirm {
  position: sticky;
  bottom: calc(-18px - env(safe-area-inset-bottom, 0px));
  margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px))) calc(-18px - env(safe-area-inset-bottom, 0px));
  padding: 14px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(10, 10, 11, 0), var(--bg) 26%);
}
.ex-confirm .photo-cta { margin: 0; }
.ex-skip { display: block; width: 100%; margin-top: 4px; padding: 12px; color: var(--muted); text-align: center; }

/* Comments under a crew proof. */
.comment-count { font-size: 14px; font-weight: 700; color: var(--muted); }
.comments { display: grid; gap: 12px; padding: 8px 2px 16px; }
.comment { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 2px; font-size: 15px; line-height: 1.45; }
.comment b { font-weight: 800; }
.comment span { overflow-wrap: anywhere; }
.comment small { grid-column: 2; font-size: 12px; color: var(--faint); }
.comment .link-btn { padding: 0; font-size: 12px; }
.comment.swipe-front { background: var(--bg); }
/* On touch screens own comments are deleted by swiping; the link is for mouse users. */
@media (hover: none) { .comment .link-btn[data-action="comment-delete"] { display: none; } }
.comments .note { margin: 4px 0 0; }
.comment-bar { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.comment-bar input { flex: 1; min-width: 0; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); outline: none; }
.comment-bar input:focus { border-color: var(--volt); }
.comment-bar .btn { height: 46px; }
