/* Momen2m — small, calm, fast. Dark first (kind to OLED batteries), light on request. */
:root {
  --bg: #0f1220;
  --bg2: #151a2e;
  --card: #1b2038;
  --card2: #222847;
  --line: #2b3154;
  --text: #eef0ff;
  --muted: #9aa0c3;
  --accent: #6c70ff;
  --accent2: #8a8dff;
  --ok: #3ddc97;
  --warn: #ffb03a;
  --danger: #ff5c7a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 18px;
  --tab-h: 60px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f5fb; --bg2: #eceef8; --card: #ffffff; --card2: #f1f2fa; --line: #dfe2f0;
    --text: #171a2e; --muted: #626890; --accent: #5458f0; --accent2: #6c70ff;
    --ok: #178a5e; --warn: #a86a00; --danger: #d6335a; /* readable on white */
    --shadow: 0 10px 30px rgba(20, 24, 60, .10);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  touch-action: pan-x pan-y; /* no pinch zoom: a zoomed page left the fixed tab bar mid-screen on iOS */
}
input, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 20px; font-weight: 700; }
.hint { color: var(--muted); font-size: 14px; }
.hint.boost-hint { color: #f5b301; font-weight: 600; }
.muted { color: var(--muted); }
.center { text-align: center; }

#app { min-height: 100%; }
.screen {
  min-height: 100vh; min-height: 100dvh;
  padding: calc(var(--sat) + 12px) 16px calc(var(--tab-h) + var(--sab) + 96px);
  max-width: 560px; margin: 0 auto;
}
.screen.setup { padding-bottom: calc(var(--tab-h) + var(--sab) + 32px); }

/* ---- top bar (live) ------------------------------------------------------ */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px 14px; }
.clock { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.stats { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
/* Four pills next to the clock must fit one row on a 375 px phone, in French too. */
@media (max-width: 400px) {
  .clock { font-size: 28px; }
  .stats { gap: 6px; }
  .stat { padding: 5px 8px; font-size: 12px; }
}
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.stat.today { color: var(--ok); }
.stat.today.neg { color: var(--danger); }
.xpbar { height: 4px; background: var(--card2); border-radius: 2px; overflow: hidden; margin: 0 2px 16px; }
.xpfill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s ease; }
.rank { font-size: 12px; color: var(--muted); margin: -12px 2px 14px; display: flex; justify-content: space-between; }

/* ---- timeline ------------------------------------------------------------ */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 10px 2px 0; font-weight: 700; }

