:root {
  /* sand, ember & ash — the past settles, the present burns, the future is unlit */
  --bg: #0d0905;
  --bg-soft: #151009;
  --panel: #1b150c;
  --border: #362916;
  --text: #ede3cf;
  --muted: #98876a;
  --lived: #d8a55c;
  --lived-dim: #8a6a33;
  --now: #ff5c38;
  --future: #2c241a;
  --danger: #ff5c38;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Fraunces", Georgia, serif;
}

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

body {
  background: radial-gradient(1100px 700px at 50% -10%, #1c130a 0%, var(--bg) 65%) fixed var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  padding-bottom: 4rem;
}

.site-header {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
}
.site-header h1 {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  letter-spacing: 0.14em;
  color: var(--lived);
  text-shadow: 0 0 36px rgba(216, 165, 92, 0.35);
}
.tagline {
  color: var(--muted);
  max-width: 560px;
  margin: 0.75rem auto 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---------- controls: 3 guided steps ---------- */
.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 300px));
  gap: 1rem;
  justify-content: center;
  align-items: stretch;
  padding: 1rem;
}
@media (max-width: 880px) {
  .controls { grid-template-columns: minmax(230px, 380px); }
}
.step {
  display: flex;
  gap: 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.step-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--lived);
  color: #0d0905;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.step-body > label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.step-hint {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.controls input[type="date"] {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color-scheme: dark;
  width: 100%;
}
.controls input[type="date"]:focus {
  outline: none;
  border-color: var(--lived);
}
.fine-tune summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  user-select: none;
}
.fine-tune summary:hover { color: var(--lived); }
.fine-tune[open] summary { color: var(--lived); }
.fine-tune .lifespan-inputs { margin-top: 0.6rem; }
.lifespan-inputs { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.ls-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.ls-unit input {
  width: 58px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.45rem 0.3rem;
  border-radius: 8px;
  text-align: center;
}
.ls-unit input:focus { outline: none; border-color: var(--lived); }
.ls-unit > span {
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.preset-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.preset-btns button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.preset-btns button:hover {
  border-color: var(--lived);
  color: var(--lived);
}

/* ---------- progress ---------- */
.progress-wrap { max-width: 820px; margin: 1.5rem auto 0; padding: 0 1rem; }
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}
#pct-lived { color: var(--lived); }
#pct-left { color: var(--muted); }
.progress-bar {
  height: 14px;
  background: var(--future);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b87f1f, var(--lived));
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 18px rgba(216, 165, 92, 0.5);
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  max-width: 980px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
}
.stat .num {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat .num.gold { color: var(--lived); }
.stat .num.green { color: var(--now); }
.stat .lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.5rem 0;
  padding: 0 1rem;
}
.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); border-color: var(--muted); }
.tab.active {
  background: var(--lived);
  border-color: var(--lived);
  color: #0d0905;
  font-weight: 700;
}

/* ---------- views ---------- */
.view { display: none; max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.view.active { display: block; }
.view-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}
.lgd {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}
.lgd-lived { background: var(--lived); }
.lgd-now { background: var(--now); }
.lgd-future { background: var(--future); }

/* ---------- chain view ---------- */
.chain-scroll {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 1.5rem 0.5rem 2rem;
  scrollbar-color: var(--border) transparent;
}
.block {
  flex: 0 0 auto;
  width: 138px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem;
  font-family: var(--mono);
}
.block .bnum {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.block .bage {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.2rem 0;
}
.block .bhash {
  font-size: 0.55rem;
  color: var(--muted);
  word-break: break-all;
  opacity: 0.7;
  line-height: 1.4;
}
.block .bstatus {
  font-size: 0.6rem;
  margin-top: 0.4rem;
  letter-spacing: 0.05em;
}
.block {
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.block:hover {
  transform: translateY(-4px);
  border-color: var(--text);
}
.block.past { border-color: var(--lived-dim); }
.block.past .bage { color: var(--lived); }
.block.past .bstatus { color: var(--lived); }
.block.current {
  border-color: var(--now);
  box-shadow: 0 0 22px rgba(255, 92, 56, 0.35);
  animation: mining 1.6s ease-in-out infinite;
}
.block.current .bage { color: var(--now); }
.block.current .bstatus { color: var(--now); }
.block.future { opacity: 0.45; border-style: dashed; }
.block.future .bhash { visibility: hidden; }
.block.future .bstatus { color: var(--muted); }
.chain-link {
  flex: 0 0 auto;
  width: 22px;
  height: 2px;
  background: var(--border);
  position: relative;
}
.chain-link.mined { background: var(--lived-dim); }
@keyframes mining {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 92, 56, 0.25); }
  50% { box-shadow: 0 0 30px rgba(255, 92, 56, 0.6); }
}

