/* FluxCore dashboard — layout + components (see tokens.css). */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: var(--w-regular) var(--text-15)/1.45 var(--font);
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.error { color: var(--red); }
.nowrap { white-space: nowrap; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6); }
.auth .card { width: min(380px, 100%); padding: var(--s-8); }
.auth h1 { font-size: var(--text-28); font-weight: var(--w-semibold); margin: 0 0 var(--s-2); }
.auth .sub { color: var(--text-2); margin: 0 0 var(--s-6); }
.auth input { width: 100%; margin-bottom: var(--s-3); }
.auth button { width: 100%; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--separator);
  padding: var(--s-4) var(--s-3); gap: var(--s-2); overflow-y: auto;
}
.brand { font-size: var(--text-17); font-weight: var(--w-semibold); padding: var(--s-2) var(--s-3); }
.brand span { color: var(--accent); }
.sidebar .search { margin: var(--s-2) 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-control);
  color: var(--text); font-weight: var(--w-medium); font-size: var(--text-15);
  border: 0; background: none; text-align: left; cursor: pointer; width: 100%;
}
.nav-item:hover { background: var(--fill); }
.nav-item.active { background: var(--accent); color: var(--accent-text); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .brand span, .sidebar.collapsed .search { display: none; }
.rail-foot { display: flex; gap: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--separator); }
.rail-foot button { flex: 1; }

main { min-width: 0; padding: var(--s-8) var(--s-8) var(--s-12); }
.content { max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); }
.page-head h1 { font-size: var(--text-34); font-weight: var(--w-semibold); margin: 0; letter-spacing: -0.02em; }
.page-head .desc { color: var(--text-2); margin: var(--s-1) 0 0; }
.page-head .actions { display: flex; gap: var(--s-2); flex: none; }

/* ---------- controls ---------- */
input[type="text"], input[type="search"], input[type="password"], input[type="number"], input:not([type]), select, textarea {
  background: var(--fill); border: 1px solid transparent; border-radius: var(--r-control);
  padding: 8px 12px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: var(--surface); }
textarea { resize: vertical; font-family: inherit; }
select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: var(--r-control); padding: 8px 16px;
  font-weight: var(--w-medium); cursor: pointer; white-space: nowrap;
  background: var(--fill); color: var(--text);
}
.btn:hover { filter: brightness(1.06); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: var(--text-13); border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; }

.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #5b5f69; transition: background .15s; }
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented { display: inline-flex; background: var(--fill); border-radius: var(--r-control); padding: 2px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; border-radius: 8px; padding: 5px 12px;
  font-size: var(--text-13); font-weight: var(--w-medium); color: var(--text); cursor: pointer;
}
.segmented button.active { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--fill); border-radius: var(--r-control); }
.stepper button { border: 0; background: none; width: 28px; height: 28px; font-size: var(--text-17); color: var(--accent); cursor: pointer; }
.stepper .val { min-width: 40px; text-align: center; font-weight: var(--w-medium); font-variant-numeric: tabular-nums; }

/* ---------- cards & lists ---------- */
.card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: var(--s-5); }
.card + .card { margin-top: var(--s-4); }
.card h3 { font-size: var(--text-17); font-weight: var(--w-semibold); margin: 0 0 var(--s-3); }
.grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid + .card, .card + .grid { margin-top: var(--s-4); }

