/* ============================================================
   ANONYMOUS app studio — build, run, try, download
   Matches the console skin (dark / neon / mono accents).
   ============================================================ */
.studio {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 6, 12, 0.84);
  backdrop-filter: blur(10px);
}
.studio[hidden] { display: none; }

.studio-panel {
  width: min(1380px, 100%);
  height: min(900px, 100%);
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(9, 14, 26, 0.97), rgba(5, 9, 18, 0.99));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(41, 224, 255, 0.07);
  overflow: hidden;
}

.studio-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 24, 0.7);
}
.studio-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--cyan);
}
.studio-sub { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.studio-sub.bad { color: var(--red); }

.studio-new { display: flex; gap: 6px; margin-left: auto; }
.studio-new input,
.studio-new select,
.studio-search input {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: rgba(6, 11, 22, 0.9);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  outline: none;
}
.studio-new input { width: 240px; }
.studio-new input:focus,
.studio-new select:focus { border-color: var(--line-hot); box-shadow: 0 0 0 3px rgba(41, 224, 255, 0.1); }
.studio-new select { cursor: pointer; }

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

.studio-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: rgba(5, 9, 18, 0.6);
}
.studio-list:empty::after {
  content: "no apps yet — ask ANONYMOUS to build one";
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 6px 4px;
}

.studio-item {
  display: grid;
  gap: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(10, 16, 30, 0.66);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.studio-item:hover { border-color: var(--line-hot); transform: translateY(-1px); }
.studio-item.active {
  border-color: rgba(41, 224, 255, 0.55);
  background: rgba(16, 34, 56, 0.8);
  box-shadow: 0 0 22px rgba(41, 224, 255, 0.16);
}
.studio-item .name {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #dff3ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-item .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.badge-live,
.badge-idle {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
}
.badge-live { color: var(--lime); border-color: rgba(125, 255, 178, 0.45); background: rgba(125, 255, 178, 0.08); }
.badge-idle { color: var(--text-dim); border-color: var(--line); }

.studio-view { display: grid; grid-template-rows: auto 1fr; min-height: 0; min-width: 0; }

.studio-toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}
.studio-toolbar .btn { padding: 6px 12px; font-size: 10.5px; }
.studio-title {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #e6f6ff;
  letter-spacing: 0.05em;
}
.studio-url {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--cyan-dim);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-spacer { flex: 1; }

.studio-frame-wrap { position: relative; min-height: 0; background: #06090f; }
.studio-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  display: none;
}
.studio-frame-wrap.live iframe { display: block; }
.studio-frame-wrap.live .studio-empty { display: none; }

.studio-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}
.studio-empty .ascii {
  color: var(--cyan);
  font-size: 11px;
  line-height: 1.25;
  opacity: 0.8;
  margin: 0;
}

.studio-logs {
  margin: 0;
  padding: 12px 14px;
  max-height: 34%;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: rgba(4, 7, 14, 0.96);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: #b9d6e8;
  white-space: pre-wrap;
}
.studio-logs[hidden] { display: none; }

@media (max-width: 900px) {
  .studio-body { grid-template-columns: 1fr; }
  .studio-list { max-height: 150px; border-right: 0; border-bottom: 1px solid var(--line); }
  .studio-new input { width: 150px; }
}

/* ---------- FILES: uploads, vision snaps, the editor (uploads.py) ----------
   The operator's own material: files and whole folders, pictures, video, audio
   and code.  A picture or a video frame gets a vision snap, a clip is
   transcribed, code is read as text, and anything here can be edited, handed to
   the app studio as an app, and downloaded. */