.occ {
  position: relative;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
  will-change: transform, opacity;
}
.occ .emo { font-size: 26px; line-height: 1; width: 36px; text-align: center; }
.occ .name { font-weight: 700; font-size: 16px; }
.occ .when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.occ .side { font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.occ.past { opacity: .5; padding: 8px 14px; cursor: pointer; }
.occ.past .emo { font-size: 20px; }
.occ.past .name { font-size: 14px; }
.occ.past.done .side { color: var(--ok); }
.occ.past.missed .side { color: var(--danger); }
.occ.past .undo { margin-left: 6px; }

.occ.upcoming { background: transparent; border-style: dashed; cursor: pointer; }

.occ.active { background: var(--card2); border-color: var(--accent); cursor: pointer; }
.occ.current.expandable { cursor: pointer; }

/* the current moment: one big card */
.occ.current {
  grid-template-columns: 1fr; text-align: center; gap: 6px;
  padding: 24px 18px 18px;
  background: linear-gradient(180deg, var(--card2), var(--card));
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.occ.current .emo { font-size: 56px; width: auto; margin-bottom: 4px; }
.occ.current .name { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.occ.current .desc { color: var(--muted); font-size: 15px; margin-top: 2px; }
.occ.current .when { margin-top: 4px; }
.ringwrap { position: relative; width: 160px; height: 160px; margin: 14px auto 6px; }
.ringwrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ringwrap .track { fill: none; stroke: var(--line); stroke-width: 8; }
.ringwrap .prog { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .4s; }
.ringwrap.warn .prog { stroke: var(--warn); }
.ringwrap.danger .prog { stroke: var(--danger); }
.count {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1;
}
.count small { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.ringwrap.danger .count { color: var(--danger); animation: pulse 1s ease-in-out infinite; }
.stake { color: var(--ok); font-weight: 700; font-size: 14px; }
.actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 14px; padding: 12px 18px; font-weight: 700; font-size: 15px; cursor: pointer;
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; opacity: .7;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #05261a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 13px; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.big { min-height: 54px; font-size: 17px; border-radius: 16px; }
.link { background: none; border: 0; color: var(--accent2); font-weight: 600; padding: 6px 2px; cursor: pointer; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--tab-h) + var(--sab) + 18px);
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 30px; line-height: 1;
  box-shadow: var(--shadow); cursor: pointer; z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
.fab:active { transform: scale(.95); }

/* ---- tab bar ------------------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  height: calc(var(--tab-h) + var(--sab)); padding-bottom: var(--sab);
  display: flex; background: var(--bg2); border-top: 1px solid var(--line);
}
.tab {
  flex: 1; min-width: 0; padding: 0 2px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
.tab .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .ico { font-size: 22px; line-height: 1; position: relative; padding: 3px 14px; border-radius: 12px; transition: background .2s; }
.tab.on { color: var(--accent2); }
.tab.on .ico { background: rgba(108, 112, 255, .22); }
.dot-badge { position: absolute; top: 1px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg2); }

/* ---- empty states -------------------------------------------------------- */
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty .emo { font-size: 44px; margin-bottom: 8px; }
.empty h2 { color: var(--text); margin-bottom: 4px; }

/* ---- setup --------------------------------------------------------------- */
.section { margin-top: 26px; }
.section h2 { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer;
}
.item .emo { font-size: 24px; width: 32px; text-align: center; }
.item .name { font-weight: 700; }
.item .sub { font-size: 13px; color: var(--muted); }
.item.off { opacity: .5; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: middle; }
.dot.i2 { background: var(--accent); }
.dot.i3 { background: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.dim { opacity: .4; }
.chip.day { padding: 8px 0; width: 42px; justify-content: center; }

.field { margin-top: 14px; }
.field > label, .field > .lbl { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.input, select, textarea {
  width: 100%; appearance: none; background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; min-height: 46px;
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type="time"] { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row .emoji-in { flex: 0 0 64px; text-align: center; font-size: 24px; padding: 8px; }
.slot { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.slot .arrow { color: var(--muted); }
.slot.dur { grid-template-columns: 1fr 1fr auto; }
.durctl { display: flex; align-items: center; gap: 6px; }
.durctl input { min-width: 0; text-align: right; }
.durctl .unit { color: var(--muted); font-size: 13px; font-weight: 600; }
.fieldhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.fieldhead > label { margin-bottom: 0 !important; }
.seg.mini { padding: 2px; border-radius: 10px; }
.seg.mini button { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.iconbtn { border: 0; background: var(--card2); color: var(--muted); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; font-size: 18px; }

.seg { display: flex; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 9px 6px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.toggle .t { font-weight: 600; }
.toggle .s { font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 15px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.toggle input[type="range"] { width: 48%; accent-color: var(--accent); margin: 0; }
/* Clock inputs in a settings row keep their natural width (the minutes stay visible); the label wraps instead. */
.toggle.times-row > div:first-child { min-width: 0; }
.times { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.times .input[type="time"] { width: auto; min-height: 38px; padding: 6px 10px; }
.tin { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tin small { font-size: 11px; color: var(--muted); line-height: 1; }
.toggle select { width: auto; min-height: 38px; padding: 6px 30px 6px 12px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 14px; }
.card.pad { padding: 16px; }
.btnrow { display: flex; gap: 10px; margin-top: 16px; }
.btnrow .btn { flex: 1; }

/* ---- confirm dialog (floats above a sheet) -------------------------------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(5, 7, 20, .45); opacity: 0; transition: opacity .15s; }
.dialog-wrap.open { opacity: 1; }
.dialog { background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 18px; max-width: 360px; width: 100%; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); transform: scale(.96); transition: transform .15s; }
.dialog-wrap.open .dialog { transform: scale(1); }
.dialog h3 { font-size: 17px; margin-bottom: 6px; }
.dialog p { color: var(--text); line-height: 1.4; }
.dialog .btnrow { margin-top: 14px; }
.btn.danger { background: var(--danger); color: #fff; }

/* ---- bottom sheet -------------------------------------------------------- */
.backdrop { position: fixed; inset: 0; background: rgba(5, 7, 20, .55); z-index: 20; opacity: 0; transition: opacity .2s; }
.backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  background: var(--bg2); border-radius: 22px 22px 0 0; padding: 12px 18px calc(var(--sab) + 20px);
  max-width: 560px; margin: 0 auto;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
  -webkit-overflow-scrolling: touch;
}
.sheet.open { transform: translateY(0); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin-bottom: 4px; }

/* ---- onboarding ---------------------------------------------------------- */
.ob { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding: calc(var(--sat) + 28px) 22px calc(var(--sab) + 22px); max-width: 560px; margin: 0 auto; }
.ob .body { flex: 1; }
.ob .logo { width: 84px; height: 84px; border-radius: 22px; margin: 10px 0 18px; box-shadow: var(--shadow); }
.ob h1 { margin-bottom: 8px; }
.ob p { color: var(--muted); font-size: 16px; }
.ob .chips { margin-top: 18px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0 12px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.ob .foot { display: flex; gap: 10px; }
.ob .foot .btn { flex: 1; }
.ob .card { margin-top: 16px; }
.ob .skip { text-align: center; margin-top: 18px; }
.ob .times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.ob .times .field { margin-top: 0; }
.ob .times .input { width: 100%; }
.ob .toggle .s { font-variant-numeric: tabular-nums; }
.qitem { border-bottom: 1px solid var(--line); }
.qitem:last-child { border-bottom: 0; }
.qrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.qrow .q { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.qrow .q > span { font-size: 22px; flex: none; }
.qrow .seg { flex: none; min-width: 118px; }
.stepper { display: flex; align-items: center; gap: 10px; padding: 0 0 12px 32px; color: var(--muted); font-size: 14px; font-weight: 600; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.stepper b { min-width: 22px; text-align: center; color: var(--text); font-size: 17px; }
/* Re-setup review: what validating would do to each moment. */
.toggle.st { padding-left: 12px; border-left: 3px solid transparent; margin-left: -14px; }
.toggle.st-new { border-left-color: var(--ok); }
.toggle.st-changed { border-left-color: #f5a524; }
.toggle.st-removed { border-left-color: var(--danger); }
.toggle.st-removed .t { text-decoration: line-through; opacity: .7; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 8px; margin-left: 6px; vertical-align: 1px; color: #fff; }
.tag.new { background: var(--ok); color: #05261a; }
.tag.changed { background: #f5a524; color: #2b1a00; }
.tag.removed { background: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .new::before { background: var(--ok); }
.legend .changed::before { background: #f5a524; }
.legend .removed::before { background: var(--danger); }
.chip.st-new { border-color: var(--ok); }
/* Update note: shorter than a normal sheet so the app stays visible behind it. */
.sheet.update { max-height: 78vh; max-height: 78dvh; display: flex; flex-direction: column; }
.sheet.update .notes { overflow-y: auto; min-height: 0; flex: 1; margin: 6px -4px 0; padding: 0 4px; }
.sheet.update .notes h3 { font-size: 14px; color: var(--muted); margin: 14px 0 4px; }
.sheet.update .notes h3:first-child { margin-top: 4px; }
.sheet.update .notes ul { list-style: none; padding: 0; margin: 0; }
.sheet.update .notes li { padding: 5px 0; font-size: 15px; line-height: 1.35; }
.dontshow { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.dontshow input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 14px; color: var(--muted); margin-top: 14px; }

/* ---- toasts -------------------------------------------------------------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--sab) + 90px); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 16px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow);
  display: flex; gap: 12px; align-items: center;
  animation: toastin .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.good { border-color: var(--ok); color: var(--ok); }
.toast.bad { border-color: var(--danger); color: var(--danger); }
.toast.out { animation: toastout .25s ease forwards; }
.toast .btn.small { margin: -6px -8px -6px 0; }

/* ---- animations ---------------------------------------------------------- */
.occ.enter { animation: rise .45s cubic-bezier(.2, .8, .2, 1) both; }
.occ.leave { animation: fadeup .5s ease both; }
.pop { animation: pop .35s cubic-bezier(.2, .8, .2, 1); }
.shake { animation: shake .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(48px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fadeup { from { opacity: 1; transform: none; } to { opacity: .5; transform: translateY(-6px); } }
@keyframes toastin { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateY(10px); } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes pop { 50% { transform: scale(1.06); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* completion sparkles */
.sparkle { position: fixed; z-index: 25; pointer-events: none; font-size: 22px; animation: spark .9s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

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

/* import / restore preview */
.diff { margin: 10px 0 12px; max-height: 40vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 14px; }
.diff-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 2px; color: var(--muted); }
.diff-head.add { color: var(--ok); } .diff-head.del { color: var(--danger); } .diff-head.chg { color: var(--accent); }
.diff-row { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; color: var(--text); }
.diff-row .sign { font-weight: 800; width: 12px; flex: none; }
.diff-row.add .sign { color: var(--ok); } .diff-row.del .sign { color: var(--danger); } .diff-row.chg .sign { color: var(--accent); }
.diff-row.del .name { text-decoration: line-through; opacity: .8; }
.diff-row .emo { flex: none; }
.diff-row .txt { display: flex; flex-direction: column; min-width: 0; }
.diff-row .sub { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.diff-row.same, .diff-row.more, .diff-row.pts { color: var(--muted); margin-top: 4px; }

/* offline / update banner */
.banner { background: var(--card); border: 1px solid var(--accent); border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.banner.boost { border-color: #f5b301; background: linear-gradient(90deg, rgba(245,179,1,.14), var(--card)); font-weight: 600; cursor: pointer; }
.ag-goal { margin-top: 10px; cursor: pointer; }
.ag-head { display: flex; align-items: center; gap: 12px; }
.ag-head > div { flex: 1; min-width: 0; }
.ag-head .name { font-weight: 700; }
.ag-head .sub { font-size: 13px; color: var(--muted); }
.ag-emo { font-size: 28px; line-height: 1; }
.ag-pct { font-size: 15px; color: var(--accent2); }
.ag-goal .bprog { margin-top: 10px; height: 6px; }
.ag-task { margin-top: 8px; }
.ag-decide { margin-top: 8px; border-color: var(--accent); }
.ag-q { font-weight: 700; font-size: 15px; }
.btnrow.wrap { flex-wrap: wrap; }
.ag-step { cursor: pointer; }
.ag-dstep { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.ag-dstep:last-child { border-bottom: 0; }
.ag-dstep.on { background: var(--card2); }
.ag-dstep.past { opacity: .75; }
.ag-dstep.next { border-left: 3px solid var(--accent2); }
.ag-link { cursor: pointer; }
.ag-undo { font-size: 12px; padding: 0 6px; }
textarea.input { resize: vertical; }
.ag-dstep .lrow { border-bottom: 0; padding: 4px 0; }
.ag-dtask { font-size: 13px; color: var(--muted); padding: 2px 0 2px 8px; }
.ag-dtask.ok { color: var(--text); }
.ag-taskrow, .ag-opt { margin-top: 6px; }
/* Slide to unlock the current step of a running quest. */
.slider { margin-top: 10px; touch-action: none; --slid: 0; }
.slider-track { position: relative; height: 50px; border-radius: 25px; background: var(--card2); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.slider-track::before { content: ''; position: absolute; inset: 0; background: var(--ok); opacity: calc(var(--slid) * .35); transition: opacity .1s; }
.slider-label { position: relative; font-size: 14px; font-weight: 600; color: var(--muted); padding-left: 36px; opacity: calc(1 - var(--slid) * 1.6); }
.slider-knob { position: absolute; left: 4px; top: 4px; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); cursor: grab; transition: transform .25s; user-select: none; -webkit-user-select: none; }
.slider.dragging .slider-knob { transition: none; cursor: grabbing; }
.slider.unlocked .slider-track::before { opacity: .6; }
.slider.unlocked .slider-knob { background: var(--ok); }
.ag-payout { margin-top: 12px; }
.ag-payout .bprog.big { max-width: none; margin: 6px 0 8px; height: 10px; }
.ag-paylegend { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.qrwrap { display: flex; justify-content: center; margin: 14px 0 8px; }
.qrwrap canvas { width: 240px; max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 10px; }
.ag-url { word-break: break-all; font-size: 11px; font-family: monospace; }
.tile.wide { grid-column: 1 / -1; }
.ag-taskrow .iconbtn, .ag-opt .iconbtn { flex: 0 0 40px; }
.greet { display: flex; gap: 14px; align-items: center; padding: 14px 16px; margin-bottom: 12px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(135deg, rgba(108,112,255,.22), var(--card) 70%); border: 1px solid var(--line); animation: greetin .5s ease; }
.greet .emo { font-size: 30px; line-height: 1; flex: none; }
.greet p { margin: 0; font-weight: 600; font-size: 15px; line-height: 1.35; }
.greet small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
@keyframes greetin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- hover tooltips (pointer devices only; taps open a sheet instead) ---- */
@media (hover: hover) and (pointer: fine) {
  [data-tip] { position: relative; }
  [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
    background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
    font-size: 12px; font-weight: 500; line-height: 1.35; width: max-content; max-width: 240px; text-align: left; white-space: normal;
    box-shadow: var(--shadow); z-index: 40; pointer-events: none; animation: toastin .15s ease;
  }
}
.stat { cursor: pointer; }
.xpwrap { cursor: pointer; }

/* ---- progress tab -------------------------------------------------------- */
.screen.progress { padding-bottom: calc(var(--tab-h) + var(--sab) + 32px); }
.ptitle { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hero { display: flex; gap: 16px; align-items: center; padding: 16px; cursor: pointer; background: linear-gradient(135deg, var(--card), var(--card2)); }
.hero .lvl { width: 78px; height: 78px; border-radius: 50%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 8px 24px rgba(108, 112, 255, .35); }
.hero .lvl .big { font-size: 30px; font-weight: 800; line-height: 1; }
.hero .lvl .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.hero .hero-txt { flex: 1; min-width: 0; }
.hero .rankname { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.hero .xpbar { margin: 0 0 6px; height: 6px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 12px 0 4px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer; }
.tile:active { transform: scale(.98); }
.tile .v { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.tile .v.pos { color: var(--ok); } .tile .v.neg { color: var(--danger); }
.tile .l { font-size: 13px; font-weight: 700; }
.tile .s { font-size: 12px; color: var(--muted); }
.progress .section h2 { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 10px; }
.chart { display: flex; gap: 8px; align-items: flex-end; height: 120px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; position: relative; }
.chart .bar { width: 100%; height: 88px; display: flex; align-items: flex-end; }
.chart .bar i { display: block; width: 100%; border-radius: 6px 6px 3px 3px; background: var(--accent2); opacity: .55; transition: height .4s ease; }
.chart .col.today .bar i { opacity: 1; background: linear-gradient(180deg, var(--accent2), var(--accent)); }
.chart .col.neg .bar i { background: var(--danger); }
.chart .lbl { font-size: 12px; color: var(--muted); font-weight: 700; }
.chart .col.today .lbl { color: var(--text); }
.chart .star { position: absolute; top: -2px; font-size: 11px; color: var(--warn); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; touch-action: pan-y; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.pager .dots { margin: 0; }
.pager .iconbtn:disabled { opacity: .3; cursor: default; }
.occ.tomorrow { opacity: .8; }
.occ.tomorrow .side { font-size: 13px; color: var(--muted); }
.badge { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.badge:active { transform: scale(.97); }
.badge .emo { font-size: 30px; line-height: 1.1; }
.badge .bname { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.2; }
.badge.earned { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(108, 112, 255, .25) inset, 0 6px 18px rgba(108, 112, 255, .18); }
.badge.locked .emo { filter: grayscale(1); opacity: .45; }
.badge.locked .bname { color: var(--muted); }
.bprog { width: 100%; height: 4px; background: var(--card2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.bprog i { display: block; height: 100%; background: var(--accent2); }
.bprog.big { height: 8px; margin: 14px auto 8px; max-width: 220px; }
.badge-hero { font-size: 64px; line-height: 1.1; margin: 4px 0 8px; }
.badge-hero.locked { filter: grayscale(1); opacity: .5; }
.hrow { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hrow:last-child { border-bottom: 0; }
.hrow .emo { font-size: 22px; flex: none; }
.hrow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.hrow .name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ratebar { height: 5px; background: var(--card2); border-radius: 3px; overflow: hidden; }
.ratebar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.hrow .pct { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.hrow .pct.low { color: var(--warn); }
.tips p { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tips p:last-child { border-bottom: 0; }
.ladder { margin-top: 12px; }
.lrow { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lrow:last-child { border-bottom: 0; }
.lrow.on { font-weight: 800; color: var(--accent2); }
.pos { color: var(--ok); font-weight: 700; } .neg { color: var(--danger); font-weight: 700; }
.dots-week { display: flex; gap: 8px; justify-content: center; margin: 14px 0 6px; }
.dot-day { width: 38px; height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); }
.dot-day small { font-size: 10px; font-weight: 700; }
.dot-day.ok { color: var(--ok); border-color: var(--ok); } .dot-day.ko { color: var(--danger); border-color: var(--danger); }
