/* Screens 06 Disk library and 07 Script editor. */

/* The library runs two columns, not three: a disk card is taller than a room
   one — a large drawing, a description, badges — and at a third of the width
   the description tears into fragments. */
.listing__grid--disks {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* The disk in a library card is centred, as in the mockup. */
.tile__art {
  display: flex;
  justify-content: center;
  padding: 6px 0 4px;
}

.tile__desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted-2);
}

/* Descriptions of different length otherwise push the buttons to different
   heights. The whole button block is pinned down, not each button separately:
   `margin-top: auto` on two neighbours splits the remainder between them, and
   the cards' bottoms drift apart again. */
.listing__grid--disks .tile > .tile__actions {
  margin-top: auto;
}

.tile__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* On a wide screen both actions sit on one line: a column of two full-width
   buttons stretches the card downward with no need to, and the disk tile's
   space (minimum 340) is enough for both. On a narrow one the column remains —
   there "Create a room" and "Open" already crowd one line. */
@media (min-width: 761px) {
  .listing__grid--disks .tile__actions {
    flex-direction: row;
  }

  /* Both the real buttons and the ghost bars: equal shares, or a long label
     takes the whole line. */
  .listing__grid--disks .tile__actions > * {
    flex: 1 1 0;
    min-width: 0;
  }
}

.banner--ok {
  color: var(--ok-fg);
  background: var(--ok-bg);
  border-color: transparent;
}

.link--btn {
  font: inherit;
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ── 07 Script editor ────────────────────────────────────────────────────── */

/* The one screen where the card grows to the window's height. Everywhere else
   it ends where the content ends, and that is right: a stretched surface would
   promise content that is not there. Here under it is exactly what people came
   for — room for text, and cutting it off in the middle of the window, leaving
   a strip of background beneath it, means taking lines away from the
   editor.

   `:has()` instead of a class on `.shell`: the card and the header are drawn
   by the app, the screen sits inside it and cannot reach them through
   markup.

   40 is the card's top and bottom padding from `app.css`. Below 900 there is
   no top padding, and the number there is different; change one and you must
   change both. */
.shell:has(.studio) {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 40px);
}

@media (max-width: 900px) {
  .shell:has(.studio) {
    min-height: calc(100dvh - 20px);
  }
}

/* The height travels down the chain to the field itself: break it at any link
   and the card stretches while the text field stays the same. */
.shell:has(.studio) .shell__body,
.shell:has(.studio) .screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.studio {
  display: grid;
  grid-template-columns: 1fr 320px;
  flex: 1;
  min-height: 0;
}

.studio__main {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.studio__code {
  width: 100%;
  /* The field takes all the free height of the column but does not shrink
     below its minimum: when the harness stands up below, the page moves down
     rather than crushing the editor to three lines. */
  flex: 1;
  min-height: 420px;
  resize: vertical;
  background: #191919;
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  color: #c4c4c4;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  padding: 16px 18px;
  tab-size: 2;
}

.studio__code:focus {
  outline: none;
  border-color: #5a5a5a;
}

.studio__side {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
}


/* The frame's actual policy — verbatim. Not a retelling and not a scanner's
   verdict: a retelling here would mean exactly the lie we walked away from
   when we removed the STATIC SCAN panel. */
.policy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #191919;
  border: 1px solid var(--border);
  border-radius: var(--r-ui);
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: #b4b4b4;
  max-height: 190px;
  overflow-y: auto;
}

.policy__line {
  word-break: break-word;
}

.policy__note {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted-3);
}

@media (max-width: 760px) {
  /* On a narrow screen the columns stack, and stretching the card to the
     window's bottom no longer means "giving the editor room": the whole side
     panel ends up below the field, and it is that panel that would have to
     stretch. */
  .shell:has(.studio) {
    min-height: 0;
  }

  .studio {
    grid-template-columns: 1fr;
  }

  .studio__main {
    padding: 16px;
  }

  .studio__side {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .studio__code {
    flex: none;
    min-height: 300px;
  }
}

/* The manifest card. There are no input fields here any more: the manifest is
   part of the disk's text, and the panel shows what was read out of it, not
   what a person typed into a form beside it. */
.manifest {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
}

.manifest__row {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.manifest__key {
  width: 62px;
  flex: none;
  color: var(--muted-3);
}

.manifest__value {
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manifest__about {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

/* ── the agent prompt ────────────────────────────────────────────────────── */

/* It opens above the editor rather than in the side column: the column is a
   set of panels watching a running disk, and this is a thing to read once and
   carry away. */
.agent {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
}

.agent__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted-3);
}

.agent__note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-2);
}

/* The prompt keeps its own line breaks — it is copied as a whole, and rewrapping
   it on screen would hide where the blanks are. It scrolls rather than stretches
   the page. */
.agent__text {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--sunken);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  /* Long addresses must not push the panel wider than the screen. */
  overflow-wrap: anywhere;
  user-select: text;
}

.agent__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
