/* TrueClays Cloud — online Course Designer + StageBuilder.
   Colours follow the in-app USS: dark slate, green accent for TrueClays,
   amber accent for TrueDynamic. */

:root {
  --bg: #101215;
  --card: rgba(20, 23, 27, .96);
  --inset: #0d0f12;
  --line: #333d47;
  --btn: #262c33;
  --btn-line: #404953;
  --btn-hover: #384049;
  --surface2: #20252b;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #16a34a;
  --accent-lt: #4ade80;
  --accent-ink: #06140b;
  --accent-wash: #12291b;
  --red: #dc2626;
  --red-lt: #f87171;
  --amber: #f59e0b;
  --yellow: #facc15;
}

body.dz-stage {
  --bg: #0c1118;
  --inset: #0a0e14;
  --line: #1d2c3e;
  --accent: #f59e0b;
  --accent-lt: #fbbf24;
  --accent-ink: #1a1203;
  --accent-wash: #2a1f0a;
  --muted: #8ba3c0;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.dz-body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
}
a { color: var(--accent-lt); }
code { font-family: ui-monospace, Consolas, monospace; background: var(--surface2); padding: 1px 5px; border-radius: 4px; }

/* ---------- top bar ---------- */
.dz-top { display: flex; align-items: center; gap: 20px; padding: 0 16px; height: 46px; background: #0b0d10; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.dz-brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 12px; letter-spacing: 2px; white-space: nowrap; }
.dz-brand span { color: var(--accent-lt); }
.dz-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.dz-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.dz-nav a:hover { color: var(--text); background: var(--surface2); }
.dz-nav a.on { color: var(--text); background: var(--surface2); }
.dz-user { color: var(--muted); font-size: 12px; white-space: nowrap; }

.dz-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------- common bits ---------- */
.dz-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.dz-hint { font-size: 11.5px; color: var(--muted); }
.dz-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 13px inherit; color: var(--text); text-decoration: none;
  background: var(--btn); border: 1px solid var(--btn-line); border-radius: 7px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.dz-btn:hover:not(:disabled) { background: var(--btn-hover); }
.dz-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body.dz-stage .dz-btn--primary { color: var(--accent-ink); }
.dz-btn--primary:hover:not(:disabled) { filter: brightness(1.1); background: var(--accent); }
.dz-btn--ghost { background: transparent; }
.dz-btn--danger { color: var(--red-lt); border-color: #7f1d1d; background: transparent; }
.dz-btn--danger:hover:not(:disabled) { background: rgba(153, 27, 27, .25); }
.dz-btn:disabled { opacity: .45; cursor: not-allowed; }
.dz-btn--full { width: 100%; }

/* Buttons that only work on the range PC, because they drive the Unity scene. */
.dz-unity { position: relative; opacity: .5; cursor: not-allowed !important; border-style: dashed; }
.dz-unity::after {
  content: "Simulator"; font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--btn-line); border-radius: 4px; padding: 0 4px; margin-left: 6px;
}

input[type=text], input[type=number], input[type=email], textarea, select {
  font: inherit; color: var(--text); background: var(--inset);
  border: 1px solid var(--btn-line); border-radius: 6px; padding: 5px 8px; min-width: 0;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 54px; }
input[type=range] { accent-color: var(--accent); width: 100%; }
input[type=checkbox] { accent-color: var(--accent); }

.dz-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.dz-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dz-card h2 { margin: 2px 0 0; font-size: 18px; }

/* ---------- landing ---------- */
.dz-landing { max-width: 1100px; width: 100%; margin: 0 auto; padding: 28px 16px 60px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.dz-intro h1 { font-size: 28px; line-height: 1.2; margin: 6px 0 8px; }
.dz-intro p { color: var(--muted); max-width: 760px; margin: 0; }
.dz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.dz-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--text); border: 1px solid transparent; }
.dz-row:hover { background: var(--accent-wash); border-color: var(--line); }
.dz-row--static:hover { background: transparent; border-color: transparent; }
.dz-row-name { font-weight: 600; flex: 1 1 200px; }
.dz-row-meta { color: var(--muted); font-size: 12px; }
.dz-empty { color: var(--muted); }
.dz-how ol { margin: 8px 0; padding-left: 20px; }
.dz-how li { margin: 4px 0; }
.dz-how p { color: var(--muted); margin: 6px 0 0; }
.dz-tag { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: middle; }
.dz-flash { background: var(--accent-wash); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 12px; }

