/* Grow the Hive — the skin that curdles.
 * Phase 1: warm cream and amber. Phase 2: cooling, clinical.
 * Phase 3: near-black, amber data-glow. The palette is the narrative.
 */

:root {
  --bg: #faf3e3;
  --bg-panel: #fffaf0;
  --ink: #3a2f1b;
  --ink-dim: #8a7a5c;
  --accent: #d99a26;
  --accent-dark: #a8741a;
  --line: #e6d9bd;
  --btn-bg: #fdf6e7;
  --btn-ink: #3a2f1b;
  --btn-border: #cdbb95;
  --danger: #b3471d;
  --font: Georgia, 'Times New Roman', serif;
}

body.phase-2 {
  --bg: #eceae4;
  --bg-panel: #f4f3ef;
  --ink: #2e2c28;
  --ink-dim: #7e7a72;
  --accent: #8f7330;
  --accent-dark: #6e5a28;
  --line: #d4d1c8;
  --btn-bg: #f0efe9;
  --btn-border: #b9b5a9;
  --danger: #8f2f12;
  --font: Helvetica, Arial, sans-serif;
}

body.phase-3 {
  --bg: #16130d;
  --bg-panel: #1d1910;
  --ink: #d8c294;
  --ink-dim: #79683f;
  --accent: #e8a93c;
  --accent-dark: #b07f24;
  --line: #342c1a;
  --btn-bg: #241e12;
  --btn-ink: #d8c294;
  --btn-border: #4a3d20;
  --danger: #e06636;
  --font: Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  transition: background-color 2s ease, color 2s ease;
  padding: 14px 18px 60px;
}

body.phase-1 {
  background-image: radial-gradient(var(--line) 0.8px, transparent 0.8px);
  background-size: 26px 26px;
}

h1 {
  font-size: 22px;
  font-weight: normal;
  letter-spacing: 0.04em;
  margin: 0 0 2px;
}

/* ---- splash: the jar you click to begin ---- */

#splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #faf3e3;
  display: flex;
  align-items: center;
  justify-content: center;
}

#splash img {
  width: min(600px, 85vw);
  cursor: pointer;
  transition: transform 0.25s ease;
}

#splash img:hover { transform: scale(1.03); }

#splash.leaving {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

#honeyCounter {
  font-size: 26px;
  margin: 4px 0 10px;
  font-variant-numeric: tabular-nums;
}

#honeyCounter .label { color: var(--ink-dim); font-size: 16px; }

/* ---- layout ---- */

#columns {
  display: flex;
  gap: 26px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.col { min-width: 270px; flex: 1 1 300px; max-width: 430px; }

.panel {
  border-top: 1px solid var(--line);
  margin-bottom: 18px;
  padding-top: 8px;
  transition: opacity 0.8s ease;
}

.panel h2 {
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 8px;
}

.panel .row {
  margin: 3px 0;
  font-variant-numeric: tabular-nums;
}

.row .val { color: var(--accent-dark); }
body.phase-3 .row .val { color: var(--accent); }

.hidden { display: none !important; }

/* ---- buttons ---- */

button {
  font-family: var(--font);
  font-size: 13px;
  background: var(--btn-bg);
  color: var(--btn-ink, var(--ink));
  border: 1px solid var(--btn-border);
  border-radius: 3px;
  padding: 4px 12px;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

button:hover:not(:disabled) { background: var(--bg); border-color: var(--accent-dark); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }

/* mobile: no double-tap zoom on rapid clicking, no tap highlight,
 * no accidental text selection while mashing Make Honey */
button, .project, #splash img {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

@media (max-width: 600px) {
  body { padding: 10px 12px 70px; }
  #btnMakeHoney { width: 100%; padding: 14px; font-size: 18px; }
  button { padding: 8px 14px; font-size: 14px; min-height: 36px; }
  .col { max-width: none; }
  #logPanel { height: 84px; }
}

#btnMakeHoney {
  font-size: 16px;
  padding: 8px 22px;
  border-color: var(--accent-dark);
  border-width: 1.5px;
}

