/* Stellar Game Engine — universal app shell.
   Four slots laid out in a CSS grid that every area renders into:
     - activity bar (far left, narrow)
     - topbar (top, full width minus activity)
     - sidebar (left, contextual to area)
     - viewport (center, area content)
     - inspector (right, contextual to area)
   Areas may hide sidebar or inspector by toggling .hidden on those slots. */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  background: #0f0f17;
  color: #ccc;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 60px auto 1fr auto;
  grid-template-rows: 36px 1fr;
  grid-template-areas:
    "activity topbar   topbar    topbar"
    "activity sidebar  viewport  inspector";
  height: 100vh;
  width: 100vw;
}

/* ---- Activity bar (far left, area switcher) ---- */
.activity-bar {
  grid-area: activity;
  background: #0a0a14;
  border-right: 1px solid #1f1f2a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 4px 0;
}
.ab-logo {
  display: block;
  text-align: center;
  padding: 8px 4px 12px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #7fbfdf;
  text-decoration: none;
  border-bottom: 1px solid #1f1f2a;
  margin-bottom: 6px;
}
.ab-logo:hover { color: #a0d0ef; }
.ab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  color: #555;
  text-decoration: none;
  border-left: 2px solid transparent;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: bold;
  cursor: pointer;
}
.ab-btn:hover { color: #aaa; background: #12121e; }
.ab-btn.active {
  color: #7fbfdf;
  background: #12121e;
  border-left-color: #3dd68c;
}
.ab-icon { font-size: 18px; line-height: 1; color: inherit; }
.ab-label { color: inherit; }

/* ---- Topbar (breadcrumb + tools) ---- */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a2a4a;
  border-bottom: 1px solid #2d4a6a;
  padding: 0 16px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: 'Consolas', monospace;
}
.breadcrumb a {
  color: #7fbfdf;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 2px;
}
.breadcrumb a:hover { background: #244058; color: #a0d0ef; }
.breadcrumb a.bc-root {
  color: #d0a0ff;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}
.breadcrumb .bc-current { color: #3dd68c; }
.breadcrumb .bc-sep { color: #3d5a7a; }
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: #888;
}

/* ---- Sidebar (contextual nav) ---- */
.sidebar {
  grid-area: sidebar;
  background: #12121e;
  border-right: 1px solid #1f1f2a;
  overflow-y: auto;
  width: 280px;
  min-width: 280px;
}
.sidebar.hidden { display: none; }
.sidebar-empty {
  padding: 16px;
  font-size: 10px;
  color: #444;
  font-style: italic;
}

/* ---- Viewport (area content) ---- */
.viewport {
  grid-area: viewport;
  background: #0f0f17;
  overflow: auto;
  position: relative;
  min-width: 0;
}

/* ---- Inspector (right panel) ---- */
.inspector {
  grid-area: inspector;
  background: #16162a;
  border-left: 1px solid #1f1f2a;
  overflow-y: auto;
  width: 320px;
  min-width: 320px;
}
.inspector.hidden { display: none; }
.inspector-empty {
  padding: 16px;
  font-size: 10px;
  color: #444;
  font-style: italic;
}

/* ---- Landing area: workflow DAG ---- */
.workflow-map {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
  gap: 20px 56px;
  padding: 40px 48px;
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  height: 100%;
  align-content: center;
}
.workflow-map .wf-edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.workflow-map .wf-edge {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.workflow-map .wf-edge.active   { stroke: #3a5a7a; }
.workflow-map .wf-edge.planned  { stroke: #2d4a6a; }
.workflow-map .wf-edge.dimmed   { stroke: #1f2f3f; stroke-dasharray: 4 4; }
.workflow-map .wf-arrowhead     { fill: #3a5a7a; }
.workflow-map .wf-arrowhead.planned { fill: #2d4a6a; }
.workflow-map .wf-arrowhead.dimmed  { fill: #1f2f3f; }

/* Node cards */
.wf-node {
  position: relative;
  z-index: 1;
  background: #14141e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
  align-self: center;
  text-decoration: none;
  color: inherit;
  cursor: default;
}
a.wf-node { cursor: pointer; }
.wf-node:hover {
  border-color: #3a4a6a;
  box-shadow: 0 0 12px rgba(80, 120, 180, 0.08);
}
.wf-node.wf-dim {
  opacity: 0.5;
  border-color: #1f1f2a;
}
.wf-node.wf-dim:hover { border-color: #2a2a3a; box-shadow: none; }

/* Grid placement */
.wf-ux          { grid-column: 1; grid-row: 1; }
.wf-ip          { grid-column: 1; grid-row: 2; }
.wf-engine      { grid-column: 1; grid-row: 3; }
.wf-environment { grid-column: 1; grid-row: 4; }
.wf-characters  { grid-column: 1; grid-row: 5; }
.wf-flow-ip     { grid-column: 2; grid-row: 1; }
.wf-mech-ip     { grid-column: 2; grid-row: 3; }
.wf-game        { grid-column: 3; grid-row: 2; }

/* Header: status dot + title */
.wf-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: #dde;
  letter-spacing: 0.3px;
}
.wf-status {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wf-status.wf-done         { background: #3dd68c; }
.wf-status.wf-in-progress  { background: #e0a040; }
.wf-status.wf-next         { background: #e0a040; animation: wf-pulse 1.8s ease-in-out infinite; }
.wf-status.wf-planned      { background: #5588cc; }
.wf-status.wf-coming-soon  { background: #444; }

@keyframes wf-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(224, 160, 64, 0.4); }
  50%      { opacity: 0.6; box-shadow: 0 0 0 4px rgba(224, 160, 64, 0); }
}

/* Sub-pipeline (screens → flows) */
.wf-pipeline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}
.wf-step {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}
.wf-step.wf-done    { color: #3dd68c; background: rgba(61, 214, 140, 0.08); }
.wf-step.wf-next    { color: #e0a040; background: rgba(224, 160, 64, 0.08); }
.wf-step.wf-future  { color: #555; background: rgba(80, 80, 80, 0.1); }
.wf-arrow { color: #444; font-size: 10px; }

/* Step counts inside pipeline */
.wf-step span {
  font-variant-numeric: tabular-nums;
}

/* Mini thumbnail links for the playable games inside the wf-game node.
   Sized to roughly match the two-line text height of the surrounding
   wf-pipeline row (~32px) at 9:16 mobile-poster aspect. */
.wf-game-thumbs {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 4px;
}
.wf-game-thumb {
  display: block;
  height: 128px;
  width: 72px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(180, 120, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  flex: 0 0 auto;
}
.wf-game-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.wf-game-thumb:hover {
  transform: scale(1.6);
  transform-origin: center top;
  border-color: rgba(200, 150, 255, 0.85);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.wf-game.wf-dim .wf-game-thumb {
  /* parent has dim opacity; thumbs read full color so the games pop */
  opacity: 1.4;
}

/* ---- Flow edges in sidebar screen list ---- */
.flow-edges { list-style: none; padding-left: 16px; margin: 0; }
.flow-edge { font-size: 10px; padding: 1px 0; }
.flow-edge a {
  color: #5a8a5a;
  text-decoration: none;
  display: inline-block;
  padding: 0 3px;
  border-radius: 2px;
}
.flow-edge a:hover { color: #7fbf7f; background: rgba(90, 138, 90, 0.1); }
.flow-event { color: #555; font-size: 9px; margin-left: 3px; }
.screen-list li .entry-marker { color: #e0a040; margin-right: 3px; font-size: 10px; }

/* ---- Navigation section in part inspector ---- */
.nav-section {
  border-top: 1px solid #2a2a3a;
  padding-top: 8px;
  margin-top: 8px;
}
.nav-section-label {
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.nav-section label {
  display: block;
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}
.nav-section input,
.nav-section select {
  width: 100%;
  margin-top: 2px;
  padding: 3px 5px;
  background: #1a1a2a;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  color: #ccc;
  font-size: 11px;
  font-family: inherit;
}
.nav-section select { cursor: pointer; }
.nav-section input:focus,
.nav-section select:focus {
  outline: none;
  border-color: #4a6a8a;
}

/* ---- Flow editor (SVG flowchart) ---- */
.flow-editor-wrap {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px;
}
.flow-chart {
  flex-shrink: 0;
}
.flow-chart .flow-node-bg {
  fill: #14141e;
  stroke: #2a2a3a;
  stroke-width: 1.5;
  cursor: pointer;
  transition: stroke 0.15s;
}
.flow-chart .flow-node-bg:hover,
.flow-chart .flow-node.selected .flow-node-bg {
  stroke: #5588cc;
}
.flow-chart .flow-node.entry .flow-node-bg {
  stroke: #e0a040;
}
.flow-chart .flow-node.placeholder .flow-node-bg {
  stroke-dasharray: 4 3;
  stroke: #444;
}
.flow-chart .flow-node-title {
  fill: #dde;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Consolas', monospace;
}
.flow-chart .flow-node-entry {
  fill: #e0a040;
  font-size: 10px;
}
.flow-chart .flow-node-part {
  fill: #777;
  font-size: 9px;
  font-family: 'Consolas', monospace;
}
.flow-chart .flow-node-part-target {
  fill: #5a8a5a;
}
.flow-chart .flow-edge-line {
  fill: none;
  stroke: #3a5a7a;
  stroke-width: 1.5;
  cursor: pointer;
  transition: stroke 0.15s;
}
.flow-chart .flow-edge-line:hover,
.flow-chart .flow-edge.selected .flow-edge-line {
  stroke: #7fbfdf;
  stroke-width: 2;
}
.flow-chart .flow-edge-label {
  fill: #666;
  font-size: 8px;
  font-family: 'Consolas', monospace;
}
.flow-chart .flow-edge.selected .flow-edge-label { fill: #aaa; }
.flow-chart .flow-edge-back .flow-edge-line {
  stroke-dasharray: 4 3;
  stroke: #5a4a3a;
}

/* Flow inspector sections */
.flow-inspector { padding: 12px; }
.flow-inspector h3 { font-size: 12px; color: #dde; margin-bottom: 8px; }
.flow-inspector .fi-field {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 10px;
  color: #888;
}
.flow-inspector .fi-field label { min-width: 60px; color: #666; }
.flow-inspector .fi-field select,
.flow-inspector .fi-field input {
  flex: 1;
  background: #1a1a2a;
  border: 1px solid #2a2a3a;
  border-radius: 3px;
  color: #ccc;
  font-size: 10px;
  font-family: inherit;
  padding: 2px 4px;
}
.flow-inspector .fi-link {
  color: #7fbfdf;
  text-decoration: none;
  font-size: 10px;
}
.flow-inspector .fi-link:hover { color: #a0d0ef; }
.flow-inspector .fi-parts { margin-top: 8px; }
.flow-inspector .fi-part {
  font-size: 9px;
  color: #777;
  padding: 2px 0;
}
.flow-inspector .fi-part-target { color: #5a8a5a; }
.flow-inspector .fi-actions { margin-top: 12px; border-top: 1px solid #2a2a3a; padding-top: 8px; }
.flow-inspector .fi-btn {
  background: none;
  border: 1px solid #2a2a3a;
  color: #888;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  margin-right: 6px;
}
.flow-inspector .fi-btn:hover { border-color: #4a6a8a; color: #ccc; }
.flow-inspector .fi-btn.danger { border-color: #6a3a3a; color: #c66; }
.flow-inspector .fi-btn.danger:hover { border-color: #8a4a4a; color: #e88; }

/* Flow player */
.flow-player {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0a0a12;
  overflow: hidden;
}
.flow-player-hud {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: #14141e;
  border-bottom: 1px solid #2a2a3a;
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}
.flow-player-hud .fp-screen-name { color: #7fbfdf; font-weight: 600; }
.flow-player-hud .fp-hint { color: #555; font-size: 10px; font-style: italic; flex: 1; }
.flow-player-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.flow-player-canvas-wrap canvas,
.flow-player-canvas-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fp-part-overlay {
  position: absolute;
  border: 2px solid rgba(127, 191, 223, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.fp-part-overlay:hover {
  border-color: rgba(127, 191, 223, 0.7);
  background: rgba(127, 191, 223, 0.08);
}
.fp-part-overlay .fp-part-label {
  position: absolute;
  bottom: -16px;
  left: 0;
  font-size: 8px;
  color: #666;
  white-space: nowrap;
}

/* Flow toolbar in topbar */
.flow-toolbar { display: flex; gap: 6px; align-items: center; }
.flow-toolbar .fi-btn { font-size: 10px; }

/* Reusable context menu */
.ctx-menu {
  position: fixed;
  z-index: 9999;
  background: #1a1a24;
  border: 1px solid #3a3a4a;
  border-radius: 4px;
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.ctx-menu-item {
  display: block;
  width: 100%;
  padding: 5px 14px;
  font-size: 11px;
  color: #bbb;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.ctx-menu-item:hover { background: #2a3a5a; color: #dde; }
.ctx-menu-item.danger { color: #c66; }
.ctx-menu-item.danger:hover { background: #3a2a2a; color: #e88; }
.ctx-menu-sep { height: 1px; background: #2a2a3a; margin: 3px 0; }

/* Drag-connect line */
.flow-drag-line {
  stroke: #7fbfdf;
  stroke-width: 2;
  stroke-dasharray: 6 3;
  fill: none;
  pointer-events: none;
}

/* Edge hit area (invisible wider path for easier clicking) */
.flow-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  cursor: pointer;
}

/* Responsive: single column, no edges */
@media (max-width: 760px) {
  .workflow-map {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 12px;
    padding: 24px 16px;
    height: auto;
    align-content: start;
  }
  .wf-ux, .wf-ip, .wf-engine, .wf-environment, .wf-characters,
  .wf-flow-ip, .wf-mech-ip, .wf-game {
    grid-column: 1; grid-row: auto;
  }
  .workflow-map .wf-edges { display: none; }
}

/* ---- UX sub-area tabs ---- */
.ux-tabs {
  display: flex;
  border-bottom: 1px solid #1f1f2a;
  background: #0a0a14;
}
.ux-tab {
  flex: 1;
  padding: 7px 0;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #555;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
  border-bottom: 2px solid transparent;
}
.ux-tab:hover { color: #888; }
.ux-tab.active {
  color: #7fbfdf;
  border-bottom-color: #7fbfdf;
}

/* ---- UX area: screen tree in the sidebar ---- */
.sidebar-section { padding: 0; }
.sidebar-section .sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #1f1f2a;
  background: #0f0f17;
  position: sticky;
  top: 0;
  z-index: 1;
}
.sidebar-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7fbfdf;
  font-weight: bold;
}
.sidebar-filter {
  background: #0a0a14;
  color: #7fbfdf;
  border: 1px solid #2d4a6a;
  border-radius: 2px;
  padding: 3px 6px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  outline: none;
}
.sidebar-filter:focus { border-color: #3dd68c; }
.screen-list {
  list-style: none;
  padding: 4px 0;
  margin: 0;
}
.screen-list li {
  font-size: 11px;
  font-family: 'Consolas', monospace;
}
.screen-list li a {
  display: block;
  padding: 5px 12px;
  color: #888;
  text-decoration: none;
  border-left: 2px solid transparent;
}
.screen-list li a:hover { color: #ccc; background: #16162a; }
.screen-list li.active a {
  color: #3dd68c;
  background: #16162a;
  border-left-color: #3dd68c;
}
.sidebar-loading, .sidebar-error {
  padding: 16px;
  font-size: 10px;
  color: #444;
  font-style: italic;
}
.sidebar-error { color: #c88; }

/* ---- Topbar tools (viewer.js appends buttons + shell.js pre-adds zoom-select) ---- */
.topbar-tools .zoom-select,
.topbar-tools .compare-btn,
.topbar-tools select {
  background: #0f1a2a;
  color: #7fbfdf;
  border: 1px solid #2d4a6a;
  border-radius: 3px;
  padding: 3px 8px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  cursor: pointer;
}
.topbar-tools .compare-btn:hover { background: #244058; color: #a0d0ef; }
.topbar-tools .compare-btn.active {
  background: #1a4030;
  color: #3dd68c;
  border-color: #3dd68c;
}
.topbar-tools .compare-btn.manual-save-btn.dirty {
  background: #401a1a;
  color: #ff9090;
  border-color: #ff9090;
}

/* ---- Viewport canvas wrapper — centers + scrolls the #screen canvas ---- */
.viewport-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  overflow: auto;
}

/* ---- #annotations nested inside the shell's #inspector slot.
       Drop the aside chrome (width/border/background) since the parent
       #inspector already provides it. ---- */
#inspector #annotations {
  width: 100%;
  border: none;
  background: transparent;
}

/* ---- IP area (Phase 4) ---- */

/* Sidebar "+ New IP" button */
.sidebar-actions {
  display: flex;
  gap: 6px;
}
.sidebar-new-btn {
  flex: 1;
  background: #2d6a4a;
  color: #d0ffd0;
  border: 1px solid #4af0a0;
  border-radius: 3px;
  padding: 4px 8px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sidebar-new-btn:hover { background: #3d8a5a; color: #fff; }

/* IP preview in the viewport */
.ip-preview {
  padding: 24px;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}
.ip-preview-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.ip-preview-meta h2 {
  font-size: 18px;
  color: #fff;
  font-weight: 500;
}
.ip-slug-chip {
  font-family: 'Consolas', monospace;
  font-size: 10px;
  color: #3dd68c;
  background: #0e2233;
  padding: 3px 8px;
  border-radius: 3px;
}
.ip-preview-style {
  color: #8a8;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 12px;
  background: #0a0a14;
  border: 1px solid #1f1f2a;
  border-radius: 3px;
}
.ip-preview-img {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #05050a;
  border: 1px solid #1f1f2a;
  border-radius: 3px;
  overflow: auto;
  padding: 8px;
}
.ip-preview-img img {
  max-width: 100%;
  display: block;
  background: #000;
}
.ip-no-ref {
  color: #555;
  font-style: italic;
  padding: 40px;
  text-align: center;
  font-size: 11px;
}
.ip-empty {
  padding: 40px 24px;
  color: #555;
  font-style: italic;
  font-size: 12px;
  text-align: center;
}

/* Area-root empty state ("/ux/", "/games/" with no item selected) */
.area-root-empty {
  padding: 60px 40px;
  color: #888;
  max-width: 600px;
}
.area-root-empty h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #d0a0ff;
  margin-bottom: 10px;
}
.area-root-empty p { color: #666; font-size: 11px; }
.area-root-empty a { color: #7fbfdf; text-decoration: none; }
.area-root-empty a:hover { color: #a0d0ef; text-decoration: underline; }

/* Area-root sidebar item list — UX/Games show {label, meta} pairs. */
.area-root-list li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.area-root-label {
  color: inherit;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.area-root-meta {
  color: #555;
  font-size: 9px;
  flex-shrink: 0;
}
.play-link {
  color: #4a9; font-size: 11px; text-decoration: none;
  opacity: 0.6; transition: opacity 0.15s; flex-shrink: 0;
  margin-left: 4px;
}
.play-link:hover { opacity: 1; color: #5fc; background: none; }
.play-link-pulse { animation: play-pulse 2s ease-in-out infinite; }
.play-link-pulse:hover { animation: none; }
@keyframes play-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Pending IP entries (optimistic insert while subprocess is running) */
.screen-list li.pending a {
  color: #888;
  font-style: italic;
}
.screen-list li.pending .ip-slug-cell {
  display: inline-block;
}
.pending-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  background: #2a2a6a;
  color: #bce0ff;
  border-radius: 2px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: bold;
  font-style: normal;
  animation: pending-pulse 1.4s ease-in-out infinite;
}
@keyframes pending-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* IP preview "generating" placeholder (viewport when _pending) */
.ip-preview.pending .ip-preview-style { opacity: 0.6; }
.ip-generating {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  background: #05050a;
  border: 1px solid #1f1f2a;
  border-radius: 3px;
  text-align: center;
}
.ip-generating-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #1f1f2a;
  border-top-color: #3dd68c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.ip-generating-text {
  color: #3dd68c;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.ip-generating-sub {
  color: #666;
  font-size: 10px;
  max-width: 360px;
  line-height: 1.5;
}

/* Loading state for suggest buttons (🎲, ✨) — disabled + pulsing */
.field-suggest-btn.loading {
  opacity: 0.5;
  cursor: wait;
  animation: pending-pulse 1s ease-in-out infinite;
}

/* ---- Create-screen wizard modal (Phase 3) ---- */

.wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.wizard-modal {
  background: #12121e;
  border: 1px solid #2d4a6a;
  border-radius: 6px;
  min-width: 560px;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #1a2a4a;
  border-bottom: 1px solid #2d4a6a;
  flex-shrink: 0;
}
.wizard-header h2 {
  font-size: 12px;
  color: #d0a0ff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: bold;
  margin: 0;
}
.wizard-crumb {
  color: #7fbfdf;
  font-size: 11px;
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: normal;
}
.wizard-close {
  background: transparent;
  color: #888;
  border: 0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}
.wizard-close:hover { color: #fff; }
.wizard-steps {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
  background: #0f0f17;
  border-bottom: 1px solid #1f1f2a;
  flex-shrink: 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 3px;
  background: #16162a;
  color: #555;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: bold;
}
.wizard-step.done {
  background: #1a4030;
  color: #3dd68c;
}
.wizard-step.active {
  background: #1e3550;
  color: #d0a0ff;
  box-shadow: 0 0 0 1px #d0a0ff inset;
}
.wizard-step-n {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2a2a3a;
  text-align: center;
  line-height: 16px;
  font-size: 9px;
}
.wizard-step.done .wizard-step-n { background: #3dd68c; color: #0a2a1a; }
.wizard-step.active .wizard-step-n { background: #d0a0ff; color: #2a0a3a; }
.wizard-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
}
.wizard-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  background: #0f0f17;
  border-top: 1px solid #1f1f2a;
  flex-shrink: 0;
}
.wizard-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wizard-dim-row {
  display: flex;
  gap: 14px;
}
.wizard-dim-row .inspector-field { flex: 1; }
.wizard-hint {
  font-size: 10px;
  color: #666;
  line-height: 1.6;
  padding: 8px 10px;
  background: #0a0a14;
  border-left: 2px solid #2d4a6a;
  border-radius: 0 2px 2px 0;
}
.wizard-drop {
  display: block;
  border: 2px dashed #2d4a6a;
  border-radius: 4px;
  background: #05050a;
  padding: 16px;
  min-height: 220px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.wizard-drop:hover, .wizard-drop.drag-over {
  border-color: #3dd68c;
  background: #0a1a10;
}
.wizard-drop-hint {
  text-align: center;
  color: #666;
  font-size: 11px;
}
.wizard-drop-icon {
  font-size: 32px;
  color: #3d5a7a;
  margin-bottom: 8px;
}
.wizard-preview {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: block;
}
.wizard-file-meta {
  font-size: 10px;
  color: #888;
  font-family: 'Consolas', monospace;
}

/* Step 3 progress rows */
.wizard-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: #0a0a14;
  border: 1px solid #1f1f2a;
  border-radius: 3px;
}
.wizard-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #666;
  padding: 4px 0;
}
.wizard-progress-row.running { color: #bce0ff; }
.wizard-progress-row.done    { color: #3dd68c; }
.wizard-progress-row.failed  { color: #ff9090; }
.wizard-progress-row.skipped { color: #555; font-style: italic; }
.wizard-progress-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-weight: bold;
  font-size: 12px;
  flex-shrink: 0;
}
.wizard-progress-row.done .wizard-progress-icon    { color: #3dd68c; }
.wizard-progress-row.failed .wizard-progress-icon  { color: #ff9090; }
.wizard-progress-label { flex: 1; }
.wizard-progress-sub   { color: #555; font-size: 9px; }

.wizard-spinner-sm {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #1f1f2a;
  border-top-color: #3dd68c;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* Inspector sections (reusable shell chrome for edit/create forms) */
.inspector-section {
  padding: 14px 16px;
}
.inspector-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #d0a0ff;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #2d4a6a;
}
.inspector-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.inspector-field .field-label {
  font-size: 9px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}
.inspector-field .field-input,
.inspector-field .field-textarea {
  background: #0a0a14;
  color: #7fbfdf;
  border: 1px solid #2d4a6a;
  border-radius: 3px;
  padding: 5px 8px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}
.inspector-field .field-input:focus,
.inspector-field .field-textarea:focus { border-color: #3dd68c; }
.inspector-field .field-input[readonly] { color: #666; cursor: default; }
.inspector-field .field-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.4;
}
.inspector-field .field-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.inspector-field .field-row .field-input { flex: 1; }
.field-suggest-btn {
  background: #1a3550;
  color: #d0a0ff;
  border: 1px solid #2a5170;
  border-radius: 3px;
  padding: 4px 10px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  cursor: pointer;
}
.field-suggest-btn:hover { background: #244058; color: #fff; }
.inspector-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.inspector-btn {
  background: #1a3550;
  color: #7fbfdf;
  border: 1px solid #2a5170;
  border-radius: 3px;
  padding: 6px 12px;
  font-family: 'Consolas', monospace;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.inspector-btn:hover:not(:disabled) { background: #244058; color: #fff; border-color: #3dd68c; }
.inspector-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.inspector-btn.running { background: #3d5a8a; color: #bce0ff; border-color: #5a8ac8; cursor: wait; }
.inspector-btn-primary {
  background: #2d6a4a;
  color: #d0ffd0;
  border-color: #4af0a0;
}
.inspector-btn-primary:hover:not(:disabled) { background: #3d8a5a; color: #fff; }
.inspector-btn-danger {
  background: #401a1a;
  color: #ff9090;
  border-color: #8a3030;
}
.inspector-btn-danger:hover:not(:disabled) { background: #5a2525; color: #fff; border-color: #ff9090; }
.inspector-danger {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #2a1a1a;
}
.inspector-empty {
  padding: 16px;
  font-size: 10px;
  color: #444;
  font-style: italic;
}

.ip-log-panel {
  display: none;
  max-height: 180px;
  overflow-y: auto;
  background: #05050a;
  border: 1px solid #1f1f2a;
  border-radius: 3px;
  padding: 6px 8px;
  font-family: 'Consolas', monospace;
  font-size: 9px;
  color: #8aa;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 12px;
}
.ip-log-panel.visible { display: block; }

/* Shell toast (used by IP area; Phase 5 Games area will reuse) */
.shell-toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #1a4030;
  color: #3dd68c;
  border: 1px solid #3dd68c;
  padding: 8px 16px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.shell-toast.show { opacity: 1; }
.shell-toast.error {
  color: #ff9090;
  border-color: #ff9090;
  background: #401a1a;
}
