:root {
  --bg: #f4f1ea;
  --panel: #fffdf8;
  --ink: #1c1a17;
  --muted: #6b6457;
  --line: #ddd6c8;
  --accent: #b1361e;     /* agitprop red */
  --accent-soft: #f3d9d2;
  --gold: #9a7b1f;
  --good: #2f6b3a;
  --heat: #c2410c;
  --shadow: 0 1px 0 rgba(0,0,0,0.04), 0 2px 6px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.brand h1 {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 30px;
  margin: 0;
}
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.clock { text-align: right; min-width: 200px; }
.week-label { font-family: "Helvetica Neue", Arial, sans-serif; font-weight: 700; font-size: 18px; }
.term { color: var(--muted); font-size: 13px; }
.year-bar {
  margin-top: 6px; height: 6px; width: 200px; background: var(--line);
  border-radius: 3px; overflow: hidden;
}
.year-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.3s linear; }

/* ---- Resources ---- */
.resources {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.res-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}
.res-card .res-name {
  font-family: "Helvetica Neue", Arial, sans-serif;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.res-card .res-value {
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 24px;
  font-weight: 600;
  margin-top: 2px;
}
.res-card .res-rate { font-size: 11px; color: var(--muted); font-family: "SF Mono", Menlo, monospace; min-height: 14px; }
.res-card.heat .res-value { color: var(--heat); }
.res-card.heat.calm .res-value { color: var(--ink); }

/* ---- Columns ---- */
.columns {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 16px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}
.hint { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

/* ---- Action buttons ---- */
.actions { display: flex; flex-direction: column; gap: 8px; }
.action-btn {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.action-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.action-btn:active:not(:disabled) { transform: translateY(1px); }
.action-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.action-btn .a-title { font-weight: 700; }
.action-btn .a-sub { display: block; font-size: 12px; color: var(--muted); font-family: "SF Mono", Menlo, monospace; }

/* ---- Funding menu ---- */
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.menu-item:hover:not(:disabled) { border-color: var(--gold); background: #fbf6e8; }
.menu-item:disabled { opacity: 0.5; cursor: not-allowed; }
.menu-item.bought { opacity: 0.6; background: #f0ede4; cursor: default; border-style: dashed; }
.menu-item .m-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.menu-item .m-title { font-weight: 700; font-size: 14px; }
.menu-item .m-cost { font-family: "SF Mono", Menlo, monospace; font-size: 13px; color: var(--gold); white-space: nowrap; }
.menu-item.bought .m-cost { color: var(--good); }
.menu-item .m-desc { font-size: 12px; color: var(--muted); margin-top: 3px; }
.menu-item .m-tags { margin-top: 5px; font-size: 11px; font-family: "SF Mono", Menlo, monospace; display: flex; gap: 10px; flex-wrap: wrap; }
.tag-commit { color: var(--accent); }
.tag-heat { color: var(--heat); }

/* ---- Log ---- */
.log {
  font-size: 13px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
}
.log-entry { padding: 5px 0; border-bottom: 1px dotted var(--line); }
.log-entry .l-week { color: var(--muted); font-family: "SF Mono", Menlo, monospace; font-size: 11px; margin-right: 6px; }
.log-entry.good { color: var(--good); }
.log-entry.bad { color: var(--accent); }

/* ---- Footer & overlay ---- */
.footer { margin-top: 26px; display: flex; align-items: center; gap: 14px; }
.footer-note { font-size: 12px; color: var(--muted); }
.ghost-btn {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--muted);
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.overlay {
  position: fixed; inset: 0; background: rgba(20,18,15,0.55);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.overlay.hidden { display: none; }
.overlay-card {
  background: var(--panel); border-radius: 12px; padding: 28px 32px; max-width: 460px;
  text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.overlay-card h2 { font-family: "Helvetica Neue", Arial, sans-serif; margin-top: 0; }
.primary-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 10px 22px; font-size: 15px; cursor: pointer; font-family: inherit; margin-top: 10px;
}
.primary-btn:hover { background: #922c18; }

@media (max-width: 880px) {
  .columns { grid-template-columns: 1fr; }
  .resources { grid-template-columns: repeat(2, 1fr); }
}
