/* The editor of texts on the real pages (views/admin-texts-live.js: the editor's page; text-live.js: the page in its
   frame). Two parts: .tx-* is the editor's page, .tl-* and html.texts-edit are the page shown in the frame. */

/* ---- the editor's page ---- */
.tx-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}
.tx-side { position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow-y: auto; padding-right: 4px; }
.tx-group { margin: 14px 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.tx-group:first-child { margin-top: 0; }
.tx-screen {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.tx-screen:hover { background: var(--hover); }
.tx-screen[aria-current="page"] { background: var(--yellow); color: var(--on-yellow, #3a2f00); font-weight: 700; }
.tx-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.tx-modes { display: flex; gap: 6px; }
.tx-mode[aria-pressed="true"] { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow, #3a2f00); font-weight: 700; }
.tx-modehint { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.tx-stage.trying { border-color: var(--yellow); }
.tx-device[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.tx-stage {
  height: calc(100vh - 230px);
  min-height: 480px;
  overflow: hidden;
  border: var(--sticker-w, 2px) solid var(--sticker-line, var(--separator));
  border-radius: var(--radius-card);
  background: var(--bg);
}
.tx-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); }
.tx-stage.phone .tx-frame { width: 390px; max-width: 100%; margin: 0 auto; border-inline: 1px solid var(--separator); }
.tx-box {
  position: sticky;
  top: 12px;
  padding: 16px;
  border: var(--sticker-w, 2px) solid var(--sticker-line, var(--separator));
  border-radius: var(--radius-card);
  background: var(--card-glass, var(--surface));
}
.tx-box-title { margin: 0 0 10px; font-size: 15px; }
.tx-label { margin: 12px 0 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tx-default { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--fill); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tx-input { width: 100%; min-height: 96px; resize: vertical; font-size: 14px; line-height: 1.5; }
.tx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.tx-chips .tx-label { margin: 0 4px 0 0; }
.tx-problem { margin: 8px 0 0; color: var(--warn, #b7791f); font-size: 13px; }
.tx-problem:empty { display: none; }
.tx-note, .tx-hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tx-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
@media (max-width: 1180px) {
  .tx-layout { grid-template-columns: 170px minmax(0, 1fr); }
  .tx-box { grid-column: 1 / -1; position: static; }
}
@media (max-width: 760px) {
  .tx-layout { grid-template-columns: 1fr; }
  .tx-side { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 4px; }
  .tx-group { width: 100%; }
  .tx-screen { width: auto; }
  .tx-stage { height: 70vh; }
}

/* ---- the page in the frame (text-live.js) ---- */
.tl-box {
  position: fixed;
  left: var(--x, 0);
  top: var(--y, 0);
  width: var(--w, 0);
  height: var(--h, 0);
  box-sizing: border-box;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2147483000;
}
.tl-hover { border: 2px solid var(--accent); background: var(--accent-soft); }
.tl-picked { border: 2px solid var(--yellow); background: var(--yellow-soft); box-shadow: 0 0 0 2px var(--accent); }
html.texts-edit, html.texts-edit * { cursor: pointer !important; -webkit-user-select: none; user-select: none; }
html.texts-edit .tl-box[hidden] { display: none; }
