:root { color-scheme: dark; --accent: #4da3ff; --bg: #0e1118; --panel: #1a1f2b; --line: #2c3444; --text: #eef2f8; --muted: #9aa6ba; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }

#viewport { position: fixed; inset: 0; overflow: hidden;
background-color: #151a25;
background-image: radial-gradient(circle at 30% 20%, #243049 0%, transparent 55%),
radial-gradient(circle at 80% 90%, #2a2147 0%, transparent 50%),
linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
background-size: auto, auto, 60px 60px, 60px 60px; }
#viewport.custom-bg { background-size: cover; background-position: center; background-repeat: no-repeat; }
#stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: 50% 50%; }

/* images */
.item { position: absolute; transform-origin: 50% 50%; touch-action: none; user-select: none; -webkit-user-select: none; }
.item img { width: 100%; height: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.item.editable { cursor: move; }
.label { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%) scale(var(--inv, 1)); transform-origin: 50% 100%;
  margin-bottom: calc(8px * var(--inv, 1)); white-space: nowrap; pointer-events: none; max-width: 600px; overflow: hidden; text-overflow: ellipsis;
  background: rgba(10,12,18,.72); backdrop-filter: blur(4px); padding: 3px 12px; border-radius: 999px; font-weight: 600; font-size: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.edit { display: none; position: absolute; inset: 0; pointer-events: none; }
.item.showbar .edit { display: block; }
.outline { position: absolute; inset: 0; border: calc(2px * var(--inv, 1)) dashed var(--accent); }
.h { position: absolute; width: calc(16px * var(--inv, 1)); height: calc(16px * var(--inv, 1)); background: #fff; pointer-events: auto;
  border: calc(2px * var(--inv, 1)) solid var(--accent); border-radius: 50%; touch-action: none; }
.h.tl { left: 0; top: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
.h.br { left: 100%; top: 100%; transform: translate(-50%, -50%); cursor: nwse-resize; }
.h.tr { left: 100%; top: 0; transform: translate(-50%, -50%); cursor: nesw-resize; }
.h.bl { left: 0; top: 100%; transform: translate(-50%, -50%); cursor: nesw-resize; }
.bar { position: absolute; left: 50%; top: 100%; transform: translateX(-50%) scale(var(--inv, 1)); transform-origin: 50% 0;
  margin-top: calc(14px * var(--inv, 1)); display: flex; gap: 6px; padding: 5px; border-radius: 999px; pointer-events: auto;
  background: rgba(16,19,28,.92); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.bar button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: #2a3243; display: grid; place-items: center; cursor: pointer; padding: 0; }
.bar button:hover { background: #38425a; }
.bar .rot { cursor: grab; touch-action: none; }
.bar .del { display: none; background: #7a2630; font-size: 14px; line-height: 1; }
.bar .del:hover { background: #a3313f; }
.item.candel .bar .del { display: grid; }

/* chrome */
#brand { position: fixed; left: max(16px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); display: flex; align-items: baseline; gap: 12px; pointer-events: none; z-index: 5000; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
#brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
#online { color: var(--muted); font-size: 13px; }
#topright { position: fixed; right: max(16px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); display: flex; gap: 10px; align-items: center; z-index: 5000; }
.round, .pill, #uploadBtn { border: 1px solid var(--line); background: rgba(22,26,38,.92); cursor: pointer; backdrop-filter: blur(6px); box-shadow: 0 4px 18px rgba(0,0,0,.45); }
.round { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.pill { height: 44px; padding: 0 16px; border-radius: 999px; font-weight: 600; }
.round:hover, .pill:hover { background: #262c3f; }
#uploadBtn { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 5000;
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: #04121f; border: 0; font-weight: 700; }
#uploadBtn:hover { filter: brightness(1.1); }
@media (max-width: 520px) { #uploadBtn span { display: none; } #uploadBtn { width: 56px; height: 56px; padding: 0; justify-content: center; } #brand h1 { font-size: 16px; } }

#banner { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 5001; background: #7a2630; padding: 8px 18px; border-radius: 999px; font-weight: 600; max-width: 80vw; }
#status { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5001; background: rgba(22,26,38,.95); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px; }
#toasts { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 7000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #222a3b; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 90vw; }

/* modals */
.backdrop { position: fixed; inset: 0; z-index: 6000; background: rgba(5,7,12,.6); display: grid; place-items: center; padding: 16px; }
.card { width: min(560px, 100%); max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.6); }
.card.wide { width: min(760px, 100%); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.card-head h2 { margin: 0; font-size: 18px; }
.card-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.icon-btn { background: transparent; border: 0; cursor: pointer; font-size: 18px; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: #262c3f; color: var(--text); }
label.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
input[type=text], textarea { background: #11151e; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); width: 100%; }
input[type=text]:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: #262d40; padding: 9px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block; }
.btn:hover { background: #313a52; }
.btn.primary { background: var(--accent); color: #04121f; border-color: transparent; }
.btn.danger { background: #7a2630; border-color: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.google { background: #fff; color: #222; border-color: #fff; }
.btn.microsoft { background: #2f2f2f; color: #fff; border-color: #444; }
.muted { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; }
.tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.tab.on { background: var(--accent); color: #04121f; border-color: transparent; font-weight: 700; }
.user { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #151a26; }
.user .top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.user .nm { font-weight: 700; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #2b3550; }
.badge.on { background: #1d5a3a; } .badge.bad { background: #7a2630; } .badge.adm { background: #5a3d8a; }
.warnmsg { white-space: pre-wrap; word-break: break-word; font-size: 16px; padding: 12px; border-radius: 10px; background: #3a2a10; border: 1px solid #7a5a20; }
