:root { --bg: #0b0910; --panel: rgba(24, 17, 32, .92); --line: #3a2b48; --ink: #efe8fb; --mut: #a99fc2; --acc: #ff8fc8; --ok: #4fbf6a; --warn: #ffb347; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Tahoma, sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
#stage { position: relative; width: 100vw; height: 100vh; margin: 0 auto; overflow: hidden; background: #07060b; }
#stage.shorts { width: calc(100vh * 9 / 16); box-shadow: 0 0 0 1px #2a2238; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }

/* top bar */
#top { position: absolute; top: 10px; inset-inline: 10px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; pointer-events: none; z-index: 5; }
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; backdrop-filter: blur(6px); }
.brand b { letter-spacing: 2px; color: var(--acc); font-size: 15px; }
.brand span { font-size: 13px; color: var(--mut); }
.brand .live { width: 8px; height: 8px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 8px #ff4d4d; animation: blink 1.2s infinite; }
.brand .demo { font-size: 11px; color: #1b1424; background: var(--warn); padding: 2px 7px; border-radius: 99px; }
@keyframes blink { 50% { opacity: .25; } }
#top nav { display: flex; gap: 6px; flex-wrap: wrap; }
#top nav button, .zoom button { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 13px; backdrop-filter: blur(6px); }
#top nav button:hover { border-color: var(--acc); }
#top nav button.on { background: var(--acc); color: #1b1424; border-color: var(--acc); font-weight: 700; }
.zoom { display: inline-flex; gap: 4px; }
.zoom button { width: 34px; padding: 7px 0; }

/* panels */
.panel, .drawer, .card { position: absolute; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.panel > header, .drawer > header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
[data-close] { background: none; border: 0; font-size: 20px; line-height: 1; color: var(--mut); padding: 0 4px; }
[data-close]:hover { color: var(--acc); }
.hidden { display: none !important; }
.body { padding: 10px 14px 14px; overflow: auto; }
.mini { font-size: 12px; color: var(--mut); margin: 0 0 8px; line-height: 1.6; }
.mini.warn { color: var(--warn); }
.muted { color: var(--mut); }
h4 { margin: 12px 0 6px; font-size: 13px; color: var(--acc); }

#models { top: 64px; inset-inline-start: 10px; width: 400px; max-height: calc(100% - 120px); display: flex; flex-direction: column; }
.mrow { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px dashed #2e2340; }
.mrow i { width: 9px; height: 9px; border-radius: 50%; background: #4a4458; }
.mrow.busy i { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.mrow.idle i { background: var(--warn); }
.mrow b { display: block; font-size: 13px; direction: ltr; text-align: right; }
.mrow span { font-size: 12px; color: var(--mut); }
.mrow a { color: var(--ink); cursor: pointer; text-decoration: underline dotted; }
.mrow em { font-style: normal; font-size: 12px; }
.mrow.busy em { color: var(--ok); } .mrow.idle em { color: var(--warn); } .mrow.off em { color: #6f6782; }
.mrow small { font-size: 11px; color: var(--mut); }

#control { top: 64px; bottom: 44px; inset-inline-end: 10px; width: 420px; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 6px; padding: 10px 14px 0; }
.tabs button, .modes button { background: #1f1630; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 13px; }
.tabs button.on, .modes button.on { background: var(--acc); color: #1b1424; font-weight: 700; border-color: var(--acc); }
.modes { display: flex; gap: 6px; margin-bottom: 8px; }
.board { list-style: none; padding: 0; margin: 0; }
.board li { padding: 7px 10px; margin-bottom: 5px; background: #1c1429; border-radius: 8px; font-size: 13px; border-inline-start: 3px solid #4a4458; }
.board li.doing { border-color: var(--warn); }
.board li.done { text-decoration: line-through; color: #7d7394; border-color: var(--ok); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile { background: #1c1429; border-radius: 9px; padding: 8px; }
.tile span { display: block; font-size: 11px; color: var(--mut); }
.tile b { font-size: 16px; }
.tile b.na { font-size: 11px; color: #6f6782; font-weight: 500; }
.log { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.log li { padding: 5px 0; border-bottom: 1px dashed #2e2340; }
.log time, .card time { color: var(--mut); font-size: 11px; margin-inline-end: 6px; direction: ltr; display: inline-block; }

#stories { top: 64px; left: 50%; transform: translateX(-50%); width: 420px; }
.srow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; background: #1c1429; border-radius: 10px; margin-bottom: 8px; }
.srow b { display: block; } .srow span { font-size: 12px; color: var(--mut); }
.srow button { background: var(--acc); color: #1b1424; border: 0; border-radius: 9px; padding: 7px 14px; font-weight: 700; }

/* agent / room card */
.card { bottom: 44px; inset-inline-start: 10px; width: 330px; padding: 12px 14px; }
.card .head { display: flex; gap: 12px; align-items: center; }
.card .por { width: 72px; height: 72px; image-rendering: pixelated; background: #1c1429; border-radius: 10px; padding: 4px; }
.card .who { flex: 1; }
.card .who b { font-size: 19px; display: block; }
.card .who em { font-style: normal; font-size: 12px; color: var(--acc); }
.card .model { display: inline-block; margin-top: 4px; font-size: 12px; background: #2a1f3a; padding: 2px 8px; border-radius: 99px; direction: ltr; }
.card .head.room b { color: var(--acc); }
.card .rows { margin-top: 10px; }
.card .rows div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed #2e2340; }
.card .rows span { color: var(--mut); }
.card .st.s-work { color: var(--ok); } .card .st.s-cafe, .card .st.s-brew, .card .st.s-wait_elev { color: var(--warn); } .card .st.s-walk, .card .st.s-ride_elev { color: #9fd3ff; } .card .st.s-sleep { color: #b58cff; }
#clock { cursor: pointer; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.06); direction: rtl; }
#clock:hover { background: rgba(255,143,200,.18); color: var(--ink); }
.card .now { margin-top: 8px; font-size: 13px; background: #1c1429; border-radius: 8px; padding: 7px 10px; min-height: 18px; }
.card ul { list-style: none; padding: 0; margin: 0; font-size: 13px; max-height: 130px; overflow: auto; }
.card ul li { padding: 4px 0; }
.card li[data-agent] { cursor: pointer; }
.card li[data-agent]:hover b { color: var(--acc); }
.card .btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.card .btns button { background: #1f1630; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; font-size: 12px; }
.card .btns button:hover { border-color: var(--acc); }
.card .mini { margin-top: 8px; margin-bottom: 0; }

/* floor buttons (elevator panel) + minimap */
#floors { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); z-index: 5; display: flex; flex-direction: column; gap: 5px; }
#floors button { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; font-weight: 700; text-align: start; min-width: 44px; backdrop-filter: blur(6px); }
#floors button small { display: none; font-weight: 500; color: var(--mut); margin-inline-start: 6px; }
#floors:hover button small { display: inline; }
#floors button:hover { border-color: var(--acc); color: var(--acc); }
#mini { position: absolute; left: 10px; bottom: 44px; width: 220px; z-index: 5; border: 1px solid var(--line); border-radius: 10px; background: #07060b; cursor: pointer; image-rendering: auto; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#stage.clean #floors, #stage.clean #mini { display: none !important; }
#stage.shorts #mini { width: 140px; }
#stage.shorts #floors button { padding: 5px 7px; font-size: 12px; }
#hint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--mut); background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; white-space: nowrap; z-index: 4; }

/* clean (recording) mode */
#stage.clean #top, #stage.clean .panel, #stage.clean .drawer, #stage.clean .card, #stage.clean #hint { display: none !important; }
#stage.clean:not(.story)::after { content: "وضع التصوير · H للرجوع"; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); font-size: 11px; color: rgba(255,255,255,.35); }
#stage.shorts #top nav button { padding: 6px 8px; font-size: 12px; }
#stage.shorts #models, #stage.shorts #control, #stage.shorts #stories, #stage.shorts .card { width: calc(100% - 20px); }
#stage.shorts #hint { display: none; }
@media (max-width: 760px) { #models, #control, #stories, .card { width: calc(100% - 20px) !important; } #hint { display: none; } }

/* ---- tidy v3 (28/11): same dark navy glass panels as the new art, smaller and rounder ---- */
:root { --panel: rgba(12, 10, 26, .84); --line: rgba(130, 120, 200, .24); }
.brand, #top nav button, .zoom button, #floors button, #hint, .panel, .drawer, .card { backdrop-filter: blur(8px); box-shadow: 0 4px 18px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.05); }
.brand { border-radius: 10px; padding: 5px 10px; }
.brand b { font-size: 13px; }
.brand span { font-size: 12px; }
#top nav { gap: 5px; }
#top nav button, .zoom button { border-radius: 9px; padding: 5px 10px; font-size: 12px; }
.zoom button { width: 30px; padding: 5px 0; }
#top nav button.on { box-shadow: 0 0 12px rgba(255, 143, 200, .45); }
#floors { gap: 4px; }
#floors button { border-radius: 9px; padding: 5px 9px; font-size: 12px; min-width: 40px; }
#mini { width: 190px; border-radius: 9px; border-color: var(--line); background: #0a0814; }
#hint { font-size: 11px; padding: 4px 11px; opacity: .8; }
.panel, .drawer, .card { border-radius: 12px; }
