:root{
  --bg:#f4f5f6;--surface:#fff;--surface-2:#f0f1f2;--text:#121417;--muted:#717983;--line:#d9dde1;
  --accent:#c4112d;--danger:#d71938;--shadow:0 18px 50px rgba(10,14,18,.14);--radius:20px;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color-scheme:light;
}
html[data-theme="dark"]{--bg:#0b0d10;--surface:#14171b;--surface-2:#1c2025;--text:#f2f4f6;--muted:#9aa3ad;--line:#2b3138;--accent:#ff3654;--danger:#ff3654;--shadow:0 18px 60px rgba(0,0,0,.42);color-scheme:dark}
*{box-sizing:border-box}html,body,#app{margin:0;min-height:100%;height:100%;background:var(--bg);color:var(--text)}body{overflow:hidden}button,input{font:inherit}button{border:0}.boot{height:100%;display:flex;align-items:center;justify-content:center;gap:12px;font-weight:800;letter-spacing:.08em}.boot img{width:48px;height:48px;border-radius:13px}
.app-shell{height:100%;display:flex;flex-direction:column;min-width:0}.topbar{height:64px;min-height:64px;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(18px);border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px;padding:0 14px;z-index:30}.brand{display:flex;align-items:center;gap:10px;font-weight:850;letter-spacing:.06em}.brand img{width:34px;height:34px;border-radius:10px}.spacer{flex:1}.icon-btn,.text-btn,.primary-btn,.chip-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border-radius:13px;cursor:pointer;color:var(--text);background:var(--surface-2);transition:transform .16s ease,background .16s ease,opacity .16s ease}.icon-btn{width:40px;height:40px;font-size:18px}.text-btn{height:40px;padding:0 14px;font-weight:700}.primary-btn{height:46px;padding:0 20px;background:var(--accent);color:white;font-weight:800}.chip-btn{height:36px;padding:0 11px;font-size:13px;font-weight:700}.icon-btn:hover,.text-btn:hover,.chip-btn:hover{background:color-mix(in srgb,var(--surface-2) 74%,var(--accent) 8%)}button:active{transform:scale(.97)}button:disabled{opacity:.35;cursor:default;transform:none}.danger{color:var(--danger)}
.home{height:100%;overflow:auto;padding-bottom:40px}.home-head{max-width:980px;margin:0 auto;padding:26px 20px 10px;display:flex;align-items:flex-end;gap:16px}.home-head h1{font-size:36px;margin:0;letter-spacing:-.04em}.home-head p{margin:7px 0 0;color:var(--muted)}.project-grid{max-width:980px;margin:14px auto;padding:0 20px;display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}.project-card,.new-card{background:var(--surface);border:1px solid var(--line);border-radius:22px;min-height:150px;padding:18px;box-shadow:0 2px 10px rgba(0,0,0,.02);cursor:pointer;transition:transform .17s ease,border-color .17s ease,box-shadow .17s ease}.project-card:hover,.new-card:hover{transform:translateY(-2px);border-color:color-mix(in srgb,var(--accent) 35%,var(--line));box-shadow:var(--shadow)}.new-card{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;color:var(--accent);font-weight:800;border-style:dashed}.new-card .plus{font-size:28px}.project-card h3{margin:0 0 6px;font-size:18px}.project-meta{color:var(--muted);font-size:13px;display:flex;gap:10px;flex-wrap:wrap}.project-count{margin-top:28px;font-size:13px;color:var(--muted)}
.editor{height:100%;display:flex;flex-direction:column;min-height:0}.editor-title{min-width:0}.editor-title strong,.editor-title small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.editor-title strong{font-size:14px}.editor-title small{font-size:11px;color:var(--muted);margin-top:2px}.scene-area{position:relative;flex:1;min-height:0;overflow:hidden;background:var(--bg)}.scene-wrap{position:absolute;inset:10px 10px 76px;border-radius:22px;overflow:hidden;background:var(--surface);border:1px solid var(--line);box-shadow:0 6px 28px rgba(0,0,0,.05);touch-action:none}.scene-wrap.view-mode{inset:0;border:0;border-radius:0}.scene-wrap.landscape-frame{max-width:none}#hall-svg{width:100%;height:100%;display:block;touch-action:none;user-select:none;-webkit-user-select:none}.guest-counter{position:absolute;left:16px;top:16px;z-index:8;padding:8px 11px;border-radius:11px;background:color-mix(in srgb,var(--surface) 90%,transparent);backdrop-filter:blur(12px);border:1px solid var(--line);font-size:12px;font-weight:800;box-shadow:0 4px 14px rgba(0,0,0,.08)}.zoom-reset{position:absolute;right:14px;bottom:14px;z-index:8}.bottom-bar{position:absolute;z-index:20;bottom:12px;left:50%;transform:translateX(-50%);display:flex;gap:8px;padding:8px;border-radius:18px;background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(18px);border:1px solid var(--line);box-shadow:var(--shadow)}.bottom-bar .text-btn{white-space:nowrap}.view-exit{position:absolute;right:14px;top:14px;z-index:30}
.context-card{position:fixed;z-index:70;width:220px;background:var(--surface);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow);padding:12px;animation:pop .14s ease-out;overflow:hidden}.context-card h4{margin:0 0 10px;font-size:14px}.context-card .row{display:flex;align-items:center;gap:8px;margin-top:8px}.context-card .row>*{flex:1}.stepper{display:flex;align-items:center;gap:8px;background:var(--surface-2);border-radius:12px;padding:4px}.stepper button{width:32px;height:32px;border-radius:9px;background:var(--surface);color:var(--text);cursor:pointer;font-weight:800}.stepper output{min-width:42px;text-align:center;font-weight:850}.context-card .delete-row{width:100%;margin-top:10px;height:38px;border-radius:11px;background:color-mix(in srgb,var(--danger) 11%,transparent);color:var(--danger);font-weight:800;cursor:pointer}
.modal-backdrop{position:fixed;inset:0;z-index:80;background:rgba(0,0,0,.28);display:grid;place-items:center;padding:18px;animation:fade .16s ease}.modal{width:min(500px,100%);max-height:min(82vh,760px);overflow:auto;background:var(--surface);border:1px solid var(--line);border-radius:24px;box-shadow:var(--shadow);padding:20px;animation:rise .18s ease}.modal.wide{width:min(640px,100%)}.modal h2{margin:0 0 5px;font-size:22px;letter-spacing:-.025em}.modal p.sub{margin:0 0 18px;color:var(--muted);font-size:13px}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}.field{display:grid;gap:7px;margin:13px 0}.field label,.section-label{font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}.field input{height:46px;border-radius:13px;border:1px solid var(--line);padding:0 13px;background:var(--surface-2);color:var(--text);outline:none}.field input:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 14%,transparent)}.switch-list{display:grid;gap:8px;margin-top:10px}.switch-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:11px 12px;border-radius:14px;background:var(--surface-2)}.switch-row strong{font-size:14px}.switch-row small{display:block;margin-top:2px;color:var(--muted);font-size:11px}.switch{width:46px;height:26px;border-radius:20px;background:#9ea4aa;position:relative;cursor:pointer;flex:0 0 auto;transition:.16s}.switch::after{content:"";position:absolute;width:20px;height:20px;border-radius:50%;background:#fff;left:3px;top:3px;transition:.16s;box-shadow:0 1px 4px rgba(0,0,0,.25)}.switch.on{background:var(--accent)}.switch.on::after{left:23px}.segmented{display:flex;padding:4px;border-radius:14px;background:var(--surface-2);gap:4px}.segmented button{flex:1;height:38px;border-radius:10px;background:transparent;color:var(--muted);font-weight:800;cursor:pointer}.segmented button.active{background:var(--surface);color:var(--text);box-shadow:0 2px 7px rgba(0,0,0,.07)}.number-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.check-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}.check-item{display:flex;align-items:center;gap:8px;padding:10px;border-radius:12px;background:var(--surface-2);cursor:pointer}.check-item input{accent-color:var(--accent)}
.loader-backdrop{position:fixed;inset:0;z-index:120;background:rgba(0,0,0,.30);display:grid;place-items:center;backdrop-filter:blur(2px)}.loader-card{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:20px 24px;min-width:250px;text-align:center;box-shadow:var(--shadow)}.spinner{width:34px;height:34px;margin:0 auto 12px;border:3px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:spin .75s linear infinite}.loader-card strong{display:block}.loader-card small{display:block;color:var(--muted);margin-top:4px}.toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%);z-index:140;padding:10px 14px;border-radius:13px;background:var(--text);color:var(--surface);font-size:13px;font-weight:700;box-shadow:var(--shadow);animation:toast .18s ease}.empty-note{padding:30px;text-align:center;color:var(--muted)}
.version-list{display:grid;gap:8px}.version-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px;border-radius:13px;background:var(--surface-2);cursor:pointer}.version-item.active{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent)}
@keyframes spin{to{transform:rotate(360deg)}}@keyframes pop{from{opacity:0;transform:scale(.96) translateY(4px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes rise{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}@keyframes fade{from{opacity:0}to{opacity:1}}@keyframes toast{from{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%,0)}}
@media(max-width:700px){.topbar{height:58px;min-height:58px;padding:0 8px;gap:6px}.brand span{display:none}.topbar .desktop-label{display:none}.editor-title{max-width:130px}.scene-wrap{inset:7px 7px 72px;border-radius:18px}.bottom-bar{bottom:8px;max-width:calc(100% - 14px);overflow-x:auto}.bottom-bar .text-btn{height:42px;padding:0 12px}.home-head{padding-top:20px}.home-head h1{font-size:30px}.number-grid,.check-grid{grid-template-columns:1fr}.modal{padding:17px;border-radius:21px}.guest-counter{left:11px;top:11px;font-size:11px}.context-card{width:210px}}

.layout-errors{flex:none;padding:10px 16px;background:#fff1d7;color:#713d00;border-bottom:1px solid #dfbb74;font-size:12px;display:grid;gap:4px;max-height:140px;overflow:auto}
[data-theme="dark"] .layout-errors{background:#392a16;color:#ffe1a3}
.export-preview{display:block;max-width:100%;max-height:55vh;object-fit:contain;margin:12px auto}
.download-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
.recovery{max-width:640px;margin:6vh auto;padding:24px;line-height:1.6}
.recovery button{margin:8px}
button:disabled{cursor:wait;opacity:.55}

/* Keep the editor toggle in exactly the same toolbar cell in both modes. */
.bottom-bar.is-preview>button:not(.mode-toggle){visibility:hidden;pointer-events:none}
.bottom-bar .mode-toggle{width:112px;min-width:112px;flex:0 0 112px;padding-left:0;padding-right:0}
.context-card .popup-ok{width:100%;margin-top:10px;height:38px}
