/* TV Designer v10: the widget gallery, the widget panel, the grid while dragging (EDITING.md). */

/* previews are drawn by the TV's own renderer: give them the TV's variables, not the designer's */
.wg-prev-in, .add-prev-in { --ink: #fff; --sub: rgba(255, 255, 255, 0.74); --faint: rgba(255, 255, 255, 0.5); --panel: rgba(40, 36, 48, 0.72);
  --rim: rgba(255, 255, 255, 0.14); --solid: #16161b; --paperbg: #f6f2ea; --on: #ffd60a; --focus: #fff; --r: 36px; }
.wg-prev { position: relative; display: block; flex: none; overflow: hidden; border-radius: 6px; pointer-events: none; }
.wg-prev-in { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.wg-prev-in .cd-o { position: relative !important; }

#add-pane.wg { display: flex; flex-direction: column; gap: 12px; }
.wg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wg-chip { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--raise); color: var(--text-2); font-size: 12.5px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.wg-chip:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.wg-chip.on { background: var(--text); color: #111; box-shadow: none; }
.wg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
/* the Add sheet slides in over the left of the canvas: the TV keeps its size (EDITING.md 1) */
@media (min-width: 1000px) { .editor.adding .layers { position: absolute; left: 0; top: 52px; bottom: 0; width: 404px; z-index: 40; box-shadow: 24px 0 48px rgba(0, 0, 0, 0.45); } .editor { position: relative; } }
.wg-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px 10px; border-radius: 12px; background: #24252b;
  box-shadow: inset 0 0 0 1px var(--line); cursor: grab; touch-action: none; transition: transform 0.15s var(--ease), box-shadow 0.15s; min-height: 150px; justify-content: center; }
.wg-card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 24px rgba(0, 0, 0, 0.35); }
.wg-card .wg-prev { background: linear-gradient(160deg, #3a3550, #1d2233); }
.wg-name { font-size: 12.5px; font-weight: 650; color: var(--text); text-align: center; line-height: 1.25; }
.wg-badge { position: absolute; top: 6px; right: 6px; font-size: 10.5px; font-weight: 650; padding: 2px 7px; border-radius: 9px; background: rgba(242, 178, 92, 0.16); color: var(--warn); }
.wg-back { margin-top: 0; align-self: flex-start; }
.wg-title { font-size: 18px; font-weight: 700; color: var(--text); }
.wg-blurb { font-size: 13px; color: var(--text-2); line-height: 1.4; margin-top: -6px; }
.wg-stage { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 220px; padding: 14px 0; border-radius: 12px; background: linear-gradient(160deg, #3a3550, #1d2233); }
.wg-stage .wg-prev { pointer-events: auto; cursor: grab; touch-action: none; }
.wg-arrow { width: 36px; height: 36px; border-radius: 18px; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 22px; line-height: 34px; flex: none; }
.wg-arrow:disabled { opacity: 0.25; }
.wg-dots { display: flex; justify-content: center; gap: 4px; }
.wg-dot { width: 24px; height: 24px; display: grid; place-items: center; }
.wg-dot::after { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--line-2); transition: width 0.2s; }
.wg-dot.on::after { width: 22px; background: var(--text); }
.wg-foot { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.wg-foot b { color: var(--text); }
.wg-fp { display: grid; grid-template-columns: repeat(9, 7px); gap: 2px; flex: none; }
.wg-fp i { width: 7px; height: 7px; border-radius: 2px; background: var(--line-2); }
.wg-fp i.on { background: var(--accent); }
.wg-noroom { font-size: 12.5px; color: var(--warn); line-height: 1.4; }
.wg-add { justify-content: center; }
.wg-ghost { position: absolute; border-radius: 10px; background: rgba(111, 155, 255, 0.18); box-shadow: 0 0 0 2px var(--accent); pointer-events: none; transition: left 0.12s var(--ease), top 0.12s var(--ease); }
body.wg-dragging, body.wg-dragging * { cursor: grabbing !important; }

/* the widget panel */
.wsw .sw { width: 22px; height: 22px; }
.wg-apps { display: flex; flex-wrap: wrap; gap: 6px; }
.wg-app { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: 15px; background: var(--raise); color: var(--text-2); font-size: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.wg-app img, .wg-app svg { width: 22px; height: 22px; border-radius: 6px; }
.wg-app span:only-child { padding-left: 6px; }
.wg-app.on { background: rgba(111, 155, 255, 0.16); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.wg-ctl { display: flex; flex-direction: column; gap: 6px; }
.wg-ctl-row { display: grid; grid-template-columns: 96px 1fr 28px; gap: 6px; align-items: center; }
.wg-strip { display: flex; flex-direction: column; gap: 6px; }
.wg-strip-item { display: grid; grid-template-columns: 1fr 28px 28px; align-items: center; gap: 4px; padding: 6px 6px 6px 10px; border-radius: 8px; background: var(--raise); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.wg-strip-item.on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.wg-strip-item .wg-name { text-align: left; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }

/* the start screen, by room */
.purpose-room { grid-column: 1 / -1; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin: 18px 0 2px; }
.purpose-room:first-child { margin-top: 0; }

/* the selection pulses once after an add */
.sel.pulse { animation: wgpulse 0.9s var(--ease) 1; }
@keyframes wgpulse { 0% { box-shadow: 0 0 0 0 rgba(111, 155, 255, 0.7); } 100% { box-shadow: 0 0 0 18px rgba(111, 155, 255, 0); } }

@media (max-width: 640px) {
  .wg-grid { grid-template-columns: 1fr 1fr; }
  .wg-card { min-height: 132px; }
  .wg-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .wg-chip { flex: none; height: 36px; }
  .wg-dot { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .wg-card, .wg-ghost, .wg-dot::after { transition: none; } .sel.pulse { animation: none; } }

/* the remote path overlay (View, Remote path) */
.rpath { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 30; }
.rpath line { stroke: #6f9bff; stroke-width: 2.5; stroke-linecap: round; opacity: 0.9; }
.rpath circle { fill: #fff; stroke: #6f9bff; stroke-width: 2; }

/* live reflow while dragging: where the others go, and red when one would have no room */
.grid-reflow { position: absolute; pointer-events: none; border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.08); border: 1.5px dashed rgba(255, 255, 255, 0.0); transition: left 200ms var(--ease), top 200ms var(--ease); }
.grid-reflow span { position: absolute; left: 6px; top: 4px; font-size: 11px; font-weight: 650; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.grid-ghost.no { background: rgba(255, 90, 80, 0.18); box-shadow: inset 0 0 0 2px #ff6a5a; }
.sel-tag.no-tag { background: #ff6a5a; color: #2a0702; }

/* the mini toolbar over a selected widget, and its size menu (EDITING.md 2 and 4) */
.wtb { position: absolute; left: 50%; bottom: calc(100% + 30px); transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: #1c1d22; box-shadow: 0 0 0 1px var(--line-2), 0 12px 30px rgba(0, 0, 0, 0.5); z-index: 12; pointer-events: auto; white-space: nowrap; }
.wtb.below { bottom: auto; top: calc(100% + 12px); }
.wtb-b { height: 30px; padding: 0 10px; border-radius: 8px; color: var(--text); font-size: 12.5px; font-weight: 600; }
.wtb-b:hover { background: var(--raise); }
.wtb-b.on { background: rgba(111, 155, 255, 0.18); color: #fff; }
.wtb-b:last-child { color: #ff9a8a; }
.wsize { position: fixed; z-index: 90; width: 300px; max-height: 70vh; overflow: auto; padding: 6px; border-radius: 12px; background: #1c1d22; box-shadow: 0 0 0 1px var(--line-2), 0 20px 50px rgba(0, 0, 0, 0.55); }
.wsize-i { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.wsize-i:hover { background: var(--raise); }
.wsize-i.on { box-shadow: inset 0 0 0 1.5px var(--accent); }
.wsize-i.no { opacity: 0.55; }
.wsize-n { display: flex; flex-direction: column; font-size: 13px; color: var(--text); }
.wsize-n em { font-style: normal; font-size: 12px; color: var(--text-2); }
.wsize-i.no .wsize-n em { color: var(--warn); }
.wg-swaphead { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--text); }
.wg-swaphead .link-btn { margin-top: 0; }
.wg-card.is-current { box-shadow: inset 0 0 0 2px var(--accent); }
/* phone: the toolbar sits low, in thumb reach, not over the TV (fingers cover it) */
.wtb-dock { position: fixed; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom, 0px) + 66px); z-index: 70; pointer-events: none; }
.wtb.docked { position: static; transform: none; justify-content: space-between; overflow-x: auto; pointer-events: auto; }
.wtb.docked .wtb-b { height: 44px; min-width: 44px; flex: 1 0 auto; }
.size-pic.v2 { overflow: hidden; }
.size-pic.v2 i { width: calc((52px / 18) * var(--w)); height: calc((30px / 10) * var(--h)); }
.size-why { font-style: normal; color: var(--warn); }
.start-step .opt { font-style: normal; font-size: 12px; font-weight: 600; color: var(--text-3); margin-left: 6px; }
#tvpick { margin-top: 28px; }
.editor.remote .overlay > .rpath { display: block; }
.grid-ghost.swap { background: rgba(111, 155, 255, 0.28); box-shadow: inset 0 0 0 3px #6f9bff, 0 0 0 4px rgba(111, 155, 255, 0.3); }
.sel-tag.swap-tag { background: #6f9bff; color: #0b1430; }
.sel-box.tag-in > .sel-tag { top: 4px; left: 4px; }
.wsize-n em { font-size: 12.5px; }
