:root {
  --ink: #11140f;
  --ink-2: #181b16;
  --paper: #f1f3ed;
  --white: #fbfcf8;
  --muted: #747c6f;
  --green: #91ad50;
  --lime: #bad96c;
  --line: rgba(21, 27, 17, .12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { color: var(--ink); background: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(145, 173, 80, .42); outline-offset: 2px; }
.hidden { display: none !important; }
.hidden-input { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.eyebrow { color: #72805d; font-size: 10px; font-weight: 800; letter-spacing: .17em; }
.spinner { width: 18px; height: 18px; display: inline-block; border: 2px solid rgba(145, 173, 80, .25); border-top-color: var(--lime); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 700; transition: transform .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button.primary { color: #19210e; background: var(--lime); box-shadow: 0 10px 32px rgba(120, 150, 55, .18); }
.button.primary:hover { background: #c7e47c; }
.button.ghost { color: rgba(255, 255, 255, .83); background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
.button.subtle { color: #34451d; background: rgba(145, 173, 80, .12); border-color: rgba(90, 113, 46, .2); }
.button.large { min-height: 50px; padding: 0 25px; border-radius: 14px; font-size: 15px; }
.button.full { width: 100%; }
.icon-button { min-height: 37px; padding: 0 11px; border: 0; color: rgba(255,255,255,.46); background: transparent; cursor: pointer; font-size: 11px; }

.logo-mark { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px 12px 12px 3px; color: #141a0d; background: linear-gradient(145deg, #c0df73, #8eaa4c); box-shadow: inset 0 1px rgba(255,255,255,.4); font-size: 20px; font-weight: 900; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.brand strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: 16px; }
.brand small { margin-top: 2px; color: rgba(255,255,255,.48); font-size: 9px; letter-spacing: .14em; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 36%, #29351e, #11140f 56%); }
.login-card { width: min(390px,100%); display: flex; align-items: center; flex-direction: column; padding: 38px 34px; border: 1px solid rgba(255,255,255,.11); border-radius: 22px; color: #fff; background: rgba(255,255,255,.055); backdrop-filter: blur(15px); text-align: center; box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.login-card .logo-mark { margin-bottom: 18px; }
.login-card .eyebrow { color: rgba(200,225,135,.7); }
.login-card h1 { margin: 8px 0; font-size: 27px; }
.login-card p { margin: 0 0 22px; color: rgba(255,255,255,.5); font-size: 12px; line-height: 1.7; }
.login-card input { width: 100%; height: 49px; margin-bottom: 13px; padding: 0 14px; border: 1px solid rgba(44,54,37,.16); border-radius: 11px; color: var(--ink); background: #fff; text-align: center; }
.inline-error { width: 100%; margin: -8px 0 12px; padding: 9px; border-radius: 9px; color: #ffc6bf; background: rgba(194,73,60,.18); font-size: 11px; }

.studio-app { min-height: 100vh; background: var(--paper); }
.topbar { position: relative; z-index: 20; height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; color: #fff; background: #10130f; border-bottom: 1px solid rgba(255,255,255,.08); }
.topbar-actions, .workspace-actions { display: flex; align-items: center; gap: 9px; }
.studio-grid { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { min-width: 0; display: flex; flex-direction: column; padding: 23px 16px 18px; color: #fff; background: #151814; border-right: 1px solid rgba(255,255,255,.06); }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 5px 14px; color: rgba(255,255,255,.55); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.sidebar-heading button { width: 29px; height: 29px; display: grid; place-items: center; padding: 0 0 2px; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; color: var(--lime); background: rgba(255,255,255,.04); cursor: pointer; font-size: 20px; }
.project-list { flex: 1; display: flex; flex-direction: column; gap: 7px; overflow: auto; }
.project-row { width: 100%; display: grid; grid-template-columns: 57px minmax(0,1fr); gap: 11px; align-items: center; padding: 8px; border: 1px solid transparent; border-radius: 13px; color: #fff; background: transparent; cursor: pointer; text-align: left; }
.project-row:hover { background: rgba(255,255,255,.04); }
.project-row.active { background: rgba(186,217,108,.09); border-color: rgba(186,217,108,.2); }
.project-thumb { width: 57px; height: 43px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; color: rgba(255,255,255,.27); background: radial-gradient(circle at 35% 35%, #3b4335, #242822 65%); font-size: 10px; }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-row > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.project-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,255,255,.9); font-size: 13px; }
.project-row small { color: rgba(255,255,255,.4); font-size: 10px; }
.scan-card { display: flex; flex-direction: column; gap: 5px; margin-top: 18px; padding: 14px; border-radius: 13px; background: rgba(255,255,255,.035); }
.scan-card small, .scan-card span { color: rgba(255,255,255,.35); font-size: 10px; }
.scan-card strong { color: rgba(255,255,255,.82); font-size: 13px; }

.workspace { min-width: 0; display: flex; flex-direction: column; padding: 24px clamp(20px,3vw,48px) 28px; background: radial-gradient(circle at 88% 4%, rgba(145,173,80,.13), transparent 28%), var(--paper); }
.workspace-title { min-height: 58px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.workspace-title > div:first-child { min-width: 0; }
.workspace-title h1 { margin: 7px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(22px,2.2vw,31px); line-height: 1.15; letter-spacing: -.035em; }
.alert { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: -4px 0 12px; padding: 9px 12px 9px 15px; border: 1px solid rgba(190,84,70,.2); border-radius: 11px; color: #793d35; background: #fae9e6; font-size: 12px; }
.alert button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 20px; }

.panorama-stage { position: relative; min-height: 420px; height: min(62vh, 720px); overflow: hidden; border-radius: 19px; background: var(--ink); box-shadow: 0 25px 65px rgba(28,35,22,.17); }
.viewer-shell, .viewer-canvas { width: 100%; height: 100%; }
.viewer-shell { position: relative; min-height: 390px; overflow: hidden; background: #10130f; }
.viewer-canvas { position: absolute; inset: 0; }
.viewer-canvas canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.viewer-canvas canvas.dragging { cursor: grabbing; }
.viewer-state { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 10px; color: rgba(255,255,255,.65); background: #11140f; font-size: 12px; }
.viewer-error { color: #efaaa1; }
.viewer-controls { position: absolute; z-index: 4; top: 14px; right: 14px; display: flex; gap: 7px; }
.viewer-controls button { min-height: 34px; padding: 0 11px; border: 1px solid rgba(255,255,255,.14); border-radius: 9px; color: rgba(255,255,255,.8); background: rgba(12,14,12,.56); backdrop-filter: blur(12px); cursor: pointer; font-size: 10px; }
.viewer-controls button:hover, .viewer-controls button.active { color: #18200e; background: var(--lime); border-color: var(--lime); }
.viewer-tip { position: absolute; z-index: 4; left: 50%; bottom: 15px; transform: translateX(-50%); padding: 7px 11px; border-radius: 999px; color: rgba(255,255,255,.62); background: rgba(12,14,12,.48); backdrop-filter: blur(10px); font-size: 10px; pointer-events: none; }

.upload-panel { min-height: 520px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 40px; border: 1px dashed rgba(76,91,57,.23); border-radius: 20px; background: linear-gradient(135deg,rgba(255,255,255,.75),rgba(255,255,255,.37)), radial-gradient(circle at 50% 45%,rgba(145,173,80,.17),transparent 36%); text-align: center; }
.upload-panel h2 { max-width: 680px; margin: 11px 0 9px; font-size: clamp(25px,3vw,40px); line-height: 1.18; letter-spacing: -.045em; }
.upload-panel p { max-width: 650px; margin: 0 0 24px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.sphere-icon { position: relative; width: 106px; height: 106px; display: grid; place-items: center; margin-bottom: 19px; border: 1px solid rgba(77,105,37,.22); border-radius: 50%; color: #455c25; background: rgba(255,255,255,.78); box-shadow: 0 22px 55px rgba(62,76,38,.12), inset 0 0 0 13px rgba(145,173,80,.07); }
.sphere-icon::before, .sphere-icon::after { content: ""; position: absolute; width: 88%; height: 30%; border: 1px solid rgba(72,99,34,.24); border-radius: 50%; }
.sphere-icon::after { transform: rotate(90deg); }
.sphere-icon span { position: relative; z-index: 2; font-size: 16px; }

.room-dock { margin-top: 17px; }
.dock-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 2px; }
.dock-heading strong { font-size: 12px; }
.dock-heading small { color: var(--muted); font-size: 10px; }
.room-list { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 5px; }
.room-card, .add-room-card { position: relative; flex: 0 0 140px; height: 82px; overflow: hidden; border: 2px solid transparent; border-radius: 12px; background: #dfe3da; }
.room-card.active { border-color: var(--green); box-shadow: 0 0 0 2px rgba(145,173,80,.15); }
.room-card > button:first-child { width: 100%; height: 100%; display: block; padding: 0; border: 0; background: transparent; cursor: pointer; }
.room-card img { width: 100%; height: 100%; display: block; object-fit: cover; }
.room-card span { position: absolute; left: 7px; right: 25px; bottom: 6px; overflow: hidden; color: #fff; text-align: left; text-overflow: ellipsis; text-shadow: 0 1px 4px #000; white-space: nowrap; font-size: 10px; font-weight: 700; }
.delete-room { position: absolute; top: 5px; right: 5px; width: 23px; height: 23px; display: grid; place-items: center; padding: 0 0 2px; border: 0; border-radius: 7px; color: #fff; background: rgba(16,20,15,.68); cursor: pointer; opacity: 0; }
.room-card:hover .delete-room, .delete-room:focus-visible { opacity: 1; }
.add-room-card { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; border: 1px dashed rgba(66,84,49,.25); color: #68715e; cursor: pointer; }
.add-room-card b { color: #57712c; font-size: 18px; }
.add-room-card span { font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(10,12,9,.68); backdrop-filter: blur(8px); }
.modal { position: relative; width: min(440px,100%); padding: 35px; border: 1px solid rgba(255,255,255,.66); border-radius: 21px; background: var(--white); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.modal h2 { margin: 9px 0 7px; font-size: 25px; }
.modal p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.modal label { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; color: #4f564a; font-size: 12px; font-weight: 700; }
.modal input { width: 100%; height: 49px; padding: 0 14px; border: 1px solid rgba(44,54,37,.16); border-radius: 11px; color: var(--ink); background: #fff; font-size: 14px; }
.modal-close { position: absolute; top: 15px; right: 15px; width: 32px; height: 32px; border: 0; border-radius: 10px; color: #777e72; background: #ecefe8; cursor: pointer; font-size: 19px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translateX(-50%); padding: 12px 16px; border-radius: 12px; color: #dff0b5; background: #20271b; box-shadow: 0 15px 45px rgba(0,0,0,.25); font-size: 12px; }

.viewer-body { overflow: hidden; }
.share-app { position: fixed; inset: 0; overflow: hidden; color: #fff; background: #10130f; }
.share-viewer, .share-app > .viewer-shell { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 100%; }
.share-header { position: absolute; z-index: 10; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 23px 26px 36px; background: linear-gradient(to bottom,rgba(4,6,4,.74),transparent); pointer-events: none; }
.share-header .brand, .share-header > button { pointer-events: auto; }
.share-header .brand small { margin-bottom: 3px; }
.share-header .brand strong { max-width: min(55vw,560px); }
.share-header > button { min-width: 58px; height: 36px; border: 1px solid rgba(255,255,255,.2); border-radius: 10px; color: #fff; background: rgba(12,14,12,.34); backdrop-filter: blur(10px); cursor: pointer; font-size: 11px; }
.share-room-label { position: absolute; z-index: 8; left: 26px; top: 102px; display: flex; align-items: center; gap: 10px; padding: 10px 13px; border-radius: 10px; background: rgba(11,14,10,.48); backdrop-filter: blur(11px); font-size: 12px; }
.share-room-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(186,217,108,.12); }
.share-nav { position: absolute; z-index: 9; left: 50%; bottom: 61px; width: min(820px,calc(100% - 40px)); display: flex; justify-content: center; gap: 9px; overflow-x: auto; transform: translateX(-50%); padding: 8px; border: 1px solid rgba(255,255,255,.1); border-radius: 15px; background: rgba(10,12,10,.48); backdrop-filter: blur(16px); }
.share-nav button { position: relative; flex: 0 0 118px; height: 68px; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 10px; color: #fff; background: #20251e; cursor: pointer; }
.share-nav button.active { border-color: var(--lime); }
.share-nav img { width: 100%; height: 100%; object-fit: cover; }
.share-nav span { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 5px; overflow: hidden; background: linear-gradient(transparent,rgba(0,0,0,.76)); text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.share-credit { position: absolute; z-index: 8; left: 50%; bottom: 15px; transform: translateX(-50%); color: rgba(255,255,255,.4); white-space: nowrap; font-size: 8px; letter-spacing: .13em; }
.share-fallback { min-height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 30px; color: #fff; background: radial-gradient(circle at 50% 40%,#29331e,#101310 55%); text-align: center; }
.share-fallback h1 { margin: 8px 0 0; font-size: 27px; }
.share-fallback p { margin: 0; color: rgba(255,255,255,.5); font-size: 13px; }

@media (max-width: 900px) {
  .studio-grid { grid-template-columns: 1fr; }
  .sidebar { padding: 13px 14px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .project-list { flex-direction: row; padding-bottom: 2px; }
  .project-row { flex: 0 0 220px; }
  .scan-card { display: none; }
  .workspace { min-height: calc(100vh - 180px); }
}

@media (max-width: 680px) {
  .topbar { height: 62px; padding: 0 12px; }
  .logo-mark { width: 35px; height: 35px; font-size: 17px; }
  .brand strong { font-size: 14px; }
  .topbar .brand small, #previewButton, #logoutButton { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .button { min-height: 35px; padding: 0 10px; font-size: 10px; }
  .sidebar { padding: 10px; }
  .sidebar-heading { padding: 0 2px 8px; }
  .project-row { flex-basis: 190px; grid-template-columns: 46px minmax(0,1fr); }
  .project-thumb { width: 46px; height: 38px; }
  .workspace { padding: 16px 12px 20px; }
  .workspace-title { min-height: 52px; margin-bottom: 11px; }
  .workspace-title h1 { max-width: 55vw; font-size: 19px; }
  .workspace-actions { gap: 5px; }
  .button.subtle { min-height: 35px; padding: 0 9px; font-size: 9px; }
  .panorama-stage, .viewer-shell { min-height: 56vh; height: 56vh; border-radius: 14px; }
  .viewer-controls { top: 9px; right: 9px; }
  .viewer-controls button { min-height: 32px; padding: 0 8px; font-size: 9px; }
  .viewer-tip { display: none; }
  .upload-panel { min-height: 58vh; padding: 28px 20px; border-radius: 15px; }
  .upload-panel h2 { font-size: 25px; }
  .sphere-icon { width: 88px; height: 88px; }
  .room-card, .add-room-card { flex-basis: 112px; height: 68px; }
  .delete-room { opacity: 1; }
  .modal { padding: 28px 21px 22px; }
  .share-header { padding: 15px 14px 32px; }
  .share-header .brand strong { max-width: 53vw; font-size: 13px; }
  .share-header .brand small { font-size: 8px; }
  .share-room-label { top: 77px; left: 14px; font-size: 11px; }
  .share-nav { left: 12px; right: 12px; bottom: 45px; width: auto; justify-content: flex-start; transform: none; border-radius: 13px; }
  .share-nav button { flex-basis: 96px; height: 59px; }
  .share-credit { bottom: 10px; font-size: 7px; }
  .share-app .viewer-controls { top: auto; bottom: 119px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
