/* Dandelion — deep-night glass + honey. Deliberately not a slider tower. */
:root {
  --bg: #05060c;
  --ink: #e8e3d8;
  --dim: rgba(232, 227, 216, 0.55);
  --faint: rgba(232, 227, 216, 0.28);
  --honey: #e8b84b;
  --honey-soft: rgba(232, 184, 75, 0.16);
  --sage: #9fe0a8;
  --sky: #7fb2ff;
  --glass: rgba(14, 16, 26, 0.72);
  --line: rgba(232, 227, 216, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body { font-family: var(--sans); color: var(--ink); font-size: 14px; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 14px;
}

button {
  font: inherit; color: var(--ink); cursor: pointer;
  background: rgba(232, 227, 216, 0.07);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; transition: all 0.15s ease;
}
button:hover { background: rgba(232, 227, 216, 0.15); transform: translateY(-1px); }
button.primary { background: var(--honey-soft); border-color: rgba(232, 184, 75, 0.5); }
button.active { background: var(--honey-soft); border-color: var(--honey); color: var(--honey); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; background: rgba(232, 227, 216, 0.18);
  outline: none; width: 100%;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--honey); border: 2px solid #1a1508;
  box-shadow: 0 0 8px rgba(232, 184, 75, 0.55); cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--honey); border: 2px solid #1a1508; cursor: grab;
}
select {
  font: inherit; color: var(--ink); background: rgba(20, 23, 36, 0.9);
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px;
}

/* ============================== Nursery */
#nursery {
  position: fixed; inset: 0; overflow-y: auto; z-index: 5;
  background: linear-gradient(180deg, rgba(5, 6, 12, 0.55) 0%, rgba(5, 6, 12, 0.82) 100%);
  padding: 18px clamp(12px, 3vw, 40px) 30px;
}
#n-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { filter: drop-shadow(0 0 6px rgba(232, 184, 75, 0.6)); }
h1 {
  font-family: var(--serif); font-size: 32px; font-weight: 500;
  letter-spacing: 0.5px; color: var(--honey);
}
.tag { color: var(--dim); font-style: italic; font-family: var(--serif); }
.header-actions { display: flex; gap: 8px; }

#n-columns {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  align-items: start;
}
.panel {
  background: var(--glass); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
}
.panel h2 {
  font-family: var(--serif); font-weight: 500; font-size: 16px;
  color: var(--dim); margin-bottom: 10px; letter-spacing: 0.4px;
}

.ctl { margin: 9px 0; }
.ctl label { display: flex; justify-content: space-between; color: var(--dim); font-size: 12.5px; margin-bottom: 3px; }
.ctl label .val { color: var(--ink); font-variant-numeric: tabular-nums; }
.ctl.row { display: flex; align-items: center; gap: 8px; }
.ctl.row label { margin: 0; }
.stats { color: var(--dim); font-size: 12px; line-height: 1.55; margin-top: 8px; }
.stats b { color: var(--ink); font-weight: 500; }

#map-nursery { width: 100%; aspect-ratio: 1; border-radius: 12px; cursor: crosshair; touch-action: none; }

#prognosis { font-size: 13px; line-height: 1.65; }
#prognosis .verdict {
  font-family: var(--serif); font-size: 15.5px; font-style: italic;
  color: var(--honey); margin-bottom: 8px; line-height: 1.45;
}
#prognosis table { width: 100%; border-collapse: collapse; margin-top: 4px; }
#prognosis td { padding: 2.5px 0; color: var(--dim); font-size: 12.5px; }
#prognosis td:last-child { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
#prognosis .warn { color: var(--honey); }

#btn-launch {
  width: 100%; margin-top: 14px; padding: 13px;
  font-family: var(--serif); font-size: 18px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(232, 184, 75, 0.28), rgba(232, 184, 75, 0.10));
  border: 1px solid rgba(232, 184, 75, 0.65); color: var(--honey);
  box-shadow: 0 0 24px rgba(232, 184, 75, 0.18);
}
#btn-launch:hover { box-shadow: 0 0 36px rgba(232, 184, 75, 0.35); }

#n-presets { margin-top: 22px; }
#n-presets h2 { font-family: var(--serif); font-weight: 500; color: var(--dim); margin-bottom: 10px; }
#preset-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.preset-card {
  background: var(--glass); border: 1px solid var(--line); border-radius: 13px;
  padding: 11px 13px; cursor: pointer; transition: all 0.15s ease;
}
.preset-card:hover { border-color: rgba(232, 184, 75, 0.5); transform: translateY(-2px); }
.preset-card h3 { font-family: var(--serif); font-weight: 500; font-size: 15px; margin-bottom: 4px; }
.preset-card p { color: var(--dim); font-size: 11.5px; line-height: 1.5; }