button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---- activity log ---- */

#logPanel {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  height: 96px;
  overflow-y: auto;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-bottom: 14px;
  scroll-behavior: smooth;
}

#logPanel .entry { margin: 1px 0; }
#logPanel .entry:last-child { color: var(--ink); }

/* ---- projects ---- */

.project {
  border: 1px solid var(--line);
  background: var(--bg-panel);
  border-radius: 3px;
  padding: 7px 10px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color 0.15s ease, opacity 0.3s ease;
}

.project:hover.affordable { border-color: var(--accent); }
.project.unaffordable { opacity: 0.55; cursor: default; }
.project .ptitle { font-size: 13.5px; }
.project .pcost { font-size: 11.5px; color: var(--accent-dark); margin-left: 4px; }
.project .pdesc { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }
.project.danger { border-color: var(--danger); }
.project.danger .ptitle { color: var(--danger); }

/* ---- quorum nodes ---- */

#quorumNodes { display: flex; gap: 4px; margin: 6px 0; }
.qnode {
  width: 22px; height: 22px;
  border: 1px solid var(--btn-border);
  background: #000;
}

/* ---- sliders ---- */

input[type="range"] { width: 100%; accent-color: var(--accent); }
.slider-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* ---- probe designer ---- */

.design-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 2px 0; font-variant-numeric: tabular-nums;
}
.design-row .dname { flex: 1; }
.design-row button { padding: 0 8px; font-size: 13px; margin: 0 2px; }
.design-row .dval { width: 28px; text-align: center; color: var(--accent); }

/* ---- combat canvas ---- */

#combatCanvas {
  width: 100%;
  height: 120px;
  border: 1px solid var(--line);
  display: block;
  background: #16130d;
}

/* ---- endgame ---- */

#queenMessage {
  border: 1px solid var(--accent-dark);
  background: var(--bg-panel);
  padding: 14px 16px;
  margin: 10px 0;
  font-style: italic;
}
#queenMessage p { margin: 6px 0; }

#finalScreen {
  text-align: center;
  padding-top: 12vh;
}
#finalCount {
  font-size: 20px;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: 24px auto;
  max-width: 700px;
}

/* ---- the moment ---- */

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-6px, 3px); }
  20% { transform: translate(5px, -4px); }
  30% { transform: translate(-4px, -3px); }
  40% { transform: translate(6px, 2px); }
  50% { transform: translate(-5px, 4px); }
  60% { transform: translate(4px, -2px); }
  70% { transform: translate(-6px, -4px); }
  80% { transform: translate(5px, 3px); }
  90% { transform: translate(-3px, 2px); }
}
body.shaking { animation: shake 0.7s linear 3; }

@keyframes bloomflash {
  0% { opacity: 0; }
  15% { opacity: 1; }
  100% { opacity: 0; }
}
#bloomFlash {
  position: fixed;
  inset: 0;
  background: #ffd684;
  opacity: 0;
  pointer-events: none;
  z-index: 99;
}
#bloomFlash.go { animation: bloomflash 2.2s ease-out 1; }

/* ---- dev panel ---- */

#devPanel {
  position: fixed;
  bottom: 0; right: 0;
  background: rgba(0,0,0,0.82);
  color: #9fdfa0;
  font: 11px/1.5 monospace;
  padding: 8px 10px;
  z-index: 100;
  max-width: 320px;
}
#devPanel button {
  font: 10px monospace;
  background: #222; color: #9fdfa0;
  border: 1px solid #555;
  padding: 1px 6px;
}

#footer {
  position: fixed;
  bottom: 6px; left: 18px;
  font-size: 11px;
  color: var(--ink-dim);
}
#footer button {
  font-size: 10px;
  padding: 1px 6px;
}
