/* Sculpted Spatial Browser Windows */
#winLayer { position: fixed; inset: 0; pointer-events: none; z-index: 30; }

.os-win {
  position: fixed; pointer-events: auto; display: flex; flex-direction: column;
  background: var(--surface); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--line); border-radius: 1.2rem; box-shadow: var(--sh); overflow: hidden;
  min-width: 340px; min-height: 260px; contain: layout style;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.os-win[hidden] { display: none !important; }
.os-win.focused { box-shadow: var(--sh2); border-color: var(--rim); }
.os-win.dragging .os-webview { pointer-events: none; }

/* Unified Single-Row Chrome */
.win-bar {
  height: 2.85rem; padding: 0 0.7rem; display: flex; align-items: center; gap: 0.45rem;
  background: var(--glass-hi); border-bottom: 1px solid var(--line); user-select: none; cursor: grab; flex-shrink: 0;
}
.win-dots { display: flex; gap: 0.45rem; margin-right: 0.25rem; flex-shrink: 0; position: relative; z-index: 5; }
.dot {
  width: 0.9rem; height: 0.9rem; border-radius: 50%; border: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.62rem; font-weight: 900; line-height: 1; color: transparent; transition: transform .15s, color .12s;
}
.win-dots:hover .dot { color: rgba(0, 0, 0, 0.72); }
.dot:hover { transform: scale(1.16); }
.d-close { background: #ff5f57; } .d-min { background: #febc2e; } .d-max { background: #28c840; }

.win-title { display: flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 0.86rem; min-width: 0; flex: 1; }
.win-ico, .a-ico, .spot-ico {
  width: 1.55rem; height: 1.55rem; border-radius: 0.48rem; color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.82rem;
}
.win-title-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-group { display: flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }
.nav-btn, .win-act {
  width: 1.78rem; height: 1.78rem; border-radius: 0.5rem; border: 0; background: transparent;
  color: var(--sub); font-size: 0.88rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s;
}
.nav-btn:hover, .win-act:hover { background: var(--surface2); color: var(--txt); }
.url-form { flex: 1; min-width: 120px; }
.url-inp {
  width: 100%; height: 1.92rem; padding: 0 0.85rem; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface2); color: var(--txt); font-size: 0.82rem;
  transition: border-color .18s, background .18s;
}
.url-inp:focus { border-color: var(--brand); background: var(--surface-solid); outline: none; }

.load-bar { height: 2px; background: transparent; overflow: hidden; flex-shrink: 0; }
.load-bar span {
  display: block; width: 32%; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--ok)); opacity: 0; transform: translateX(-100%);
}
.load-bar.loading span { opacity: 1; animation: osLoad 1.05s infinite ease-in-out; }
@keyframes osLoad { 0% { transform: translateX(-100%); } 100% { transform: translateX(360%); } }

