/* Developer portal (creator-only). Tokens come from game.css's :root; the
   sheet reuses .leaderboard-overlay/.leaderboard-sheet from game.css and only
   adds what a canvas stage and a side panel need on top of that shell. */

/* Entry button: sits at the far right of the account bar after the gear.
   Same footprint as .account-settings so the bar does not grow a pixel for
   everyone else — it is [hidden] unless js/dev-portal.js says otherwise. */
.dev-portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(240, 122, 46, 0.55);
  background: rgba(211, 86, 15, 0.16);
  color: var(--blaze-bright);
  cursor: pointer;
}
.dev-portal-btn .ui-icon { width: 16px; height: 16px; }
.dev-portal-btn:hover { background: rgba(211, 86, 15, 0.32); }
.dev-portal-btn:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }
.dev-portal-btn[hidden] { display: none; }

/* The sheet: wider than any other overlay because a graph needs room. */
.dev-portal-sheet {
  max-width: 1180px;
  width: calc(100vw - 32px);
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 16px;
}
.dev-portal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.dev-portal-search {
  flex: 1 1 200px;
  min-width: 0;
  font-family: var(--font-stamp);
  font-size: 12px;
  color: var(--parchment);
  background: rgba(10, 6, 3, 0.4);
  border: 1px solid var(--drawer-edge);
  border-radius: 8px;
  padding: 8px 10px;
}
.dev-portal-search:focus-visible { outline: 2px solid var(--parchment); outline-offset: 1px; }
.dev-portal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dev-portal-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-stamp);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--parchment);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--drawer-edge);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.dev-portal-legend-chip:hover { background: rgba(255, 255, 255, 0.16); }
.dev-portal-legend-chip:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }
.dev-portal-legend-chip.is-off { color: var(--parchment-dim); opacity: 0.55; text-decoration: line-through; }
.dev-portal-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dev-portal-recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-stamp);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--parchment);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--drawer-edge);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.dev-portal-recent-chip:hover:not([disabled]) { background: rgba(255, 255, 255, 0.16); }
.dev-portal-recent-chip:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }
.dev-portal-recent-chip[disabled] { color: var(--parchment-dim); opacity: 0.55; cursor: default; }
.dev-portal-recent-chip.is-on { color: var(--parchment); background: rgba(211, 86, 15, 0.28); border-color: var(--blaze); }
.dev-portal-dot-ember { background: var(--blaze-bright); box-shadow: 0 0 6px rgba(240, 122, 46, 0.8); }
.dev-portal-recent-window {
  font-family: var(--font-stamp);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--parchment);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--drawer-edge);
  border-radius: 999px;
  padding: 5px 8px;
  cursor: pointer;
}
.dev-portal-recent-window:disabled { color: var(--parchment-dim); opacity: 0.55; cursor: default; }
.dev-portal-recent-window:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }
.dev-portal-hubs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-stamp);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--parchment);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--drawer-edge);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.dev-portal-hubs-chip:hover { background: rgba(255, 255, 255, 0.16); }
.dev-portal-hubs-chip:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }
.dev-portal-hubs-chip.is-on { color: var(--parchment); background: rgba(124, 58, 237, 0.28); border-color: #a78bfa; }
.dev-portal-dot-hub { background: #a78bfa; box-shadow: 0 0 6px rgba(167, 139, 250, 0.8); }
.dev-portal-relax {
  font-family: var(--font-stamp);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  background: transparent;
  border: 1.5px solid var(--drawer-edge);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
}
.dev-portal-relax:hover { color: var(--parchment); }
.dev-portal-relax:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }

/* Stage + panel. Side by side when there is room, stacked on a phone. */
.dev-portal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
}
.dev-portal-stage {
  position: relative;
  min-height: 320px;
  min-width: 0;
  border: 1px solid var(--drawer-edge);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.05), transparent 60%),
    var(--cabinet);
  overflow: hidden;
}
.dev-portal-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.dev-portal-panel {
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--drawer-edge);
  border-radius: 12px;
  padding: 14px 14px 16px;
  background: rgba(10, 6, 3, 0.28);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--parchment-dim);
}
.dev-portal-panel-head { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.dev-portal-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.dev-portal-panel-title {
  margin: 0;
  font-family: var(--font-stamp);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--parchment);
}
.dev-portal-copy-btn {
  flex-shrink: 0;
  font-family: var(--font-stamp);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--parchment-dim);
  background: transparent;
  border: 1px solid var(--drawer-edge);
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
}
.dev-portal-copy-btn:hover:not(:disabled) { color: var(--parchment); border-color: var(--parchment-dim); }
.dev-portal-copy-btn:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; }
.dev-portal-copy-btn:disabled { cursor: default; }
.dev-portal-hub-note {
  margin: 8px 0 0;
  font-family: var(--font-stamp);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: #c4b5fd;
}
.dev-portal-panel-sub {
  margin: 14px 0 6px;
  font-family: var(--font-stamp);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parchment-dim);
}
.dev-portal-layer-chip {
  font-family: var(--font-stamp);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 999px;
  padding: 2px 8px;
}
.dev-portal-file {
  display: block;
  margin: 8px 0 0;
  font-family: var(--font-stamp);
  font-size: 11px;
  color: var(--brass-bright);
  word-break: break-all;
}
.dev-portal-exposes {
  margin: 6px 0 0;
  font-family: var(--font-stamp);
  font-size: 11px;
  color: var(--blaze-bright);
}
.dev-portal-size {
  margin: 6px 0 0;
  font-family: var(--font-stamp);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--parchment-dim);
}
.dev-portal-summary { margin: 8px 0 0; color: var(--parchment); }
.dev-portal-quiet { margin: 12px 0 0; font-size: 11px; color: var(--parchment-dim); }
.dev-portal-commits { list-style: none; margin: 0; padding: 0; }
.dev-portal-commit {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  row-gap: 1px;
  margin: 0 0 8px;
  font-size: 11.5px;
  line-height: 1.4;
}
.dev-portal-commit-sha {
  font-family: var(--font-stamp);
  font-size: 10.5px;
  color: var(--blaze-bright);
  padding-top: 1px;
}
.dev-portal-commit-subject { color: var(--parchment); overflow-wrap: anywhere; }
.dev-portal-commit-when {
  grid-column: 2;
  font-family: var(--font-stamp);
  font-size: 9.5px;
  letter-spacing: 0.05em;
  color: var(--parchment-dim);
}
.dev-portal-tips { margin: 8px 0 0; padding-left: 18px; }
.dev-portal-tips li { margin: 0 0 6px; }
.dev-portal-counts {
  margin: 12px 0 0;
  font-family: var(--font-stamp);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.dev-portal-links { list-style: none; margin: 0; padding: 0; }
.dev-portal-link { margin: 0 0 8px; display: flex; flex-direction: column; gap: 2px; }
.dev-portal-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-family: var(--font-stamp);
  font-size: 11.5px;
  color: var(--parchment);
  background: transparent;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
}
.dev-portal-link-btn:hover .dev-portal-link-name { text-decoration: underline; }
.dev-portal-link-btn:focus-visible { outline: 2px solid var(--parchment); outline-offset: 2px; border-radius: 4px; }
.dev-portal-link-meta { font-size: 11px; color: var(--parchment-dim); padding-left: 16px; }

@media (max-width: 900px) {
  .dev-portal-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 220px; }
}
@media (max-width: 560px) {
  /* Override the bottom-sheet treatment .leaderboard-sheet gets at this
     width: a graph wants the whole screen, not the bottom 88% of it. */
  .leaderboard-overlay .dev-portal-sheet {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .dev-portal-body { grid-template-rows: minmax(0, 1fr) 180px; gap: 8px; }
  .dev-portal-stage { min-height: 240px; }
}