/* ============================== Flight */
#flight > * { position: fixed; z-index: 6; }

#hud {
  top: 12px; left: 12px; padding: 10px 14px; font-size: 12.5px;
  line-height: 1.65; min-width: 175px;
}
#hud .age { font-family: var(--serif); font-size: 21px; color: var(--honey); font-variant-numeric: tabular-nums; }
#hud .kv { display: flex; justify-content: space-between; gap: 14px; color: var(--dim); }
#hud .kv span:last-child { color: var(--ink); font-variant-numeric: tabular-nums; }

#map-inset { top: 12px; right: 12px; width: 190px; height: 190px; }

#log {
  left: 12px; top: 50%; transform: translateY(-50%);
  width: 250px; max-height: 44vh; display: flex; flex-direction: column;
  padding: 10px 12px;
}
.drawer-title { color: var(--dim); font-size: 12px; letter-spacing: 0.6px; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
#log-entries { overflow-y: auto; margin-top: 6px; font-size: 12px; line-height: 1.5; }
.log-e { padding: 4px 0; border-bottom: 1px solid rgba(232, 227, 216, 0.06); animation: fadein 0.5s ease; }
.log-e .t { color: var(--honey); font-variant-numeric: tabular-nums; margin-right: 6px; font-size: 11px; }
.log-e.sn .t { color: #ff9a62; }
@keyframes fadein { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; } }
#log.collapsed #log-entries { display: none; }
#log.collapsed { max-height: none; }

#drawer {
  right: 12px; top: 50%; transform: translateY(-50%);
  width: 250px; padding: 10px 12px; max-height: 76vh; overflow-y: auto;
}
#drawer.collapsed #drawer-body { display: none; }
#drawer-toggle { border: none; background: none; padding: 2px; color: var(--dim); }
.chart { width: 100%; height: 56px; display: block; margin-top: 8px; }
.chart.tall { height: 74px; }

#deck {
  bottom: 12px; left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100vw - 24px)); padding: 10px 14px 8px;
}
#deck-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#warp-wrap { display: flex; align-items: center; gap: 8px; flex: 1; color: var(--dim); font-size: 12px; min-width: 160px; }
#warp-read { min-width: 68px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
#deck-row2 { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chips button { padding: 3px 9px; font-size: 11.5px; border-radius: 999px; }
#timeline { width: 100%; height: 30px; display: block; margin-top: 7px; cursor: default; }

#inspector {
  bottom: 128px; right: 12px; width: 210px; padding: 11px 13px; font-size: 12.5px; line-height: 1.6;
}
#inspector h3 { font-family: var(--serif); color: var(--honey); font-weight: 500; margin-bottom: 4px; }
#inspector .kv { display: flex; justify-content: space-between; color: var(--dim); }
#inspector .kv span:last-child { color: var(--ink); }
#inspector button { margin-top: 8px; width: 100%; }

#look-pop { bottom: 128px; left: 50%; transform: translateX(-50%); width: 250px; padding: 12px 14px; z-index: 8; }

/* ============================== overlays & misc */
#about-overlay, #error-overlay {
  position: fixed; inset: 0; z-index: 20; display: flex;
  align-items: center; justify-content: center;
  background: rgba(3, 4, 8, 0.72);
}
.box { max-width: 620px; max-height: 80vh; overflow-y: auto; padding: 22px 26px; line-height: 1.65; font-size: 13.5px; }
.box h2 { font-family: var(--serif); color: var(--honey); font-weight: 500; margin-bottom: 10px; }
.box h3 { font-family: var(--serif); color: var(--dim); font-weight: 500; margin: 14px 0 5px; }
.box p, .box li { color: var(--dim); margin-bottom: 7px; }
.box b { color: var(--ink); font-weight: 500; }
.box .close { float: right; }

#toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--honey); color: #191307; padding: 8px 18px;
  border-radius: 999px; z-index: 30; font-weight: 500;
  animation: fadein 0.25s ease;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(232, 227, 216, 0.15); border-radius: 4px; }

@media (max-width: 760px) {
  #log { display: none; }
  #drawer { top: auto; bottom: 130px; transform: none; max-height: 34vh; }
  #map-inset { width: 130px; height: 130px; }
}