.win-body { flex: 1; min-height: 0; overflow: auto; position: relative; }
.win-body.is-browser { display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.os-webview { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.win-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }

/* Spotlight Command Palette */
.spot-box {
  width: min(580px, 100%); background: var(--glass-hi); border: 1px solid var(--rim);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-radius: 1.35rem; box-shadow: var(--sh2); overflow: hidden;
}
.spot-head { display: flex; align-items: center; gap: 0.65rem; padding: 0.95rem 1.15rem; border-bottom: 1px solid var(--line); }
.spot-head input { flex: 1; border: 0; background: transparent; font-size: 1.02rem; outline: none; }
.spot-list { max-height: 56vh; overflow: auto; padding: 0.45rem; display: flex; flex-direction: column; gap: 0.22rem; }
.spot-row {
  display: flex; align-items: center; gap: 0.78rem; width: 100%; text-align: left;
  padding: 0.62rem 0.8rem; border: 0; border-radius: 0.8rem; background: transparent;
}
.spot-row:hover { background: var(--surface2); }
.spot-txt { display: flex; flex-direction: column; min-width: 0; }
.spot-txt strong { font-size: 0.92rem; }
.spot-txt span { font-size: 0.78rem; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Native Mini-App Interiors */
.n-pad { padding: 1.1rem 1.2rem; }
.n-lead { margin: 0 0 0.9rem; font-size: 0.86rem; color: var(--sub); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 0.65rem; }
.app-card {
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
  padding: 0.6rem 0.7rem; border-radius: 0.9rem; background: var(--surface2); border: 1px solid var(--line);
}
.app-launch { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 0; }
.a-meta { display: flex; flex-direction: column; min-width: 0; }
.a-meta strong { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-meta span { font-size: 0.75rem; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-btn { flex-shrink: 0; font-size: 0.72rem; padding: 0.24rem 0.55rem; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--sub); }
.pin-btn.on { background: var(--brand); color: #fff; border-color: transparent; font-weight: 700; }

.add-app { margin-top: 1.15rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.add-app h3, .set-sec h3 { margin: 0 0 0.55rem; font-size: 0.94rem; }
.add-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 0.45rem; }
.add-row input, .add-row select { padding: 0.48rem 0.68rem; border-radius: 0.6rem; border: 1px solid var(--line); background: var(--surface2); font-size: 0.85rem; min-width: 0; }

.snd-presets { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.snd-list { display: flex; flex-direction: column; gap: 0.6rem; }
.snd-row { display: grid; grid-template-columns: 1.2fr 1.2fr 3rem; align-items: center; gap: 0.6rem; padding: 0.72rem 0.9rem; border-radius: 0.85rem; background: var(--surface2); border: 1px solid var(--line); }
.snd-row div { display: flex; flex-direction: column; }
.snd-row span { font-size: 0.76rem; color: var(--sub); }
.snd-row input[type=range] { width: 100%; accent-color: var(--brand); }
.snd-val { text-align: right; font-weight: 700; font-size: 0.85rem; }

.note-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; font-size: 0.84rem; color: var(--sub); }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: 0.7rem; }
.sticky { border-radius: 0.9rem; padding: 0.8rem; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.4rem; }
.sticky.c-amber { background: rgba(245, 158, 11, 0.14); }
.sticky.c-mint { background: rgba(16, 185, 129, 0.14); }
.sticky.c-sky { background: rgba(59, 130, 246, 0.14); }
.sticky.c-rose { background: rgba(244, 63, 94, 0.14); }
.st-top { display: flex; align-items: center; gap: 0.3rem; }
.st-title { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 700; font-size: 0.9rem; }
.st-body { width: 100%; border: 0; background: transparent; resize: vertical; font-size: 0.85rem; line-height: 1.48; }

.calc-wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.calc-expr { width: 100%; padding: 0.6rem 0.85rem; border-radius: 0.7rem; border: 1px solid var(--line); background: var(--surface2); font-size: 1.05rem; text-align: right; }
.calc-res { font-size: 1.75rem; font-weight: 800; text-align: right; padding: 0.15rem 0.3rem; color: var(--brand2); }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.42rem; }
.c-key { padding: 0.75rem 0; border-radius: 0.7rem; border: 1px solid var(--line); background: var(--surface2); font-weight: 700; font-size: 1rem; }
.c-key.eq { background: var(--brand); color: #fff; border-color: transparent; }
.calc-hist { font-size: 0.78rem; color: var(--sub); border-top: 1px dashed var(--line); padding-top: 0.5rem; text-align: right; }

.set-wrap { display: flex; flex-direction: column; gap: 0.95rem; }
.set-sec { padding: 0.95rem 1.05rem; border-radius: 0.95rem; background: var(--surface2); border: 1px solid var(--line); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.guide-list { margin: 0; padding-left: 1.2rem; font-size: 0.86rem; display: flex; flex-direction: column; gap: 0.35rem; }
.ver-info { margin: 0.7rem 0 0; font-size: 0.78rem; color: var(--sub); }
.danger-zone { border-style: dashed; }