/* ---------- drill-down (weeks + spiral zoom) ---------- */
.crumbs {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
.crumbs button {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.32rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.crumbs button:hover { color: var(--lived); border-color: var(--lived); }
.crumbs button:last-of-type { color: var(--text); border-color: var(--muted); }

.frame-countdown {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--danger);
  margin-bottom: 1.1rem;
  min-height: 1.2em;
  font-variant-numeric: tabular-nums;
}
.frame-countdown.done { color: var(--lived); }

.crumbs button.active {
  background: var(--lived);
  border-color: var(--lived);
  color: #0d0905;
  font-weight: 700;
}
#hourglass svg { cursor: pointer; }

.drill-grid { display: grid; gap: 10px; }
.drill-grid[data-unit="day"] { grid-template-columns: repeat(7, 84px); grid-auto-rows: 84px; }
.drill-grid[data-unit="hour"] { grid-template-columns: repeat(6, 76px); grid-auto-rows: 76px; }
.drill-grid[data-unit="minute"],
.drill-grid[data-unit="second"] { grid-template-columns: repeat(10, 50px); grid-auto-rows: 50px; }

.dcell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: var(--mono);
  background: var(--future);
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
}
.dcell:hover { transform: scale(1.07); border-color: var(--text); }
.dcell.leaf { cursor: default; }
.dcell.leaf:hover { transform: none; border-color: transparent; }
.dcell.lived { background: var(--lived); color: #0d0905; font-weight: 700; }
.dcell.now {
  background: var(--now);
  color: #0d0905;
  font-weight: 700;
  animation: pulse-soft 1.4s ease-in-out infinite;
}
.dcell .big { font-size: 1.05rem; }
.dcell .sml { font-size: 0.58rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.08em; }
@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 92, 56, 0.4); }
  50% { box-shadow: 0 0 18px rgba(255, 92, 56, 0.9); }
}

/* ---------- weeks view ---------- */
.weeks-wrap {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}
/* center the pair without clipping edges when it overflows */
.weeks-wrap > :first-child { margin-left: auto; }
.weeks-wrap > :last-child { margin-right: auto; }
.weeks-axis {
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  font-size: 0.6rem;
  color: var(--muted);
  text-align: right;
  flex: 0 0 auto;
}
.weeks-axis span { height: 13px; line-height: 13px; }
.weeks-grid {
  display: grid;
  grid-template-columns: repeat(52, 10px);
  grid-auto-rows: 10px;
  gap: 3px;
  flex: 0 0 auto;
}
.wk {
  width: 10px; height: 10px;
  border-radius: 2px;
  background: var(--future);
}
.wk.lived { background: var(--lived); }
.wk.now {
  background: var(--now);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(255,92,56,0.6); }
  50% { transform: scale(1.5); box-shadow: 0 0 8px rgba(255,92,56,0.9); }
}

/* ---------- svg views ---------- */
.svg-wrap { display: flex; justify-content: center; }
.svg-wrap svg { max-width: 600px; width: 100%; height: auto; }
.hourglass-caption {
  text-align: center;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

@keyframes fall {
  to { stroke-dashoffset: -20; }
}
.sand-stream {
  stroke-dasharray: 3 7;
  animation: fall 0.5s linear infinite;
}

/* ---------- block explorer modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.exp-header {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
}
.exp-title {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0.25rem 0 0.1rem;
}
.exp-title.past { color: var(--lived); }
.exp-title.current { color: var(--now); }
.exp-title.future { color: var(--muted); }
.exp-status {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
.exp-status.past { color: var(--lived); }
.exp-status.current { color: var(--now); }
.exp-status.future { color: var(--muted); }
.exp-rows { border-top: 1px solid var(--border); }
.exp-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
}
.exp-row .k {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.exp-row .v {
  text-align: right;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}
.exp-row .v.gold { color: var(--lived); }
.exp-row .v.green { color: var(--now); }
.exp-row .v.red { color: var(--danger); }
.exp-fill-bar {
  height: 8px;
  background: var(--future);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.9rem 0 0.2rem;
}
.exp-fill-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #b87f1f, var(--lived));
}
.exp-note {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.9rem;
  text-align: center;
}

/* ---------- ticker ---------- */
.ticker {
  text-align: center;
  margin: 2.5rem auto 0;
  font-family: var(--mono);
}
.ticker-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.ticker-value {
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--danger);
  text-shadow: 0 0 24px rgba(255, 92, 56, 0.4);
}

/* ---------- share ---------- */
.share-wrap { text-align: center; margin-top: 1.5rem; }
#share-btn {
  background: transparent;
  border: 1px solid var(--lived-dim);
  color: var(--lived);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
#share-btn:hover {
  background: var(--lived);
  color: #0d0905;
  box-shadow: 0 0 22px rgba(216, 165, 92, 0.4);
}

/* first visit: nudge the eye to step 1 */
.step.attention {
  border-color: var(--lived);
  animation: beckon 2s ease-in-out infinite;
}
@keyframes beckon {
  0%, 100% { box-shadow: 0 0 0 rgba(216, 165, 92, 0); }
  50% { box-shadow: 0 0 24px rgba(216, 165, 92, 0.4); }
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 3rem;
  padding: 0 1rem;
}
.site-footer p + p { margin-top: 0.4rem; }
.site-footer a { color: var(--lived-dim); }
.site-footer a:hover { color: var(--lived); }