.files {
  position: fixed; inset: 0; z-index: 62;
  display: grid; place-items: center;
  background: rgba(2, 4, 9, 0.78);
  backdrop-filter: blur(7px);
  animation: fadeUp 0.18s ease both;
}
.files[hidden] { display: none; }
.files-panel {
  width: min(1180px, 96vw); height: min(88vh, 920px);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line-hot); border-radius: 16px;
  background: rgba(9, 14, 25, 0.98);
  box-shadow: 0 0 60px rgba(41, 224, 255, 0.16), 0 30px 80px rgba(0, 0, 0, 0.7);
}
.files-head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.files-head h2 {
  margin: 0 8px 0 0; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.28em; color: var(--cyan); text-transform: uppercase;
}
.files-sub {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-family: var(--mono); font-size: 11px;
  color: var(--text-dim);
}
.files-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px 1fr; }
.files-list {
  overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 7px;
  border-right: 1px solid var(--line);
}
.files-empty {
  padding: 12px 10px; font-family: var(--mono); font-size: 11.5px;
  line-height: 1.7; color: var(--text-dim);
}
.files-empty b { color: var(--cyan); }
.files-item {
  display: flex; align-items: center; gap: 9px; overflow: hidden;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.7); color: var(--text); cursor: pointer;
  font-family: var(--mono); font-size: 11.5px; text-align: left;
}
.files-item:hover { border-color: var(--line-hot); transform: translateY(-1px); }
.files-item.active { border-color: var(--line-hot); background: rgba(41, 224, 255, 0.1); }
.files-item .icon { flex: none; font-size: 14px; color: var(--cyan); }
.files-item .icon.image { color: var(--lime); }
.files-item .icon.video { color: var(--amber); }
.files-item .icon.audio { color: var(--magenta); }
.files-item .icon.text { color: #9be9ff; }
.files-item .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.files-item .name {
  font-size: 12px; color: #dff6ff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.files-item .sub {
  font-size: 10.5px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.files-item .badge-pending {
  flex: none; padding: 2px 5px; border-radius: 6px; font-size: 9px;
  letter-spacing: 0.1em; color: var(--amber);
  border: 1px solid rgba(255, 204, 102, 0.35);
}
.files-view {
  display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0;
  padding: 12px 14px 14px; overflow: auto;
}
.files-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.files-title {
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--cyan);
}
.files-spacer { flex: 1; }
.files-preview { display: flex; flex-direction: column; gap: 10px; }
.files-preview img,
.files-preview video {
  max-width: 100%; max-height: 300px; border-radius: 10px;
  border: 1px solid var(--line); background: #000;
}
.files-preview audio { width: 100%; }
.files-preview .frames { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.files-preview .frames figure { flex: none; margin: 0; }
.files-preview .frames img { max-height: 108px; }
.files-preview .frames figcaption {
  text-align: center; font-family: var(--mono); font-size: 10px;
  color: var(--text-dim);
}
.files-brief {
  margin: 0; max-height: 240px; overflow: auto; padding: 12px 14px;
  font-family: var(--mono); font-size: 11.8px; line-height: 1.6;
  color: #cfe6ff; white-space: pre-wrap; word-break: break-word;
  border: 1px solid var(--line); border-left: 2px solid var(--cyan-dim);
  border-radius: 11px; background: rgba(6, 10, 18, 0.72);
}
.files-editor {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.files-editor input {
  flex: 1; min-width: 220px; padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(4, 8, 15, 0.9);
  color: var(--text); font-family: var(--mono); font-size: 11.5px;
}
.files-editor input:focus {
  outline: none; border-color: var(--line-hot);
  box-shadow: 0 0 0 3px rgba(41, 224, 255, 0.1);
}
.files-editor textarea {
  width: 100%; min-height: 150px; max-height: 320px; resize: vertical;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #02060d; color: #d7ecff; font-family: var(--mono);
  font-size: 12px; line-height: 1.55;
}
.files-editor textarea:focus { outline: none; border-color: var(--line-hot); }
@media (max-width: 900px) {
  .files-body { grid-template-columns: 1fr; }
  .files-list { max-height: 150px; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* the composer's attachment strip: what rides with the next turn */
.attachments { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 14px 0; }
.attachments[hidden] { display: none; }
.attach {
  display: inline-flex; align-items: center; gap: 7px; max-width: 320px;
  padding: 4px 8px; border-radius: 9px;
  border: 1px solid rgba(41, 224, 255, 0.3); background: rgba(41, 224, 255, 0.08);
  font-family: var(--mono); font-size: 11px; color: #cdefff;
}
.attach b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach span { font-size: 10px; color: var(--text-dim); }
.attach.image { border-color: rgba(125, 255, 178, 0.35); background: rgba(125, 255, 178, 0.07); }
.attach.video { border-color: rgba(255, 204, 102, 0.35); background: rgba(255, 204, 102, 0.07); }
.attach.audio { border-color: rgba(255, 107, 213, 0.35); background: rgba(255, 107, 213, 0.07); }
.attach button {
  border: 0; padding: 0; background: transparent; cursor: pointer;
  color: var(--red); font-size: 13px; line-height: 1;
}
.attach button:hover { color: #fff; }
.btn.up { border-color: rgba(125, 255, 178, 0.3); color: var(--lime); }
.btn.up:hover { background: rgba(125, 255, 178, 0.12); box-shadow: 0 0 20px rgba(125, 255, 178, 0.25); }
body.dropping::after {
  content: "DROP THE FILES — pictures, video, audio, code: the crew reads them here";
  position: fixed; inset: 12px; z-index: 95; display: grid; place-items: center;
  border: 2px dashed var(--line-hot); border-radius: 18px;
  background: rgba(2, 6, 13, 0.82); color: var(--cyan);
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.16em;
  text-transform: uppercase; pointer-events: none;
}
