:root {
  --umber: #1A1410;
  --espresso: #2B211A;
  --espresso-light: #362A20;
  --gold: #C9A227;
  --gold-bright: #E0BE4F;
  --oxblood: #5C2028;
  --moss: #4A5226;
  --rust: #C1602C;
  --rust-bright: #D97D46;
  --pine: #3F6B4F;
  --pine-bright: #5A9270;
  --ivory: #EDE6D6;
  --parchment: #A89A85;
  --parchment-dim: #6E6252;
  --hairline: rgba(201, 162, 39, 0.18);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--umber);
  color: var(--ivory);
  font-family: 'Manrope', sans-serif;
  min-height: 100vh;
  position: relative;
  padding-bottom: 88px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

body::after {
  content: "";
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 140%;
  height: 60%;
  background: radial-gradient(ellipse at center, rgba(201,162,39,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px 20px;
  position: relative;
  z-index: 2;
}

/* ---------- view switching ---------- */
.view { display: none; }
.view.active { display: block; }

/* ---------- week view ---------- */
.week-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.area-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
  scrollbar-width: none;
}
.area-filter::-webkit-scrollbar { display: none; }

.area-chip {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--parchment-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.area-chip .area-dot { box-shadow: none; }

.area-chip.active {
  color: var(--umber);
  border-color: transparent;
  font-weight: 600;
}

.rocks-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 26px;
  scrollbar-width: none;
  min-height: 96px;
}
.rocks-scroll::-webkit-scrollbar { display: none; }

.rock-card {
  flex-shrink: 0;
  width: 190px;
  background: var(--espresso);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  padding: 14px 15px;
}

.rock-card .rock-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--parchment-dim);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rock-card .rock-name {
  font-family: 'Fraunces', serif;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 10px;
}

.status-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: 'IBM Plex Mono', monospace;
}
.status-badge.on-track { background: rgba(63,107,79,0.25); color: var(--pine-bright); }
.status-badge.at-risk { background: rgba(92,32,40,0.25); color: #E08A93; }
.status-badge.not-started { background: rgba(168,154,133,0.15); color: var(--parchment-dim); }
.status-badge.done { background: rgba(201,162,39,0.2); color: var(--gold-bright); }

.goal-list { margin-bottom: 8px; }

.goal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px 13px 12px;
  background: var(--espresso);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  margin-bottom: 8px;
}

.goal-item .goal-name {
  flex: 1;
  font-size: 14px;
  color: var(--ivory);
}

.l10-card {
  background: var(--espresso);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 18px 18px 16px;
  margin-bottom: 26px;
}

.l10-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.l10-score {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-bright);
}
.l10-score span { font-size: 14px; color: var(--parchment-dim); font-family: 'IBM Plex Mono', monospace; }

.l10-wins {
  font-size: 13px;
  color: var(--parchment);
  line-height: 1.6;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.greeting {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 26px;
  font-optical-sizing: auto;
  letter-spacing: 0.2px;
}

.greeting em {
  font-style: italic;
  font-weight: 300;
  color: var(--gold);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--parchment-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right;
  line-height: 1.5;
}

.gear-btn {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--parchment-dim);
  flex-shrink: 0;
}
.gear-btn svg { width: 15px; height: 15px; }
.gear-btn.connected { color: var(--gold); border-color: var(--gold); }

.hairline {
  height: 1px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--hairline) 40%, transparent 100%);
  margin: 16px 0 22px;
}

.quote-strip {
  border-left: 2px solid var(--gold);
  padding: 4px 0 4px 14px;
  margin-bottom: 26px;
  min-height: 36px;
}

.quote-strip p {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 14.5px;
  color: var(--parchment);
  line-height: 1.5;
}

.quote-strip span {
  display: block;
  margin-top: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--parchment-dim);
}

.ledger {
  position: relative;
  background: linear-gradient(160deg, var(--espresso) 0%, var(--espresso-light) 100%);
  border-radius: 3px;
  padding: 24px 20px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 14px 30px -12px rgba(0,0,0,0.55);
  min-height: 140px;
}

.ledger::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(201, 162, 39, 0.22);
  border-radius: 2px;
  pointer-events: none;
}

.ledger-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.ledger-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.ledger-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--parchment-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.priority-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 2px 16px 12px;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.3s ease;
  border-radius: 0 3px 3px 0;
}

.priority-row + .priority-row { border-top: 1px dashed var(--hairline); }
.priority-row:first-child { padding-top: 4px; }
.priority-row:last-child { padding-bottom: 4px; }
.priority-row.done { opacity: 0.42; }
.priority-row.done .label { text-decoration: line-through; text-decoration-color: var(--parchment-dim); }

.priority-num {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
  min-width: 28px;
  line-height: 1;
  padding-top: 2px;
}

.priority-text { flex: 1; }

.priority-text .label {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ivory);
  margin-bottom: 5px;
}

.priority-text .meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--parchment-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.area-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.priority-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  margin-top: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.35s var(--ease-pop);
  position: relative;
}
.priority-check svg { width: 11px; height: 11px; opacity: 0; stroke: var(--umber); transition: opacity 0.15s ease; }
.priority-row.done .priority-check { background: var(--gold); transform: scale(1.12); }
.priority-row.done .priority-check svg { opacity: 1; }
.priority-row:active .priority-check { transform: scale(0.88); }

@keyframes spark-out {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(var(--angle)); opacity: 1; }
  100% { transform: translate(-50%, -50%) translateY(-22px) scale(0) rotate(var(--angle)); opacity: 0; }
}

.spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold-bright);
  pointer-events: none;
  animation: spark-out 0.55s ease-out forwards;
}

.placeholder-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--hairline);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--parchment-dim);
  letter-spacing: 0.03em;
}

.empty-state {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--parchment-dim);
  padding: 20px 4px;
  line-height: 1.6;
}

.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--parchment-dim);
  margin-bottom: 10px;
}

.streak-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 26px;
  scrollbar-width: none;
  min-height: 38px;
}
.streak-scroll::-webkit-scrollbar { display: none; }

.streak-pill {
  flex-shrink: 0;
  background: var(--espresso);
  border: 1px solid var(--hairline);
  border-radius: 30px;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.3s var(--ease-pop);
}

.streak-pill .flame { font-size: 13px; }
.streak-pill .n { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 14px; color: var(--gold-bright); }
.streak-pill .name { font-size: 12px; color: var(--parchment); }

@keyframes pulse-grow {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.streak-pill.pulse { animation: pulse-grow 0.5s var(--ease-pop); }
.streak-pill.pulse .n { color: var(--rust-bright); }

.teaser-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }

.teaser-card {
  background: var(--espresso);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 18px 14px 16px;
  position: relative;
  overflow: hidden;
}

.teaser-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, var(--gold));
}

.teaser-card:nth-of-type(1) { --accent-color: var(--rust); }
.teaser-card:nth-of-type(2) { --accent-color: var(--pine); }
.teaser-card:nth-of-type(3) { --accent-color: var(--gold); }

.teaser-card .tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 8px;
  display: block;
}

.teaser-card .headline { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.teaser-card .sub { font-size: 11.5px; color: var(--parchment-dim); }

.teaser-card.wide {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.warn-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--oxblood);
  border: 1px solid var(--oxblood);
  padding: 3px 8px;
  border-radius: 20px;
  background: rgba(92,32,40,0.15);
}

nav.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  background: rgba(26, 20, 16, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--hairline);
}

.nav-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  padding: 10px 8px 14px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--parchment-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 4px 10px;
  transition: color 0.2s ease;
}

.nav-item .icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.nav-item svg { width: 18px; height: 18px; stroke: var(--parchment-dim); transition: stroke 0.2s ease; }
.nav-item.active { color: var(--gold-bright); }
.nav-item.active svg { stroke: var(--gold-bright); }

.toast {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--espresso-light);
  border: 1px solid var(--gold);
  color: var(--ivory);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 10px 18px;
  border-radius: 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 20;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- settings modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--espresso-light);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 24px 22px;
  max-width: 380px;
  width: 100%;
}

.modal h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 19px;
  margin-bottom: 8px;
}

.modal p {
  font-size: 13px;
  color: var(--parchment);
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal input {
  width: 100%;
  background: var(--umber);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 11px 12px;
  color: var(--ivory);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  margin-bottom: 14px;
}
.modal input:focus { outline: none; border-color: var(--gold); }

.modal-actions { display: flex; gap: 10px; }

.btn {
  flex: 1;
  padding: 11px;
  border-radius: 4px;
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--parchment);
}

.btn.primary {
  background: var(--gold);
  color: var(--umber);
  border-color: var(--gold);
}

.modal-note {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--parchment-dim);
  margin-top: 14px;
  line-height: 1.6;
}

/* ---------- entrance animation ---------- */
@keyframes fade-slide-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  opacity: 0;
  animation: fade-slide-up 0.55s ease-out forwards;
}

/* ---------- loading shimmer ---------- */
@keyframes shimmer-sweep {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  border-radius: 4px;
  background: linear-gradient(90deg, var(--espresso) 25%, var(--espresso-light) 50%, var(--espresso) 75%);
  background-size: 200% 100%;
  animation: shimmer-sweep 1.6s ease-in-out infinite;
}
.shimmer.line { height: 14px; margin-bottom: 8px; }
.shimmer.pill { height: 38px; width: 96px; border-radius: 30px; flex-shrink: 0; }

/* ---------- celebration ---------- */
.celebrate-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

@keyframes confetti-fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(var(--spin)); opacity: 0.9; }
}

.confetti-piece {
  position: absolute;
  top: 0;
  width: 7px;
  height: 11px;
  border-radius: 1px;
  animation: confetti-fall linear forwards;
}

.celebrate-banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, -10px);
  background: var(--espresso-light);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 16px 26px;
  text-align: center;
  z-index: 41;
  opacity: 0;
  animation: fade-slide-up 0.5s var(--ease-pop) forwards, banner-out 0.4s ease-in 2.1s forwards;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,0.6);
}

@keyframes banner-out {
  to { opacity: 0; transform: translate(-50%, -20px); }
}

.celebrate-banner .headline {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 500;
  color: var(--gold-bright);
  margin-bottom: 3px;
}

.celebrate-banner .sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--parchment);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (min-width: 760px) {
  .wrap { max-width: 720px; padding-top: 48px; }
  .greeting { font-size: 32px; }
  .ledger { padding: 30px 32px 28px; }
  .teaser-grid { grid-template-columns: 1fr 1fr 1fr; }
  .teaser-card.wide { grid-column: span 1; flex-direction: column; align-items: flex-start; gap: 10px; }
  nav.bottom-nav { position: sticky; top: 0; bottom: auto; border-top: none; border-bottom: 1px solid var(--hairline); }
  .nav-inner { max-width: 720px; justify-content: flex-start; gap: 28px; padding: 14px 8px; }
  body { padding-bottom: 40px; }
}
