/* Shared panel chrome — the SPA-style hash-routed panel system.
 * Each panel is a `<section class="panel" data-panel="…">` and the JS
 * router toggles `.active` on exactly one at a time. Keeping all
 * panels mounted (just hidden) is what lets the ttyd iframe survive a
 * tab swap with its WebSocket and scrollback intact.
 */

.panel { display: none; }
.panel.active { display: block; }

/* The play panel hosts a fullscreen iframe under a thin always-on
   "your sandbox" bar. The bar reserves real estate (iframe is offset
   by --play-info-bar-h); when the bar is expanded, the extra body
   floats over the iframe rather than reflowing it (ttyd does not
   respond gracefully to mid-session resize). */
#panel-play.active {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  display: block;
  --play-info-bar-h: 38px;
}
#panel-play .panel-frame {
  position: absolute;
  top: var(--play-info-bar-h);
  left: 0;
  right: 0;
  bottom: 0;
  border: 0;
  display: block;
}

/* Always-on header. The closed-state bar is the only persistent
   footprint; when expanded, .play-info-body absolute-positions itself
   below the bar and overlays the iframe. */
.play-info {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
}
.play-info-bar {
  height: var(--play-info-bar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
  /* Override the inherited summary defaults — keep alignment and
     padding consistent across browsers. */
  padding: 0 16px;
}
/* Expanded body lifts off — does NOT push the bar down or shrink the
   iframe. Translucent so the eye sees "this is an overlay over your
   terminal, not chrome." */
.play-info[open] .play-info-body {
  position: absolute;
  top: var(--play-info-bar-h);
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}
.play-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
/* Hide the default disclosure triangle. */
.play-info-bar::-webkit-details-marker { display: none; }
.play-info-bar::marker { content: ""; }
.play-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px 1px 7px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-weight: 500;
  letter-spacing: 0.01em;
  font-size: 11px;
}
.play-info-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgb(var(--accent-rgb, 80 200 120));
  /* No glow — the bar should sit quietly. */
}
.play-info-summary { color: var(--text-soft); }
.play-info-summary code {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  background: transparent;
}
.play-info-reset {
  margin-left: auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  vertical-align: middle;
  box-sizing: border-box;
  height: 18px;
  margin-top: 0;
  margin-bottom: 0;
  appearance: none;
  background: rgba(220, 70, 70, 0.08);
  border: 1px solid rgba(220, 70, 70, 0.45);
  color: rgb(225, 110, 110);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
  padding: 0 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.play-info-reset-ico {
  font-size: 10px;
  line-height: 1;
  color: rgb(255, 180, 90);
}
.play-info-reset:hover {
  background: rgba(220, 70, 70, 0.12);
  color: rgb(255, 130, 130);
  border-color: rgba(220, 70, 70, 0.7);
}
.play-info-chevron {
  transition: transform 120ms ease;
  color: var(--text-soft);
}
.play-info[open] .play-info-chevron { transform: rotate(180deg); }
.play-info-body {
  padding: 4px 16px 14px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.5;
}
.play-info-blurb { margin: 0 0 10px; max-width: 760px; }
.play-info-blurb strong { color: var(--text); }
.play-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px 24px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
}
.play-info-grid > div { display: flex; gap: 8px; align-items: baseline; }
.play-info-grid dt {
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10.5px;
  min-width: 78px;
}
.play-info-grid dd { margin: 0; color: var(--text); }
.play-info-grid code {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Mobile: drop the pill entirely — too much for a small bar. Keep
   just the green dot + summary + chevron. The dot is the whole
   security signal needed at a glance; the expanded body has the
   "your own crate · sticky · nobody else inside" copy when the user
   wants the detail. */
@media (max-width: 700px) {
  #panel-play.active { --play-info-bar-h: 36px; }
  .play-info-bar { padding: 0 12px; gap: 10px; font-size: 12px; }
  .play-info-pill {
    /* Strip the pill chrome; just keep the dot. */
    border: 0;
    padding: 0;
    gap: 0;
    font-size: 0;
  }
  .play-info-pill-text { display: none; }
  .play-info-summary {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
  }
  .play-info-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .play-info-grid dt { min-width: 70px; }
  .play-info-blurb { font-size: 12.5px; }
}

/* Generic panel-frame fallback for any future iframe-hosting panel. */
.panel-frame {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  border: 0;
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  background: #000;
  z-index: 1;
}
/* Play panel overrides the generic frame — must come after to win. */
#panel-play .panel-frame {
  position: absolute;
  top: var(--play-info-bar-h);
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(100% - var(--play-info-bar-h));
}

/* Page wrapper used inside non-iframe panels (home, tokens, future
   doghouse/marketplace). 1200px wide for the hero page; .narrow flips
   it to 880px for secondary panels so headings + stat grids don't
   span a 27" monitor. */
.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.page.narrow {
  max-width: 880px;
  padding-top: 5vh;
  padding-bottom: 6vh;
}

/* Panel head shared by tokens (and future): icon tile + title + sub.
   Lives here because every secondary panel will follow this shape. */
.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 0 0 22px;
  margin: 0 0 28px;
  border-bottom: 1px solid var(--line);
}
.panel-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.10);
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  border-radius: 12px;
  text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.5);
}
.panel-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.panel-sub {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}
.panel-attribution {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.panel-attribution strong { font-weight: 600; }
.panel-attribution .dim { color: var(--text-soft); }

/* Compact avatar variant for inline attribution chips. */
.avatar.sm {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

@media (max-width: 700px) {
  .panel-head { gap: 14px; }
  .panel-icon { width: 38px; height: 38px; font-size: 18px; }
  .panel-title { font-size: 19px; }
}