.list { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 11px var(--s-4); min-height: 44px;
  border-bottom: 1px solid var(--separator);
}
.row:last-child { border-bottom: 0; }
.row .row-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--fill); flex: none; }
.row .row-icon svg { width: 16px; height: 16px; }
.row .row-body { flex: 1; min-width: 0; }
.row .row-title { font-weight: var(--w-medium); }
.row .row-sub { color: var(--text-2); font-size: var(--text-13); }
.row .row-value { color: var(--text-2); }
.row .chev { color: var(--text-2); flex: none; }
.row.clickable { cursor: pointer; }
.row.clickable:hover { background: var(--fill); }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: var(--text-13); font-weight: var(--w-medium); background: var(--fill); color: var(--text-2); }
.pill.on { background: rgba(48,209,88,.18); color: var(--green); }
.pill.warn { background: rgba(255,159,10,.18); color: var(--orange); }
.pill.err { background: rgba(255,69,58,.18); color: var(--red); }
.pill.accent { background: rgba(10,132,255,.16); color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--fill); border: 1px solid transparent; font-size: var(--text-15); }
.chip.button { cursor: pointer; }
.chip.button:hover { border-color: var(--accent); }
.chip .x { color: var(--text-2); cursor: pointer; border: 0; background: none; padding: 0 2px; font-size: var(--text-15); }
.chip .x:hover { color: var(--red); }

/* ---------- empty / skeleton / search ---------- */
.empty { text-align: center; padding: var(--s-12) var(--s-6); }
.empty .illo { width: 64px; height: 64px; margin: 0 auto var(--s-4); border-radius: var(--r-card); background: var(--fill); display: grid; place-items: center; color: var(--text-2); }
.empty .illo svg { width: 30px; height: 30px; }
.empty h3 { margin: 0 0 var(--s-2); font-size: var(--text-17); font-weight: var(--w-semibold); }
.empty p { margin: 0 0 var(--s-5); color: var(--text-2); }
.skel { border-radius: var(--r-card); background: linear-gradient(90deg, var(--fill) 25%, var(--surface) 50%, var(--fill) 75%); background-size: 200% 100%; animation: skel 1.2s infinite; min-height: 44px; }
@keyframes skel { to { background-position: -200% 0; } }

