/* HustleArc — dark winter-night design system (system font stack only, offline-first) */
:root {
  --bg: #0C1210;
  --card: #16211B;
  --card-line: rgba(242, 245, 241, 0.07);
  --text: #F2F5F1;
  --muted: rgba(242, 245, 241, 0.55);
  --accent: #3D9B4A;
  --accent-bright: #4ADE80;
  --danger: #F87171;
  --radius: 28px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  padding-bottom: 110px;
}
.hidden { display: none !important; }
a { color: var(--accent-bright); }
button { font-family: var(--font); cursor: pointer; }
h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 14px; }
h3 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(12, 18, 16, 0.92);
  backdrop-filter: blur(10px);
}
.wordmark { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.wordmark span { color: var(--accent); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--card-line);
  background: var(--card); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 21px; height: 21px; }
.snow-toggle { color: var(--accent-bright); }
.snow-toggle.off { color: var(--muted); opacity: 0.55; }

main { max-width: 560px; margin: 0 auto; padding: 6px 16px 0; }

/* ---------- drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0, 0, 0, 0.55);
}
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
  width: min(320px, 84vw);
  background: #101713;
  border-right: 1px solid var(--card-line);
  transform: translateX(-105%);
  transition: transform 0.28s ease;
  display: flex; flex-direction: column;
  padding: 26px 22px;
}
.drawer.open { transform: translateX(0); }
.drawer-season { color: var(--accent-bright); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; }
.drawer-app { font-size: 24px; font-weight: 800; margin: 6px 0 4px; }
.drawer-dates { color: var(--muted); font-size: 14px; }
.drawer-privacy { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin-top: 14px; }
.drawer-nav { margin-top: 30px; display: flex; flex-direction: column; gap: 6px; }
.drawer-item {
  text-align: left; background: none; border: none; color: var(--text);
  font-size: 17px; font-weight: 600; padding: 12px 14px; border-radius: 14px;
}
.drawer-item:hover { background: rgba(255, 255, 255, 0.05); }
.drawer-item.active { background: rgba(61, 155, 74, 0.16); color: var(--accent-bright); }
.drawer-foot { margin-top: auto; color: var(--muted); font-size: 13px; border-top: 1px solid var(--card-line); padding-top: 14px; }

/* ---------- buttons ---------- */
.btn {
  border: none; border-radius: 999px; padding: 13px 22px;
  font-size: 15px; font-weight: 700; display: inline-block; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: #2f7c3b; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid rgba(242, 245, 241, 0.25); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.45); }
.btn-small { padding: 9px 16px; font-size: 13.5px; }
.btn.grow { flex: 1; }

/* ---------- home / clock-in ---------- */
.clockin-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  padding: 30px 24px 26px;
  background: linear-gradient(155deg, #0d3527 0%, #14532d 58%, #2c7a3f 100%);
  margin-top: 10px;
}
.clockin-season { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; color: rgba(255,255,255,0.75); text-transform: uppercase; }
.clockin-headline { font-size: 33px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; margin: 14px 0 8px; }
.clockin-sub { color: rgba(255,255,255,0.78); font-size: 15px; line-height: 1.5; }
.clockin-stat {
  display: inline-block; margin-top: 20px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 16px; padding: 12px 18px; text-align: center;
}
.clockin-stat .stat-label { font-size: 11px; letter-spacing: 0.14em; color: rgba(255,255,255,0.7); font-weight: 700; }
.clockin-stat .stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.clockin-btn {
  width: 100%; margin-top: 20px; padding: 17px;
  border: none; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); color: #12351d;
  font-size: 16.5px; font-weight: 800;
}
.clockin-btn.done { background: rgba(255, 255, 255, 0.28); color: rgba(255,255,255,0.85); }
.clockin-open {
  display: block; margin: 18px auto 2px; background: none; border: none;
  color: #fff; font-size: 15.5px; font-weight: 700;
}
.snowdot { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.5); pointer-events: none; }
.home-note { margin-top: 18px; }
.home-quick { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- progress ---------- */
.progress-head { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.progress-head h2 { margin-bottom: 0; }
.tabs {
  display: flex; background: var(--card); border-radius: 999px; padding: 5px; margin: 14px 0 18px;
}
.tab {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 10px 0; border-radius: 999px; font-size: 15px; font-weight: 700;
}
.tab.active { background: var(--accent); color: #fff; }

.habit-card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}
.habit-head { display: flex; align-items: center; gap: 12px; }
.habit-chip {
  width: 46px; height: 46px; border-radius: 15px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.habit-chip svg { width: 24px; height: 24px; }
.habit-title { flex: 1; min-width: 0; }
.habit-title h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.streak { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.edit-btn { color: var(--muted); width: 38px; height: 38px; background: rgba(255,255,255,0.05); border: none; }
.edit-btn svg { width: 18px; height: 18px; }
.check-btn {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  border: 2px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06); color: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}
.check-btn svg { width: 27px; height: 27px; }
.check-btn:active { transform: scale(0.93); }
.check-btn.done { color: #fff; border-color: transparent; }
.check-btn:disabled { opacity: 0.35; }

.week-row { display: flex; justify-content: space-between; margin-top: 16px; }
.day-col { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.day-letter { font-size: 12px; color: var(--muted); font-weight: 600; }
.day-circle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.06); color: transparent;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.day-circle svg { width: 19px; height: 19px; }
.day-circle.done { color: #fff; }
.day-circle.today { border-color: rgba(255,255,255,0.55); }
.day-circle.off { opacity: 0.3; }
.day-circle.future { opacity: 0.35; }

.grid { display: grid; gap: 4px; margin-top: 14px; }
.grid.week { grid-template-columns: repeat(7, 1fr); }
.grid.month { grid-template-columns: repeat(7, 1fr); }
.grid.arc { grid-template-columns: repeat(7, 1fr); gap: 3px; }
.gcell {
  aspect-ratio: 1; border-radius: 5px;
  background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); font-weight: 600;
}
.grid.arc .gcell { border-radius: 3px; }
.gcell.blank { background: transparent; }
.gcell.today { outline: 2px solid rgba(255,255,255,0.6); outline-offset: -2px; }
.gcell.future { opacity: 0.4; }
button.gcell { border: none; padding: 0; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.gcell:active { transform: scale(0.9); }
.progress-hint { margin: 12px 2px 0; font-size: 13px; }

.empty-state {
  text-align: center; padding: 40px 20px;
  border: 1px dashed rgba(242,245,241,0.18); border-radius: var(--radius);
}
.empty-state p { color: var(--muted); line-height: 1.55; margin-bottom: 18px; }
.empty-state .btn { margin: 4px; }

.fab {
  position: fixed; right: 20px; bottom: 24px; z-index: 35;
  width: 62px; height: 62px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff;
  font-size: 32px; font-weight: 400; line-height: 1;
  box-shadow: 0 10px 26px rgba(0,0,0,0.45);
}

/* ---------- data & credits ---------- */
.data-card {
  background: var(--card); border: 1px solid var(--card-line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
}
.data-card .muted { margin: 6px 0 14px; }
.data-card.danger h3 { color: var(--danger); }

#view-credits p { line-height: 1.65; font-size: 15.5px; margin-bottom: 14px; color: rgba(242,245,241,0.88); }
.credits-made { font-size: 27px; }
.credits-work-label { font-weight: 700; color: var(--text) !important; margin-bottom: 6px !important; }
.credits-work { list-style: none; margin-bottom: 16px; }
.credits-work li { line-height: 1.6; font-size: 15.5px; padding: 7px 0; border-bottom: 1px solid var(--card-line); color: rgba(242,245,241,0.88); }
.credits-signoff { font-size: 19px !important; font-weight: 800; color: var(--text) !important; }
.credits-foot { color: var(--muted) !important; font-size: 14px !important; line-height: 1.7 !important; }

/* ---------- modal ---------- */
.modal {
  position: fixed; left: 50%; bottom: 0; z-index: 60;
  transform: translateX(-50%);
  width: min(560px, 100%);
  max-height: 92vh; overflow-y: auto;
  background: #131b16;
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--card-line); border-bottom: none;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h3 { font-size: 20px; font-weight: 800; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 18px 0 9px; letter-spacing: 0.02em; }
#habitName {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--accent);
  color: var(--text); font-size: 16px; font-family: var(--font); outline: none;
}
.field-error { color: var(--danger); font-size: 13px; margin-top: 7px; }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.icon-pick {
  aspect-ratio: 1; border-radius: 14px; border: 1.5px solid transparent;
  background: rgba(255,255,255,0.05); color: #7FB2FF;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.icon-pick svg { width: 23px; height: 23px; }
.icon-pick.selected { border-color: var(--accent-bright); background: rgba(61,155,74,0.18); color: var(--accent-bright); }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; padding: 0; }
.swatch.selected { border-color: #fff; }
.freq-toggle { display: flex; gap: 8px; }
.chip {
  border: 1.5px solid rgba(242,245,241,0.2); background: transparent; color: var(--muted);
  border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 700;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.day-chips { display: flex; gap: 7px; margin-top: 12px; }
.day-chip {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(242,245,241,0.2); background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 700; padding: 0;
}
.day-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal-actions { display: flex; gap: 10px; margin-top: 26px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 70;
  background: #1E2B22; color: var(--text); border: 1px solid var(--card-line);
  padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); white-space: nowrap;
}

/* ---------- in-app confirm (WebView-safe: window.confirm is a no-op inside
   the Android shell, which silently broke Archive / Reset / Import) ---------- */
#confirmOverlay { z-index: 80; }
#confirmModal { z-index: 90; }
.confirm-text { font-size: 15px; line-height: 1.55; color: var(--text); margin: 4px 0 0; }
