/* =====================================================
   LATENT SPACE SEARCH — meta-explorer
   Single shell that iframes each direction's own index.
   Mossy palette, dark sidebar, full-bleed iframe stage.
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background: #0e1808;
  color: #e8d9b8;
  -webkit-font-smoothing: antialiased;
}
body {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
  overflow: hidden;
}
body[data-sidebar="hidden"] { grid-template-columns: 0 1fr; }
body[data-sidebar="hidden"] .sidebar { transform: translateX(-100%); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

:root {
  --moss:    #3e6232;
  --lime:    #7ed14a;
  --hot:     #c4ff8a;
  --vine:    #1c2410;
  --umber:   #2a2014;
  --gold:    #ae9866;
  --cream:   #fbf3df;
  --paper:   #e8d9b8;
  --ink:     #1c2410;
  --rule:    rgba(212, 196, 138, 0.18);
  --rule-strong: rgba(212, 196, 138, 0.32);
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(126, 209, 74, 0.10), transparent 60%),
    linear-gradient(180deg, #0e1808, #050a02);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: transform 320ms cubic-bezier(.2,.7,.2,1);
  position: relative;
}

.sidebar__head {
  padding: 26px 24px 18px;
  border-bottom: 1px solid var(--rule);
}
.sidebar__pretitle {
  font: 500 10px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(212, 196, 138, 0.6);
}
.sidebar__title {
  font-family: 'Fraunces', serif;
  font-weight: 800;
  font-size: 38px;
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 8px 0 14px;
  color: var(--cream);
}
.sidebar__title em {
  font-style: italic;
  font-weight: 400;
  color: var(--lime);
}
.sidebar__sub {
  font: 500 11.5px/1.5 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  margin: 0;
  color: rgba(212, 196, 138, 0.55);
}

/* =====================================================
   ROUNDS LIST
   ===================================================== */
.rounds {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 18px;
  gap: 2px;
}
.rounds__rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 12px 8px;
}

.round {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px 12px;
  border-radius: 6px;
  text-align: left;
  color: rgba(232, 217, 184, 0.78);
  font-family: 'Inter', sans-serif;
  position: relative;
  border: 1px solid transparent;
  transition: background 160ms, border-color 160ms, color 160ms, transform 220ms;
}
.round:hover {
  background: rgba(126, 209, 74, 0.06);
  color: var(--cream);
}
.round.is-active {
  background: rgba(126, 209, 74, 0.12);
  border-color: rgba(126, 209, 74, 0.42);
  color: var(--cream);
  box-shadow:
    inset 0 1px 0 rgba(126, 209, 74, 0.15),
    0 0 24px -8px rgba(126, 209, 74, 0.5);
}
.round.is-active::before {
  content: '';
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--lime);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--lime);
}

.round__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: rgba(126, 209, 74, 0.06);
  border: 1px solid rgba(126, 209, 74, 0.2);
  border-radius: 4px;
  font: 600 12px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  color: var(--lime);
}
.round.is-active .round__num {
  background: rgba(126, 209, 74, 0.18);
  border-color: rgba(126, 209, 74, 0.5);
  color: var(--hot);
}
.round--alt  .round__num { color: #d8b070; border-color: rgba(216, 176, 112, 0.35); background: rgba(216, 176, 112, 0.06); }
.round--tool .round__num { color: #b88de8; border-color: rgba(184, 141, 232, 0.35); background: rgba(184, 141, 232, 0.06); }

.round__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.round__title {
  font: 600 13.5px/1.2 'Fraunces', serif;
  letter-spacing: 0;
  color: var(--cream);
}
.round__title em {
  font-style: italic;
  font-weight: 400;
  color: rgba(126, 209, 74, 0.7);
  padding-left: 4px;
}
.round__variants {
  font: 400 10.5px/1.45 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
  color: rgba(232, 217, 184, 0.5);
  word-break: break-word;
}
.round.is-active .round__variants { color: rgba(232, 217, 184, 0.78); }

.round__date {
  font: 500 9.5px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
  color: rgba(212, 196, 138, 0.32);
  align-self: start;
  padding-top: 4px;
}

/* =====================================================
   FOOTER HINT
   ===================================================== */
.sidebar__foot {
  border-top: 1px solid var(--rule);
  padding: 14px 18px 18px;
}
.hint {
  font: 500 10px/1.6 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  color: rgba(212, 196, 138, 0.45);
  margin: 0;
}
.hint kbd {
  display: inline-block;
  padding: 1px 5px;
  background: rgba(126, 209, 74, 0.08);
  border: 1px solid rgba(126, 209, 74, 0.25);
  border-radius: 3px;
  font: inherit;
  color: rgba(212, 255, 184, 0.85);
  margin: 0 2px;
}

/* =====================================================
   STAGE
   ===================================================== */
.stage {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--paper);
  position: relative;
  overflow: hidden;
}
.stage__bar {
  flex: 0 0 auto;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(28, 36, 16, 0.92);
  color: rgba(232, 217, 184, 0.85);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(6px);
  z-index: 5;
}
.stage__crumb {
  font: 600 11px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage__crumb em { color: rgba(126, 209, 74, 0.6); font-style: normal; }
.stage__crumb [data-active-num] { color: var(--lime); }
.stage__meta { display: flex; align-items: center; gap: 8px; }
.stage__link {
  font: 500 10.5px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
  color: rgba(212, 196, 138, 0.6);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 3px;
}
.stage__link:hover { color: var(--cream); background: rgba(126, 209, 74, 0.08); }
.stage__btn {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px;
  color: rgba(212, 196, 138, 0.6);
  font-size: 14px;
}
.stage__btn:hover { color: var(--cream); background: rgba(126, 209, 74, 0.08); }

.stage__frame {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#stage-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--paper);
}

.stage__loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 24, 8, 0.92);
  color: var(--lime);
  font: 500 12px/1 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  z-index: 4;
}
.stage__loading[hidden] { display: none; }

/* =====================================================
   FULLSCREEN MODE
   ===================================================== */
body[data-fullscreen="on"] .stage__bar { display: none; }
body[data-fullscreen="on"] {
  grid-template-columns: 0 1fr;
}
body[data-fullscreen="on"] .sidebar { transform: translateX(-100%); }

/* =====================================================
   MOBILE — stack with sidebar collapsed by default
   ===================================================== */
@media (max-width: 720px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100dvh; overflow: hidden; }
  .sidebar {
    height: auto; max-height: 50dvh;
    border-right: 0; border-bottom: 1px solid var(--rule);
    transform: none !important;
  }
  body[data-sidebar="hidden"] .sidebar { display: none; }
  body[data-sidebar="hidden"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .sidebar__head { padding: 14px 16px; }
  .sidebar__title { font-size: 26px; margin: 6px 0 8px; }
  .rounds { padding: 8px; }
  .round { padding: 8px 10px; }
  .round__num { width: 32px; height: 32px; }
  .stage__bar { padding: 0 10px; }
}