/* ---------- modal + toast ---------- */
.dz-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.dz-modal { background: #151a20; border: 1px solid var(--btn-line); border-radius: 12px; padding: 18px 20px; width: 100%; max-width: 480px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); }
.dz-modal h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.dz-modal p { margin: 0 0 8px; }
.dz-modal .dz-sub { color: var(--muted); font-size: 13px; }
.dz-modal .dz-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dz-modal input[type=text], .dz-modal textarea { width: 100%; margin-top: 4px; }
.dz-modal textarea { min-height: 180px; font: 12px ui-monospace, Consolas, monospace; }
.dz-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #151a20; border: 1px solid var(--accent); color: var(--text); padding: 9px 16px; border-radius: 8px; z-index: 1100; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }
.dz-toast--bad { border-color: var(--red); }

/* ---------- editor shell (both editors) ---------- */
.ed { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px; }
.ed-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.ed-head .ed-name { font-size: 20px; font-weight: 700; width: 320px; max-width: 100%; }
.ed-head .ed-author { width: 200px; max-width: 100%; }
.ed-head .ed-sp { flex: 1; }
.ed-stat { display: flex; flex-direction: column; align-items: center; line-height: 1.1; padding: 0 6px; }
.ed-stat b { font-size: 20px; color: var(--accent-lt); }
.ed-stat span { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.ed-online { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent-lt); border: 1px solid var(--accent); border-radius: 4px; padding: 1px 6px; }
.ed-dirty { font-size: 12px; color: var(--muted); }
.ed-dirty.on { color: var(--amber); }
.ed-problems { display: none; background: rgba(153, 27, 27, .22); border: 1px solid #7f1d1d; color: var(--red-lt); border-radius: 8px; padding: 6px 12px; font-size: 13px; }
.ed-problems.on { display: block; }
.ed-problems.good { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-lt); }

/* library drawer (compak) / list panel (stage) */
.ed-drawer { position: fixed; top: 46px; right: 0; bottom: 0; width: 380px; max-width: 100%; background: #12161b; border-left: 1px solid var(--line); z-index: 500; display: none; flex-direction: column; box-shadow: -10px 0 30px rgba(0, 0, 0, .35); }
.ed-drawer.on { display: flex; }
.ed-drawer > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ed-drawer .ed-lib { flex: 1; overflow-y: auto; padding: 8px; }
.ed-drawer > footer { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.ed-lib-item { padding: 9px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.ed-lib-item:hover { background: var(--surface2); }
.ed-lib-item.on { background: var(--accent-wash); border-color: var(--accent); }
.ed-lib-name { font-weight: 600; }
.ed-lib-meta { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .dz-user { display: none; }
}

/* ---------- share panel ---------- */
.dz-share { max-width: 600px; }
.dz-share-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.dz-share-opts label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.dz-share-opts .dz-btn--primary { margin-left: auto; }
.dz-share-result:not(:empty) { margin-top: 14px; padding: 12px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent-wash); }
.dz-share-code { display: flex; align-items: center; gap: 12px; }
.dz-share-code code { font: 700 24px ui-monospace, Consolas, monospace; letter-spacing: 2px; background: transparent; color: var(--accent-lt); padding: 0; user-select: all; }
.dz-share-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 220px; overflow-y: auto; }
.dz-share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
.dz-share-row.off { opacity: .55; }
.dz-share-row code { font-weight: 700; user-select: all; }
.dz-share-meta { flex: 1; font-size: 12px; color: var(--muted); }
.dz-share-revoke { padding: 3px 9px; font-size: 12px; }

/* ---------- product library pages (/designer/trueclays, /designer/truedynamic) ---------- */
.dz-intro-title { display: flex; align-items: center; gap: 14px; }
.dz-intro-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; flex: 0 0 52px;
  border: 1px solid var(--accent); background: var(--accent-wash); color: var(--accent-lt); border-radius: 10px; }
.dz-cards--one { grid-template-columns: 1fr; }
.dz-more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; text-decoration: none; }
.dz-other { margin: 0; font-size: 13px; }
.dz-other a { text-decoration: none; }
