/* =========================================================================
   AEstAR panorama — tour builder (create/). Uses tokens from styles.css.
   ========================================================================= */
.builder { background: var(--bg-soft); }
.builder .nav { position: sticky; }
.builder__cta { display: flex !important; }
.builder .nav__cta .btn--ghost { display: inline-flex; }
.builder__cta .btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 1060px) { .builder .nav__cta { display: flex !important; } .builder .lang--mobile { display: none; } }
@media (max-width: 420px) { .builder__cta .btn span { display: none; } .builder__cta .btn { padding: 0 12px; } }

.builder__main { padding: 48px 0 96px; }
.builder__head { max-width: 820px; margin-bottom: 32px; }
.builder__head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -.03em; }
.builder__lead { margin-top: 14px; color: var(--muted); font-size: 1.05rem; }

.srv-banner code { display: block; margin-top: 8px; font: 500 .82rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #7c2d12; word-break: break-word; }
.srv-banner { margin-bottom: 20px; padding: 14px 18px; border-radius: 14px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-weight: 500; font-size: .95rem; }

.bgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.panel { background: #fff; border-radius: 22px; padding: 28px; box-shadow: var(--shadow-sm); min-width: 0; }
.panel + .panel, .created { margin-top: 20px; }
.panel__title { display: flex; align-items: center; gap: 12px; font-size: 1.25rem; margin-bottom: 18px; }
.panel__num { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: .9rem; font-weight: 700; flex: none; box-shadow: 0 6px 14px -6px rgba(79,70,229,.7); }
@media (max-width: 560px) { .panel { padding: 20px 16px; border-radius: 18px; } }

/* 1. upload */
.vdrop { border: 2px dashed #cbd5e1; border-radius: 18px; padding: 34px 16px; text-align: center; color: var(--muted); cursor: pointer; transition: background .2s, border-color .2s; display: grid; justify-items: center; gap: 6px; }
.vdrop:hover, .vdrop.over, .vdrop:focus-visible { background: var(--accent-soft); border-color: var(--accent); outline: none; }
.vdrop__icon { width: 56px; height: 56px; border-radius: 16px; background: var(--grad); display: grid; place-items: center; margin-bottom: 6px; box-shadow: 0 10px 24px -10px rgba(124,58,237,.8); }
.vdrop__icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vdrop b { color: var(--ink); font-size: 1.05rem; }
.vdrop span { font-size: .9rem; }
.brow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
#status { margin-top: 14px; font-size: .95rem; font-weight: 600; min-height: 1.4em; }
#status.ok { color: #047857; } #status.err { color: #be123c; }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.bar.busy i { width: 40%; animation: bslide 1.2s infinite ease-in-out; }
.bar.prog i { animation: none; }
@keyframes bslide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.flist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 14px; }
.fitem { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.fitem img { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; display: block; background: var(--line-2); }
.fitem span { display: block; font-size: .78rem; padding: 6px 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fitem span b { color: var(--ink); font-weight: 600; }
.fitem button { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: rgba(11,13,20,.7); color: #fff; font-size: .75rem; }
.fitem.bad { border-color: #fb7185; }
.howto { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: center; margin-top: 20px; background: var(--bg-soft); border-radius: 16px; padding: 16px 18px; }
.howto ol { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--muted); display: grid; gap: 6px; }
.howto ol b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .howto { grid-template-columns: 1fr; } .howto svg { max-width: 96px; } }
.tip { font-size: .85rem; color: var(--muted); margin-top: 14px; }
details.srv { margin-top: 16px; font-size: .88rem; color: var(--muted); }
details.srv summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
details.srv input { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }

/* 2. viewer */
.tour-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tour-bar .btn.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tour-hint { font-size: .88rem; color: var(--muted); flex: 1; min-width: 200px; }
#nameRow { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
#nameRow input { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; min-width: 180px; }
#nameRow input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
#viewerBox { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 72vh; min-height: 300px; border-radius: 18px; overflow: hidden; background: #1a1c25; }
#viewer { position: absolute; inset: 0; }
#viewer .pnlm-container { background: #1a1c25; font-family: var(--sans); }
#viewer .pnlm-panorama-info { background: rgba(11,13,20,.6) !important; border-radius: 0 12px 0 0; backdrop-filter: blur(10px); }
#viewer .pnlm-title-box { font-family: var(--sans) !important; font-size: .95rem !important; font-weight: 600; }
#viewer .pnlm-controls-container { top: 14px; left: auto; right: 14px; }
#viewer .pnlm-controls { background: rgba(255,255,255,.92); border: 0; border-radius: 12px; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: rgba(255,255,255,.55); font-size: .95rem; text-align: center; padding: 20px; }
.empty svg { width: 56px; height: 56px; opacity: .8; }
.meta { font-size: .85rem; color: var(--muted); margin-top: 12px; }
.meta a { color: var(--accent); font-weight: 600; }
#viewerBox.editing .pnlm-dragfix, #viewerBox.editing .pnlm-ui { cursor: crosshair !important; }

.pnlm-hotspot-base.hs-go { width: 64px; height: 64px; margin: 0; background: none; border: 0; cursor: pointer; }
.hs-go .hs-arrow { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .2s var(--ease); filter: drop-shadow(0 6px 14px rgba(79,70,229,.55)); }
.hs-go .hs-arrow svg { width: 54px; height: 54px; overflow: visible; }
.hs-go .hs-arrow path { fill: rgba(99,102,241,.55); stroke: #fff; stroke-width: 3.2; stroke-linejoin: round; transition: fill .2s; }
.hs-go:hover .hs-arrow { transform: scale(1.12); }
.hs-go:hover .hs-arrow path { fill: rgba(124,58,237,.9); }
.hs-go .hs-label { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); white-space: nowrap; background: rgba(11,13,20,.75); color: #fff; font: 600 12px var(--sans); padding: 5px 11px; border-radius: 999px; opacity: 0; transition: opacity .15s; pointer-events: none; backdrop-filter: blur(8px); }
.hs-go:hover .hs-label, #viewerBox.editing .hs-go .hs-label { opacity: 1; }
#viewerBox.editing .hs-go .hs-arrow path { stroke-dasharray: 6 4; }
#viewerBox.editing .hs-go.moving .hs-arrow { opacity: .35; }

.hs-editor { position: absolute; z-index: 5; width: 290px; max-width: calc(100% - 20px); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 16px; font-size: .88rem; color: var(--ink); }
.hs-editor h3 { margin: 0 0 10px; font-size: 1rem; }
.hs-editor label { display: block; margin: 10px 0 5px; color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.hs-editor select, .hs-editor input[type=text] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; color: var(--ink); background: #fff; }
.hs-editor .brow { margin-top: 14px; gap: 8px; }
.hs-editor .brow--links { margin-top: 10px; justify-content: space-between; }
.hs-editor .warn { color: #be123c; margin: 6px 0 0; }
.icon-pick { display: flex; gap: 6px; }
.icon-pick button { width: 46px; height: 42px; border-radius: 10px; background: #1a1c25; display: grid; place-items: center; border: 2px solid transparent; }
.icon-pick button svg { width: 26px; height: 26px; }
.icon-pick button svg path { fill: rgba(255,255,255,.15); stroke: #fff; stroke-width: 4; stroke-linejoin: round; }
.icon-pick button.on { border-color: var(--accent); background: var(--accent); }
.lnk { color: var(--accent); font-weight: 600; font-size: .88rem; }
.lnk--del { color: #be123c; }
.lnk.ask { background: #be123c; color: #fff; padding: 4px 10px; border-radius: 999px; }
.hs-list { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; font-size: .85rem; color: var(--muted); }
.hs-list button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px 4px 5px; font-weight: 600; font-size: .82rem; color: var(--ink); transition: border-color .2s; }
.hs-list button:hover { border-color: var(--accent); }
.hs-list button svg { width: 22px; height: 22px; background: var(--grad); border-radius: 50%; padding: 3px; }
.hs-list button svg path { fill: none; stroke: #fff; stroke-width: 5; stroke-linejoin: round; }

/* 3. uploaded panoramas */
.created-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.created-head .panel__title { margin-bottom: 16px; }
.created-head > span { font-size: .88rem; color: var(--muted); font-weight: 600; }
.created-empty { color: var(--muted); font-size: .95rem; margin: 0; }
.created-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pcard { position: relative; border: 2px solid transparent; border-radius: 16px; overflow: hidden; background: var(--bg-soft); cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s, border-color .2s; }
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard.on { border-color: var(--accent); }
.pcard img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: cover; background: var(--line-2); }
.pcard .pinfo { padding: 10px 12px 12px; font-size: .8rem; color: var(--muted); }
.pname-row { display: flex; align-items: center; gap: 6px; }
.pcard .pname { display: block; color: var(--ink); font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .plinks { color: var(--accent); font-weight: 700; }
.pren { color: var(--muted); font-size: .85rem; padding: 0 2px; }
.pren:hover { color: var(--accent); }
.pname-in { width: 100%; padding: 4px 8px; border: 1px solid var(--accent); border-radius: 8px; font: 600 .88rem var(--sans); color: var(--ink); outline: none; }
.pdel { position: absolute; top: 8px; right: 8px; height: 30px; min-width: 30px; padding: 0 10px; border-radius: 999px; background: rgba(11,13,20,.65); color: #fff; font-size: .78rem; font-weight: 600; backdrop-filter: blur(6px); }
.pdel:hover { background: rgba(11,13,20,.85); }
.pdel.ask { background: #be123c; }

/* 4. tours & publishing */
.wt-intro { font-size: .95rem; color: var(--muted); margin: -4px 0 18px; max-width: 860px; }
.wt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 18px; }
.wt-list .created-empty { grid-column: 1 / -1; }
.wt-card { border: 2px solid transparent; border-radius: 18px; overflow: hidden; background: var(--bg-soft); display: flex; flex-direction: column; transition: border-color .2s; }
.wt-card.on { border-color: var(--accent); }
.wt-cov { position: relative; }
.wt-cov img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; display: block; background: var(--line-2); }
.wt-cov .wt-badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.wt-cov .badge { position: static; }
.wt-b { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.wt-b b { font-size: 1.05rem; }
.wt-price { font-weight: 700; font-size: 1.15rem; letter-spacing: -.02em; }
.wt-d { font-size: .85rem; color: var(--muted); }
.wt-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 10px; }
.wt-acts .lnk--del { margin-left: auto; }
.wt-editor { border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin-top: 4px; background: #fff; box-shadow: var(--shadow); }
.wt-editor h3 { margin: 0 0 16px; font-size: 1.2rem; }
.wt-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.wt-form .wt-wide { grid-column: span 2; }
@media (max-width: 900px) { .wt-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .wt-form { grid-template-columns: 1fr; } .wt-form .wt-wide { grid-column: auto; } .wt-editor { padding: 18px 14px; } }
.wt-form textarea { min-height: 50px; }
.wt-form .wt-wide:nth-child(2) { grid-row: span 1; }
.wt-label { margin: 20px 0 8px; font-weight: 600; font-size: .95rem; }
.wt-label span { font-weight: 400; color: var(--muted); font-size: .85rem; }
.wt-scenes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.wt-sc { position: relative; border: 2px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; cursor: pointer; user-select: none; transition: border-color .2s; }
.wt-sc.sel { border-color: var(--accent); }
.wt-sc img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; display: block; opacity: .5; transition: opacity .2s; }
.wt-sc.sel img { opacity: 1; }
.wt-sc .nm { display: flex; align-items: center; gap: 6px; padding: 7px 9px; font-size: .8rem; font-weight: 600; }
.wt-sc .nm input { margin: 0; accent-color: var(--accent); }
.wt-sc .nm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.wt-sc .lk { font-weight: 500; color: var(--accent); font-size: .75rem; flex: none !important; }
.wt-sc .st { position: absolute; top: 7px; right: 7px; border-radius: 999px; padding: 3px 10px; font-size: .72rem; font-weight: 700; background: rgba(11,13,20,.65); color: #fff; }
.wt-sc .st.on { background: var(--grad); }
.wt-sc.unreach { border-color: #f59e0b; }
.wt-sc .warnb { position: absolute; top: 7px; left: 7px; background: #f59e0b; color: #fff; border-radius: 999px; padding: 2px 8px; font-size: .7rem; font-weight: 700; }
.wt-info { font-size: .85rem; color: var(--muted); margin-top: 12px; }
.wt-info b { color: var(--ink); }
.wt-info .bad { color: #b45309; font-weight: 700; }
.wt-pub { margin-top: 18px; display: inline-flex; }

/* toast: error variant */
.toast.is-err::before { background: #fb7185; }

/* ---------- вибір фото для туру ---------- */
.panel__num--opt { background: var(--bg-soft); color: var(--muted); box-shadow: none; }
.opt-chip { margin-left: 10px; padding: 2px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); font-size: .75rem; font-weight: 600; vertical-align: middle; }
.sel-bar { position: sticky; top: 84px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 16px; padding: 12px 14px; border-radius: 16px; background: #eef2ff; border: 1px solid #c7d2fe; }
.sel-count { color: var(--ink-2); font-size: .92rem; }
.sel-bar .btn[disabled] { opacity: .45; cursor: default; box-shadow: none; }
.pcard.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.psel { position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 30px; cursor: pointer; }
.psel input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.psel span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.92); border: 2px solid rgba(11,13,20,.25); box-shadow: 0 2px 8px rgba(0,0,0,.15); transition: background .15s, border-color .15s; }
.psel input:checked + span { background: var(--accent); border-color: var(--accent); }
.psel input:checked + span::after { content: ''; width: 9px; height: 15px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.psel input:focus-visible + span { outline: 3px solid #a5b4fc; outline-offset: 2px; }
.pin-tours { position: absolute; left: 46px; top: 12px; z-index: 1; padding: 2px 9px; border-radius: 999px; background: rgba(11,13,20,.65); color: #fff; font-size: .72rem; font-weight: 600; backdrop-filter: blur(6px); }
.wt-sc .ord { position: absolute; top: 7px; left: 7px; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700; }

/* ---------- без збільшення + телефон ---------- */
#viewer, #viewer .pnlm-container { touch-action: none; }           /* жести — лише поворот огляду, сторінка не масштабується */
.icon-pick button { cursor: default; }
@media (max-width: 760px) {
  #viewerBox { aspect-ratio: 4 / 5; max-height: 70vh; min-height: 320px; }
  .sel-bar { top: 66px; padding: 10px 12px; gap: 8px 12px; }
  .sel-bar .btn { width: 100%; justify-content: center; order: 3; }
  .created-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .pinfo { padding: 8px 10px 10px; }
  .wt-list { grid-template-columns: 1fr; }
  /* редактор стрілки — нижня шторка на весь екран по ширині */
  .hs-editor { position: fixed; left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-width: none; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); z-index: 60; box-shadow: 0 -10px 40px rgba(11,13,20,.25); }
  .tour-bar { gap: 8px; }
  .tour-bar .tour-hint { flex-basis: 100%; font-size: .85rem; }
}
@media (max-width: 480px) {
  .builder__head h1 { font-size: 2rem; }
  .builder__lead { font-size: .95rem; }
  .tabs { width: 100%; } .tabs button { flex: 1; justify-content: center; padding: 0 10px; }
  .admin-user { display: none; }
}
@media (max-width: 480px) {
  .builder .logo__text { display: none; }
  .builder__cta { gap: 6px; }
  .builder__cta .lang button { padding: 0 9px; }
}