.search { position: relative; }
.search input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-2); pointer-events: none; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: var(--s-5); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: var(--s-2); align-items: center; }
.toast {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--raised); color: var(--text); border-radius: var(--r-control);
  box-shadow: var(--shadow-sheet); padding: 10px 16px; max-width: min(480px, 90vw);
  animation: toast-in .2s ease-out;
}
.toast.err { border-left: 3px solid var(--red); }
.toast.ok { border-left: 3px solid var(--green); }
.toast .btn { padding: 4px 10px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- sheets ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; animation: fade-in .15s; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 51;
  background: var(--bg); box-shadow: var(--shadow-sheet);
  display: flex; flex-direction: column; animation: sheet-in .2s ease-out;
}
.sheet-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--separator); }
.sheet-head h2 { font-size: var(--text-22); font-weight: var(--w-semibold); margin: 0; flex: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: var(--s-5); }
.sheet-foot { padding: var(--s-4) var(--s-5); border-top: 1px solid var(--separator); display: flex; gap: var(--s-2); justify-content: flex-end; }
@keyframes sheet-in { from { transform: translateX(32px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- form rows ---------- */
.field { margin-bottom: var(--s-4); }
.field label { display: block; font-weight: var(--w-medium); margin-bottom: var(--s-1); }
.field .help { color: var(--text-2); font-size: var(--text-13); margin-top: var(--s-1); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.field-row .fl { flex: 1; min-width: 0; }
.field-row .fl .help { color: var(--text-2); font-size: var(--text-13); }

/* ---------- misc ---------- */
.avatar { border-radius: 50%; background: var(--fill); object-fit: cover; image-rendering: pixelated; }
.mono { font-variant-numeric: tabular-nums; }
.sparkline { display: block; }
.banner { display: flex; align-items: center; gap: var(--s-3); background: rgba(255,159,10,.14); border: 1px solid rgba(255,159,10,.35); color: var(--text); border-radius: var(--r-card); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); }
.banner.info { background: rgba(10,132,255,.12); border-color: rgba(10,132,255,.35); }
.kbd { font-size: var(--text-13); color: var(--text-2); border: 1px solid var(--separator); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }
.template-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.template-card { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: var(--s-5); cursor: pointer; border: 2px solid transparent; text-align: left; }
.template-card:hover { border-color: var(--accent); }
.template-card .tc-icon { width: 40px; height: 40px; border-radius: var(--r-control); background: var(--fill); display: grid; place-items: center; margin-bottom: var(--s-3); color: var(--accent); }
.template-card .tc-icon svg { width: 20px; height: 20px; }
.template-card h4 { margin: 0 0 var(--s-1); font-size: var(--text-15); font-weight: var(--w-semibold); }
.template-card p { margin: 0; color: var(--text-2); font-size: var(--text-13); }

/* ---------- chest GUI preview/editor ---------- */
.mcgui {
  background: #c6c6c6; border-radius: 4px; padding: 8px;
  box-shadow: inset 0 0 0 2px #555555, inset 0 0 0 4px #ffffff66, 0 4px 14px rgba(0,0,0,.25);
  max-width: 520px; color: #3f3f3f; user-select: none;
}
.mcgui-title { font-size: var(--text-13); font-weight: 600; color: #3f3f3f; padding: 2px 2px 6px; }
.mcgui-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.mcslot {
  aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; position: relative;
  background: #8b8b8b; box-shadow: inset -2px -2px 0 #ffffff55, inset 2px 2px 0 #37373766;
  display: grid; place-items: center; min-width: 0;
}
.mcslot:hover { background: #a0a0a0; }
.mcslot.filled { background: #9d9d9d; }
.mcslot.picked { outline: 2px solid var(--accent); outline-offset: -2px; }
.mcslot:disabled { cursor: default; }
.mcslot:disabled:hover { background: #8b8b8b; }
.mcslot-mat {
  font-size: 8px; line-height: 1.05; color: #222; text-align: center;
  word-break: break-word; padding: 1px; font-weight: 600; letter-spacing: -.02em;
}
.slot-editor { margin-top: var(--s-4); }
.preview-box { margin-top: var(--s-4); }

/* ---------- chat-thread conversation preview ---------- */
.chat-thread {
  display: flex; flex-direction: column; gap: 6px; padding: var(--s-4);
  background: #00000030; border-radius: var(--r-card); margin-bottom: var(--s-4);
  max-height: 320px; overflow-y: auto;
}
.bubble {
  border: 0; text-align: left; cursor: pointer; max-width: 78%;
  padding: 7px 12px; border-radius: 16px; font-size: var(--text-15); line-height: 1.35;
  display: flex; flex-direction: column; gap: 2px;
}
.bubble.npc { align-self: flex-start; background: var(--fill); color: var(--text); border-bottom-left-radius: 4px; }
.bubble.player { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.bubble.player.end { opacity: .75; }
.bubble.picked { outline: 2px solid var(--accent); outline-offset: 2px; }
.bubble.player.picked { outline-color: var(--text); }
.bubble-speaker { font-size: var(--text-13); font-weight: var(--w-semibold); opacity: .7; }
.reply-row { margin-bottom: var(--s-2); }
.reply-next { max-width: 150px; }

/* ---------- sentence-style automation editor ---------- */
.automation-sentence { padding: var(--s-4) var(--s-5); }
.sentence { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; padding: 4px 0; }
.sentence-word { font-size: var(--text-17); color: var(--text-2); }
.sentence-select { width: auto; min-width: 150px; }
.sentence-params { display: inline-flex; gap: var(--s-2); flex-wrap: wrap; }
.sentence-param { width: 130px !important; }

/* ---------- npc editor ---------- */
.npc-preview { display: flex; gap: var(--s-4); align-items: center; margin-bottom: var(--s-5); }
.npc-head { width: 56px; height: 56px; border-radius: var(--r-control); background: var(--fill); }
.skin-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--s-4); }
.skin-cell { border: 2px solid transparent; border-radius: var(--r-control); padding: 3px; background: var(--fill); cursor: pointer; }
.skin-cell.picked { border-color: var(--accent); }
.skin-head { width: 36px; height: 36px; border-radius: 6px; display: block; }
.danger-zone { margin-top: var(--s-6); padding: var(--s-4); border: 1px solid rgba(255,69,58,.35); border-radius: var(--r-card); }
.danger-zone h3 { margin: 0 0 var(--s-2); font-size: var(--text-15); }
.danger-zone p { margin: 0 0 var(--s-3); }

/* ---------- responsive ---------- */
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; z-index: 40;
    flex-direction: row; align-items: center; padding: var(--s-2); border-right: 0; border-top: 1px solid var(--separator); overflow-x: auto; overflow-y: hidden;
  }
  .sidebar .brand, .sidebar .search, .rail-foot { display: none; }
  .sidebar nav { flex-direction: row; gap: var(--s-1); }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 10px; font-size: 10px; }
  .nav-item .nav-label { font-size: 10px; }
  main { padding: var(--s-5) var(--s-4) 96px; }
  .page-head h1 { font-size: var(--text-28); }
  .sheet { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- item pictures ---------- */
.item-icon { display: inline-grid; place-items: center; border-radius: 6px; color: #101215; font-weight: 800;
  letter-spacing: -.02em; image-rendering: pixelated; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 0 -3px 0 rgba(0,0,0,.18); user-select: none; }
.item-icon-img { image-rendering: pixelated; display: block; }
.mcslot .item-icon { width: 78%; height: 78%; }
.item-pick { display: flex; gap: 10px; align-items: center; }
.item-pick input { flex: 1; }

/* ---------- typed parameter forms ---------- */
.param-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 8px 0; }
.param { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.param-name { font-size: var(--text-13); color: var(--text-2); font-weight: var(--w-medium); }
.param input[type="text"], .param input[type="number"], .param select { width: 100%; }
.live-sentence-card { margin-bottom: var(--s-4); }
.live-sentence { font-size: var(--text-17); line-height: 1.4; }

.switch-wrap { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch-text { font-size: var(--text-13); font-weight: var(--w-semibold); color: var(--text-2); min-width: 22px; }
.switch input:checked ~ .track { background: var(--green); }

/* ---------- list + ladder editors, menu click rows ---------- */
.list-editor { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; gap: 8px; align-items: center; }
.list-row input { flex: 1; }
.ladder-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--fill); border-radius: var(--r-control); }
.ladder-row input[type="number"] { width: 72px; }
.click-row { display: grid; grid-template-columns: 130px minmax(150px, 220px) 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.click-label { font-size: var(--text-13); color: var(--text-2); font-weight: var(--w-medium); }
@media (max-width: 700px) { .click-row { grid-template-columns: 1fr; } }

/* ---------- look & feel live preview ---------- */
.look-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr); gap: var(--s-5); align-items: start; }
.look-edit { display: flex; flex-direction: column; gap: var(--s-4); }
.look-preview { position: sticky; top: var(--s-5); }
.look-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.look-head h3 { margin: 0; }
.look-status { align-self: center; }
.look-line { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; padding: 2px; border-radius: 10px; }
.look-line.sel { background: var(--fill); }
.look-line input { flex: 1; }
.look-grip { width: 22px; text-align: center; color: var(--text-2); font-size: var(--text-13); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mc-screen { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r-card); overflow: hidden;
  background: linear-gradient(180deg, #6fa8dc 0%, #8fc1e8 55%, #5b8c3a 55%, #4a7a2f 100%); border: 1px solid var(--separator); }
.mc-sidebar { position: absolute; right: 0; top: 50%; transform: translateY(-50%); min-width: 38%; max-width: 62%;
  background: rgba(0,0,0,.45); padding: 0 6px 4px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; color: #fff; }
.mc-sb-title { text-align: center; padding: 3px 2px; background: rgba(0,0,0,.25); margin: 0 -6px 3px; cursor: pointer; }
.mc-sb-line { padding: 1px 3px; white-space: pre; cursor: pointer; border-radius: 3px; min-height: 16px; overflow: hidden; text-overflow: ellipsis; }
.mc-sb-line:hover, .mc-sb-line.sel { background: rgba(255,255,255,.18); }
.mc-inline { width: 100%; font: inherit; background: rgba(0,0,0,.6); color: #fff; border: 1px solid #fff6; border-radius: 3px; padding: 0 3px; }
.mc-off { position: absolute; right: 8px; top: 8px; background: rgba(0,0,0,.45); color: #ddd; padding: 3px 8px; border-radius: 4px; font-size: 12px; }
.mc-tab { position: absolute; left: 50%; top: 6%; transform: translateX(-50%); min-width: 55%; text-align: center;
  background: rgba(0,0,0,.5); color: #fff; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; padding: 5px 8px; }
.mc-tab-head, .mc-tab-foot { padding: 3px 0; white-space: pre-line; }
.mc-tab-list { background: rgba(255,255,255,.12); margin: 3px 0; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.mc-rank { color: #55ffff; }
@media (max-width: 1000px) { .look-grid { grid-template-columns: 1fr; } .look-preview { position: static; } }

.reply-row { flex-wrap: wrap; }
.reply-action { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.reply-target input, .reply-target select { min-width: 160px; }

/* ---------- rich text editor ---------- */
.rich-line { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.rich-blocks { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px; background: var(--fill); border-radius: var(--r-control); }
.rich-block { background: transparent; border: 1px dashed transparent; border-radius: 6px; padding: 2px 4px; min-width: 24px; font-size: var(--text-15); }
.rich-block.active { border-color: var(--accent); background: rgba(10,132,255,.08); }
.rich-add { border: 1px dashed var(--separator); background: transparent; color: var(--text-2); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.rich-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rich-colors { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.rich-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.35); padding: 0; color: var(--text-2); font-size: 11px; }
.rich-dot.on { border-color: var(--accent); }
.rich-dot.none { background: var(--fill); }
.rich-custom { width: 26px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.rich-styles { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.rich-style { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--separator); background: transparent; color: var(--text); cursor: pointer; }
.rich-style.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.block-editor { display: flex; flex-direction: column; gap: 8px; }
.rich-row { display: flex; gap: 6px; align-items: flex-start; }
.frame-bar, .block-actions, .anim-menu { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.frame-tab { border: 1px solid var(--separator); background: transparent; color: var(--text); padding: 3px 10px; border-radius: 999px; cursor: pointer; }
.frame-tab.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.look-line { padding: 10px; border-radius: var(--r-control); margin-bottom: 8px; border: 1px solid var(--separator); }
.look-line.sel { border-color: var(--accent); }
.look-line-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.mc-sb-row { cursor: pointer; border-radius: 3px; }
.mc-sb-row.sel, .mc-sb-row:hover { background: rgba(255,255,255,.18); }
.mc-sb-line, .mc-title-line { padding: 1px 3px; white-space: pre; min-height: 16px; overflow: hidden; text-overflow: ellipsis; }
.mc-title-line { text-align: center; }
.mc-tab-line { min-height: 15px; }
.mc-head { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.mc-tab-name { text-align: left; padding: 1px 3px; white-space: nowrap; }
.mc-ping, .mc-world { color: #aaa; font-size: 10px; }

/* ---------- guided setup steps ---------- */
.step { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--separator); }
.step:last-child { border-bottom: 0; }
.step h3 { margin: 0 0 4px; }
.step-num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.ext-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.ext-link:hover { text-decoration: underline; }
.rank-chat { aspect-ratio: auto; min-height: 56px; display: flex; align-items: center; padding: 12px 14px; background: #2b2d31; }
.rank-preview { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; color: #fff; }
.rank-line { font-weight: 600; font-size: var(--text-17); }

.chip.button.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- compact centred dialogs (confirm) ---------- */
.sheet.compact { top: 50%; left: 50%; right: auto; bottom: auto; height: auto; max-height: 85vh; width: min(440px, 92vw);
  transform: translate(-50%, -50%); border-radius: var(--r-sheet); animation: fade-in .15s; }
.sheet.compact .sheet-body { flex: none; }
.confirm-body p { margin: 0 0 16px; font-size: var(--text-15); line-height: 1.45; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.look-line { display: block; }
.look-line input { flex: initial; }
.rich-blocks .rich-block { flex: none; }

/* ---- gear slots (NPC editor) and kit items ---- */
.gear-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-bottom: 8px; }
.gear-slot { background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--line, rgba(255,255,255,.08)); border-radius: 12px; padding: 10px 12px; }
.gear-label { font-size: var(--text-13, 13px); color: var(--muted, #8b93a1); margin-bottom: 6px; }
.kit-item { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.kit-item .item-pick { flex: 1; min-width: 200px; }

/* ---- animation editor (effect gallery, colour + speed, collapsed frames) ---- */
.anim-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 6px; }
.fx-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.fx-card { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 6px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2, rgba(255,255,255,.04)); border: 1px solid var(--line, rgba(255,255,255,.1)); color: inherit; font: inherit; }
.fx-card:hover { border-color: var(--accent, #7aa2ff); }
.fx-card.on { border-color: var(--accent, #7aa2ff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #7aa2ff) 35%, transparent); }
.fx-swatch { height: 18px; border-radius: 6px; display: block; }
.fx-name { font-size: var(--text-13, 13px); text-align: center; }
.anim-controls { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2, rgba(255,255,255,.04)); }
.anim-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.anim-row > span:first-child { min-width: 84px; color: var(--text-2, #9aa3b2); font-size: var(--text-13, 13px); }
.anim-color { display: inline-flex; align-items: center; gap: 8px; }
.anim-color input[type=color] { width: 38px; height: 28px; padding: 0; border: 1px solid var(--line, rgba(255,255,255,.15)); border-radius: 8px; background: none; cursor: pointer; }
.anim-speed input[type=range] { flex: 1; min-width: 120px; }
.anim-preview { margin-bottom: 10px; }
.anim-screen { background: rgba(0,0,0,.55); border-radius: 10px; padding: 8px 12px; min-height: 28px; font-family: var(--mc-font, monospace); }
.anim-frames { margin-top: 10px; }
.anim-toggle { background: none; border: 0; color: var(--text-2, #9aa3b2); cursor: pointer; font: inherit; padding: 4px 0; }
.anim-toggle:hover { color: var(--text, #fff); }
.frame-strip { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 4px 0 8px; flex-wrap: nowrap; }
.frame-strip .frame-tab { flex: 0 0 auto; white-space: nowrap; }
.frame-editor { margin-top: 6px; }

/* ---- holograms ---- */
.holo-stage { background: radial-gradient(circle at 50% 40%, #2a3350, #11141d 70%); border-radius: 14px; padding: 22px 12px; margin-bottom: 14px; display: grid; place-items: center; min-height: 90px; }
.holo-preview { display: inline-block; padding: 6px 12px; border-radius: 6px; background: rgba(0,0,0,.45); text-align: center; font-family: var(--mc-font, monospace); }
.holo-preview.clear { background: transparent; text-shadow: 0 0 4px #000; }
.holo-text { white-space: pre; min-height: 1.2em; }
.holo-edit-line { margin-bottom: 14px; }
.holo-coords { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.perm-who { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Text Studio ---- */
.ts { display: flex; flex-direction: column; gap: 14px; }
.ts-stage, .ts-summary { background: radial-gradient(circle at 50% 30%, #2a3350, #11141d 75%); border-radius: 14px; padding: 16px 14px; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ts-stage { justify-content: center; }
.ts-stage-sidebar { justify-content: flex-end; }
.ts-lines { display: flex; flex-direction: column; gap: 2px; align-items: center; font-family: var(--mc-font, ui-monospace, Menlo, Consolas, monospace); font-size: 15px; color: #fff; }
.ts-stage-sidebar .ts-lines { align-items: flex-start; background: rgba(0,0,0,.5); padding: 6px 10px; border-radius: 4px; }
.ts-line { min-height: 1.3em; white-space: pre; }
.ts-preview-text { white-space: pre; min-height: 1.3em; }
.ts-card { border: 1px solid var(--separator, rgba(255,255,255,.1)); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ts-input { position: relative; border-radius: var(--r-control, 10px); background: var(--fill, rgba(255,255,255,.06)); border: 1px solid var(--separator, rgba(255,255,255,.12)); }
.ts-input:focus-within { border-color: var(--accent, #7aa2ff); }
.ts-render, .ts-field { font: 16px/1.4 ui-monospace, Menlo, Consolas, "Courier New", monospace; letter-spacing: 0; padding: 9px 12px; margin: 0; border: 0; white-space: pre; box-sizing: border-box; width: 100%; }
.ts-render { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--text, #e6e8ec); }
.ts-field { position: relative; background: transparent; color: transparent; caret-color: var(--text, #fff); outline: none; }
.ts-field::selection { background: rgba(122,162,255,.45); color: transparent; }
.ts-field::placeholder { color: var(--text-2, #8a8f98); }
.ts-sel-row { font-size: var(--text-13, 13px); color: var(--text-2, #8a8f98); min-height: 1.2em; }
.ts-grad { display: inline-flex; align-items: center; gap: 4px; }
.ts-grad .rich-custom { width: 26px; height: 24px; }
.ts-effects { display: flex; flex-direction: column; gap: 8px; }
.ts-fx { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border-radius: 10px; background: var(--fill, rgba(255,255,255,.05)); }
.ts-fx-name { font-weight: 600; }
.ts-fx-on { flex: 1; min-width: 80px; }
.ts-summary .ts-lines { align-items: flex-start; }

.look-grip { white-space: nowrap; font-size: var(--text-13, 13px); color: var(--text-2, #8a8f98); }

/* ---- Item Studio ---- */
.is { display: flex; flex-direction: column; gap: 14px; }
.is-top { display: flex; gap: 16px; }
.is-preview-wrap { flex: 1; }
.is-tip { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 6px; background: #1b0a2d; border: 2px solid #2b0b5a; color: #fff; font-family: var(--mc-font, ui-monospace, Menlo, Consolas, monospace); font-size: 14px; max-width: 420px; }
.is-tip.glint { border-color: #5b21b6; box-shadow: 0 0 12px rgba(139,92,246,.35); }
.is-tip-icon { position: relative; flex: none; }
.is-tip-count { position: absolute; right: -2px; bottom: -4px; font-weight: 800; text-shadow: 1px 1px 0 #000; }
.is-tip-name { font-weight: 700; min-height: 1.2em; }
.is-tip-ench { color: #a8a8a8; }
.is-tip-lore { color: #a8a8a8; white-space: pre; }
.is-templates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.is-scroll { height: 240px; overflow-y: auto; border: 1px solid var(--separator, rgba(255,255,255,.12)); border-radius: 12px; padding: 8px; background: var(--fill, rgba(255,255,255,.04)); }
.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.is-cell { display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 3px; border-radius: 8px; border: 1px solid transparent; background: rgba(255,255,255,.04); cursor: pointer; }
.is-cell:hover { background: rgba(122,162,255,.18); }
.is-cell.on { border-color: var(--accent, #7aa2ff); background: rgba(122,162,255,.28); }
.is-cell img { image-rendering: pixelated; width: 32px; height: 32px; }
.is-more { text-align: center; padding: 10px 0; min-height: 24px; }
.is-btn { display: flex; align-items: center; gap: 12px; }
.is-btn-text { flex: 1; min-width: 0; }

/* Text Studio input: the coloured text layer always sits above the real (transparent) input, in every state. */
.ts-render { z-index: 2; }
.ts-field, .ts-field:focus, .ts-field:hover, .ts-field:active { z-index: 1; background: transparent !important; box-shadow: none !important; border: 0 !important; color: transparent; }

/* Text Studio: sticky preview, foldable lines, per-line preview */
.ts-stage { position: sticky; top: -1px; z-index: 5; box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.ts-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.ts-cards { display: flex; flex-direction: column; gap: 10px; }
.ts-card-head { cursor: pointer; margin-bottom: 0; align-items: center; gap: 10px; }
.ts-chev { width: 14px; color: var(--text-2, #8a8f98); }
.ts-line-preview { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #151922; border-radius: 8px; padding: 4px 10px; font-family: var(--mc-font, ui-monospace, Menlo, Consolas, monospace); font-size: 14px; color: #fff; overflow: hidden; }
.ts-card-body .ts-line-preview { margin-bottom: 2px; }
.ts-card.collapsed .ts-card-body { display: none; }
.ts-head-btns { display: inline-flex; gap: 2px; }
.ts-stage { max-height: 190px; overflow: auto; }

/* Grouped sidebar */
.nav-group { margin-bottom: 10px; }
.nav-group-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2, #8a8f98); padding: 8px 12px 4px; }

/* Foldable sections */
.fold { border: 1px solid var(--separator, rgba(255,255,255,.1)); border-radius: 12px; margin: 12px 0; }
.fold > summary { cursor: pointer; font-weight: 600; padding: 10px 14px; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--text-2, #8a8f98); }
.fold[open] > summary::before { content: "▾"; }
.fold-body { padding: 0 14px 12px; }

/* Boss bar preview */
.mc-bossbar { position: absolute; left: 15%; top: 2%; width: 70%; text-align: center; z-index: 2; }
.mc-screen.has-bb .mc-tab { top: 16%; }
.field-row > select { flex: 0 0 190px; width: 190px; }
.mc-bb-text { font-family: var(--mc-font, monospace); font-size: 12px; text-shadow: 1px 1px #000; margin-bottom: 3px; }
.mc-bb-track { position: relative; height: 6px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.25); }
.mc-bb-fill { height: 100%; width: 100%; }
.mc-bb-track i { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.7); }
.insert-menu { max-width: 150px; }
.thread-label { margin: 10px 0 4px; font-size: var(--text-13); }
.ts-glyph-wrap { margin: 8px 0; }
.ts-glyphs { margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--fill, rgba(255,255,255,.06)); }
.ts-glyphs.hide { display: none; }
.ts-glyph-group { margin-bottom: 8px; }
.ts-glyph-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ts-glyph { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--separator); background: transparent; color: inherit; font-size: 18px; cursor: pointer; }
.ts-glyph:hover { background: rgba(255,255,255,.14); }

/* ---------- screen designer ---------- */
.sc-grid { display: grid; grid-template-columns: auto minmax(240px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .sc-grid { grid-template-columns: 1fr; } }
.sc-add { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.sc-stage { background: repeating-conic-gradient(rgba(120,120,128,.18) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border-radius: var(--r-control); padding: 12px; overflow: auto; display: inline-block; max-width: 100%; }
.sc-canvas { position: relative; background: #3b4a3a; image-rendering: pixelated; overflow: hidden; box-shadow: 0 0 0 1px var(--separator); }
.sc-el { position: absolute; box-sizing: border-box; cursor: move; user-select: none; display: flex; align-items: center; justify-content: center; touch-action: none; }
.sc-el.sel { outline: 2px solid var(--accent); outline-offset: 1px; z-index: 5; }
.sc-el span { white-space: nowrap; font-family: ui-monospace, Menlo, Consolas, monospace; text-shadow: 2px 2px 0 rgba(0,0,0,.45); overflow: hidden; }
.mc-glass { background: rgba(24, 26, 32, .66); border: 2px solid rgba(255,255,255,.22); border-radius: 4px; }
.sc-button { background: rgba(255,255,255,.16); border: 2px solid rgba(255,255,255,.34); }
.sc-grip { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: var(--accent); border-radius: 3px; cursor: nwse-resize; }
.sc-time { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sc-props h4 { margin: 14px 0 6px; }
.sc-props h4:first-child { margin-top: 0; }
.sc-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.sc-num { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
