/* ==========================================================================
   Editor (studio) layout & components
   ========================================================================== */
.studio { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: relative; z-index: 50; flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
  padding: 12px clamp(12px, 2vw, 22px); border-bottom: 1px solid var(--border);
  background: rgba(14, 9, 18, 0.72); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); text-decoration: none; }
.brand__logo { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 14px; background: var(--grad); font-size: 22px; box-shadow: var(--shadow-glow); }
.brand__text { display: grid; min-width: 0; }
.brand__title { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* -------------------------------------------------------------- workspace */
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(320px, 360px) minmax(0, 1fr) minmax(340px, 384px); }
.panel { min-height: 0; display: flex; flex-direction: column; background: rgba(16, 10, 20, 0.5); }
.panel--left { border-right: 1px solid var(--border); }
.panel--right { border-left: 1px solid var(--border); }
.panel__scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.panel__scroll::-webkit-scrollbar { width: 8px; }
.panel__scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }
.panel-tabs { flex: none; display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--border); }
.panel-tabs__btn { flex: 1; -webkit-appearance: none; appearance: none; border: 0; background: transparent; color: var(--text-3); padding: 10px 6px 12px; font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.3s var(--ease); }
.panel-tabs__btn:hover { color: var(--text); }
.panel-tabs__btn[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.rpanel { display: none; }
.studio[data-rtab="design"] #panel-design, .studio[data-rtab="music"] #panel-music, .studio[data-rtab="video"] #panel-video { display: block; }

.privacy { margin: 16px 4px 4px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(95, 211, 161, 0.08); border: 1px solid rgba(95, 211, 161, 0.2); color: #b8f0d6; font-size: 12.5px; text-align: center; }

/* ------------------------------------------------------------------ photo */
.dropzone {
  display: grid; justify-items: center; gap: 4px; padding: 26px 16px; margin-bottom: 14px; border-radius: var(--radius);
  border: 1.5px dashed rgba(var(--accent-rgb), 0.45); background: radial-gradient(120% 120% at 50% 0%, rgba(var(--accent-rgb), 0.12), transparent 70%), rgba(0, 0, 0, 0.18);
  text-align: center; cursor: pointer; transition: border-color 0.25s, background 0.25s, transform 0.3s var(--ease-spring);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); transform: translateY(-2px); outline: none; }
.dropzone.is-drag { border-style: solid; border-color: var(--accent); background: rgba(var(--accent-rgb), 0.18); transform: scale(1.01); }
.dropzone__icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 6px; border-radius: 18px; background: var(--grad); font-size: 26px; box-shadow: var(--shadow-glow); }
.dropzone__title { font-weight: 600; font-size: 15px; }
.dropzone__types { font-size: 11.5px; letter-spacing: 0.14em; color: var(--text-2); }
.dropzone__hint { font-size: 12px; color: var(--text-3); }
.dropzone--compact { grid-template-columns: auto 1fr; justify-items: start; text-align: left; padding: 12px 14px; column-gap: 12px; }
.dropzone--compact .dropzone__icon { grid-row: span 3; width: 42px; height: 42px; font-size: 20px; margin: 0; }

.photo-editor { margin-bottom: 14px; }
.photo-stage-wrap { display: grid; justify-items: center; padding: 18px 12px 12px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border); margin-bottom: 12px; }
.photo-stage { position: relative; width: min(220px, 70%); aspect-ratio: 1; overflow: hidden; border-radius: 50%; cursor: grab; touch-action: none; background: #1d1422; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12), 0 18px 40px -16px rgba(0, 0, 0, 0.8), 0 0 40px -10px rgba(var(--accent-rgb), 0.6); transition: border-radius 0.4s var(--ease), aspect-ratio 0.4s var(--ease); }
.photo-stage:active { cursor: grabbing; }
.photo-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.photo-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.photo-stage__grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.2s; background-image: linear-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px); background-size: 33.33% 33.33%; background-position: -1px -1px; }
.photo-stage.is-dragging .photo-stage__grid { opacity: 1; }
.photo-stage.shape-rounded { aspect-ratio: 4 / 5; border-radius: 22px; width: min(190px, 62%); }
.photo-stage.shape-polaroid { border-radius: 3px; box-shadow: 0 0 0 9px #fffdf9, 0 0 0 9px #fffdf9, 0 34px 0 9px #fffdf9, 0 30px 50px -10px rgba(0, 0, 0, 0.8); width: min(190px, 60%); margin-bottom: 30px; transform: rotate(-2deg); }
.photo-stage.shape-heart { border-radius: 0; box-shadow: none; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92' preserveAspectRatio='none'%3E%3Cpath d='M50 92C35 76 0 56 0 30C0 11 16 0 30 0C41 0 48 6 50 15C52 6 59 0 70 0C84 0 100 11 100 30C100 56 65 76 50 92Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 92' preserveAspectRatio='none'%3E%3Cpath d='M50 92C35 76 0 56 0 30C0 11 16 0 30 0C41 0 48 6 50 15C52 6 59 0 70 0C84 0 100 11 100 30C100 56 65 76 50 92Z'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.photo-stage.shape-full { aspect-ratio: 3 / 4; border-radius: 12px; width: min(180px, 58%); }
.hint--top { margin: -6px 0 12px; }
.gallery-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: mem; }
.gallery-list:empty { display: none; }
.gitem { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "thumb act" "cap cap"; gap: 10px 12px; padding: 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); transition: border-color .2s; }
.gitem:focus-within { border-color: rgba(var(--accent-rgb), 0.55); }
.gitem__thumb { grid-area: thumb; position: relative; width: 64px; height: 80px; border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, 0.3); }
.gitem__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gitem__num { position: absolute; left: 6px; top: 6px; min-width: 22px; padding: 2px 6px; border-radius: 999px; background: rgba(14, 9, 18, 0.75); font-size: 11px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.gitem__body { display: contents; }
.gitem__caption { grid-area: cap; min-height: 64px; padding: 8px 10px; font-size: 13px; resize: vertical; line-height: 1.45; }
.gitem__actions { grid-area: act; display: flex; gap: 6px; justify-content: flex-end; align-self: start; }
.gitem__actions .icon-btn { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.gitem__actions .icon-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.gitem__actions .icon-btn--danger:hover { background: rgba(255, 107, 129, 0.2); color: #ffb3c0; }
.slider-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.shape-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.shape-grid button { display: grid; justify-items: center; gap: 6px; padding: 10px 2px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 11px; transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.25s var(--ease-spring); }
.shape-grid button:hover { transform: translateY(-2px); color: var(--text); }
.shape-grid button[aria-checked="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); color: var(--text); }
.shape-ico { display: block; width: 24px; height: 24px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-style: normal; }
.shape-ico--circle { border-radius: 50%; }
.shape-ico--rounded { border-radius: 7px; width: 20px; height: 25px; }
.shape-ico--polaroid { border-radius: 2px; box-shadow: 0 0 0 3px #fff, 0 6px 0 3px #fff; width: 18px; height: 16px; margin-bottom: 6px; }
.shape-ico--heart { background: none; color: var(--accent); font-size: 25px; line-height: 24px; text-align: center; }
.shape-ico--full { border-radius: 4px; width: 26px; height: 20px; }

/* ------------------------------------------------------------------ stage */
.stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; outline: none; }
.stage__bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.stage__bar-left, .stage__bar-right { display: flex; align-items: center; gap: 8px; }
.studio[data-view="greeting"] [data-show-view="video"], .studio[data-view="video"] [data-show-view="greeting"] { display: none !important; }
.stage__view { position: relative; flex: 1; min-height: 0; }
.device-wrap { position: absolute; inset: 0 12px 16px; display: grid; place-items: center; overflow: hidden; }
.device { position: relative; flex: none; border-radius: 18px; background: #0b070d; border: 1px solid var(--border-strong); box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.03), 0 0 120px -50px rgba(var(--accent-rgb), 0.45); transform-origin: center center; transition: border-radius 0.4s var(--ease); }
.device__chrome { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.device__chrome i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.device__chrome i:nth-child(2) { background: #febc2e; }
.device__chrome i:nth-child(3) { background: #28c840; }
.device__chrome span { margin-left: 10px; padding: 3px 14px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); font-size: 11px; color: var(--text-3); }
.device__notch { display: none; }
.device__screen { position: relative; overflow: hidden; border-radius: 0 0 17px 17px; background: #000; }
.device__screen iframe { display: block; border: 0; background: #000; transform-origin: 0 0; }
.device--tablet { border-radius: 30px; padding: 16px; }
.device--tablet .device__chrome { display: none; }
.device--tablet .device__screen { border-radius: 16px; }
.device--mobile { border-radius: 46px; padding: 12px; background: linear-gradient(160deg, #2a1d31, #0c080e); }
.device--mobile .device__chrome { display: none; }
.device--mobile .device__notch { display: block; position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: 96px; height: 26px; border-radius: 20px; background: #000; z-index: 3; }
.device--mobile .device__screen { border-radius: 36px; }
.stage__exit-fs { position: fixed; top: 14px; right: 14px; z-index: 30; }
#greetingStage.is-fs { position: fixed; inset: 0; z-index: 900; background: #000; }
#greetingStage.is-fs .device-wrap { inset: 0; }
#greetingStage.is-fs .device { border: 0; border-radius: 0; padding: 0; box-shadow: none; background: #000; }
#greetingStage.is-fs .device__chrome, #greetingStage.is-fs .device__notch { display: none; }
#greetingStage.is-fs .device__screen { border-radius: 0; }

/* video player */
.stage__view--video { display: flex; flex-direction: column; gap: 14px; padding: 0 16px 16px; overflow-y: auto; }
.vplayer { flex: 1; min-height: 260px; display: flex; flex-direction: column; gap: 10px; }
.vplayer__screen { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; border-radius: var(--radius-lg); background: repeating-conic-gradient(rgba(255, 255, 255, 0.02) 0 25%, transparent 0 50%) 0 0 / 22px 22px, rgba(0, 0, 0, 0.3); border: 1px solid var(--border); overflow: hidden; }
.vplayer__screen canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: none; border-radius: 14px; cursor: pointer; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06); background: #000; }
.vplayer__big { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 74px; height: 74px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(14, 9, 18, 0.55); color: #fff; font-size: 26px; padding-left: 5px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.8); transition: transform 0.3s var(--ease-spring), opacity 0.3s; }
.vplayer__big:hover { transform: translate(-50%, -50%) scale(1.08); }
.vplayer.is-playing .vplayer__big { opacity: 0; pointer-events: none; }
.vplayer__screen:fullscreen { background: #000; border-radius: 0; }
.vplayer__screen:fullscreen canvas { border-radius: 0; }
.vplayer__controls { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.vplayer__time { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 84px; }
.vplayer__scrub { flex: 1; min-width: 80px; }
.vplayer__vol { display: flex; align-items: center; gap: 6px; width: 120px; }

/* timeline */
.timeline-card { flex: none; padding: 14px 16px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.timeline-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.timeline-card__head h3 { margin: 0; font-size: 14px; }
.timeline-card__head .hint { margin: 0; }
.tl { position: relative; --tl-wave: #c79bff; user-select: none; }
.tl__ruler { position: relative; height: 18px; margin-bottom: 4px; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; cursor: pointer; }
.tl__ruler span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.tl__ruler span:first-child { transform: none; }
.tl__ruler span.is-end, .tl__ruler span:last-child:not(:first-child) { transform: translateX(-100%); }
.tl__ruler span::before { content: ''; position: absolute; left: 50%; bottom: -5px; width: 1px; height: 4px; background: currentColor; opacity: 0.5; }
.tl__track { position: relative; display: flex; height: 54px; border-radius: 12px; overflow: visible; cursor: pointer; }
.tl__scene { position: relative; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 10px; overflow: hidden; border-radius: 10px; margin: 0 1px; color: #fff; transition: filter 0.2s, box-shadow 0.2s; }
.tl__scene--0 { background: linear-gradient(135deg, #6d3bd1, #9a5cf0); }
.tl__scene--1 { background: linear-gradient(135deg, #d6457c, #ff7aa8); }
.tl__scene--2 { background: linear-gradient(135deg, #2f6fc4, #5aa9f0); }
.tl__scene--3 { background: linear-gradient(135deg, #e0734f, #ffa575); }
.tl__scene--4 { background: linear-gradient(135deg, #2d9c8a, #4fd1b5); }
.tl__scene--5 { background: linear-gradient(135deg, #c9902a, #f2c35e); }
.tl__scene.is-active { box-shadow: 0 0 0 2px #fff inset; filter: brightness(1.1); }
.tl__scene-name { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.tl__scene-dur { font-size: 10.5px; opacity: 0.85; font-variant-numeric: tabular-nums; }
.tl__handle { position: relative; z-index: 2; flex: none; width: 12px; margin: 0 -6px; border: 0; padding: 0; background: transparent; cursor: ew-resize; touch-action: none; }
.tl__handle::before { content: ''; position: absolute; left: 50%; top: 8px; bottom: 8px; width: 4px; margin-left: -2px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4); transition: transform 0.2s; }
.tl__handle:hover::before, .tl__handle:focus-visible::before { transform: scaleY(1.15); background: var(--accent-2); }
.tl__handle:focus-visible { outline: none; }
.tl__wave-wrap { position: relative; height: 38px; margin-top: 6px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border); overflow: hidden; cursor: pointer; }
.tl__wave { width: 100%; height: 100%; }
.tl__wave-label { position: absolute; left: 8px; top: 4px; font-size: 10px; color: var(--text-3); pointer-events: none; }
.tl__playhead { position: absolute; top: 18px; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.7); pointer-events: none; z-index: 3; }
.tl__playhead span { position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; }
.scene-inputs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.scene-inputs label { display: grid; gap: 4px; font-size: 11px; color: var(--text-3); }
.scene-inputs .input { min-height: 34px; padding: 6px 8px; font-size: 12.5px; }

/* ------------------------------------------------------------- choosers */
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.theme-card { position: relative; display: grid; align-content: end; gap: 2px; height: 86px; padding: 10px 12px; border-radius: 16px; border: 2px solid transparent; overflow: hidden; text-align: left; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); transition: transform 0.3s var(--ease-spring), border-color 0.2s, box-shadow 0.3s; }
.theme-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.45)); pointer-events: none; }
.theme-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -14px rgba(0, 0, 0, 0.8); }
.theme-card[aria-checked="true"] { border-color: #fff; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.5), 0 16px 30px -14px rgba(0, 0, 0, 0.8); }
.theme-card__emoji { position: absolute; top: 8px; right: 10px; font-size: 22px; z-index: 1; }
.theme-card__name { position: relative; z-index: 1; font-weight: 600; font-size: 13px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.theme-card__aa { position: relative; z-index: 1; font-size: 11px; opacity: 0.85; }
.theme-card__check { position: absolute; top: 8px; left: 8px; z-index: 1; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: #2a0b19; font-size: 12px; display: none; place-items: center; font-weight: 700; }
.theme-card[aria-checked="true"] .theme-card__check { display: grid; }
.font-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.font-card { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-align: left; transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease-spring); }
.font-card:hover { transform: translateY(-2px); }
.font-card[aria-checked="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.font-card__sample { font-size: 22px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-card__name { font-size: 11px; color: var(--text-3); }
.chip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.chip-grid--2 { grid-template-columns: repeat(2, 1fr); }
.chip-grid--dur { grid-template-columns: repeat(5, 1fr); margin-bottom: 10px; }
.chip { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 11.5px; font-weight: 500; transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.25s var(--ease-spring); }
.chip span { font-size: 19px; line-height: 1; }
.chip:hover { color: var(--text); transform: translateY(-2px); }
.chip[aria-checked="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.12); color: var(--text); }
.chip--row { grid-auto-flow: column; justify-content: start; gap: 8px; padding: 10px 12px; font-size: 12.5px; }
.chip--row span { font-size: 17px; }
.chip--dur { padding: 9px 2px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; transition: opacity 0.2s; }
.color-grid.is-off { opacity: 0.45; }
.color-field { display: grid; justify-items: center; gap: 6px; font-size: 11px; color: var(--text-2); cursor: pointer; }
.color-field input { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; padding: 3px; border-radius: 12px; border: 1px solid var(--border-strong); background: transparent; cursor: pointer; }
.color-field input::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input::-webkit-color-swatch { border: 0; border-radius: 9px; }
.color-field input::-moz-color-swatch { border: 0; border-radius: 9px; }
.toggle-row { display: flex; gap: 14px; flex-wrap: wrap; }

.aspect-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.aspect-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-align: left; transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease-spring); }
.aspect-card:hover { transform: translateY(-2px); }
.aspect-card[aria-checked="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.aspect-card__shape { display: grid; place-items: center; width: 34px; height: 34px; }
.aspect-card__shape i { display: block; border-radius: 4px; border: 2px solid currentColor; color: var(--accent); }
.aspect-card b { display: block; font-size: 12.5px; }
.aspect-card small { display: block; font-size: 10.5px; color: var(--text-3); line-height: 1.3; }

/* --------------------------------------------------------------- music */
.player { padding: 14px; border-radius: 16px; background: linear-gradient(160deg, rgba(var(--accent-rgb), 0.12), rgba(183, 156, 255, 0.08)); border: 1px solid rgba(var(--accent-rgb), 0.2); margin-bottom: 14px; }
.player__top { display: flex; align-items: center; gap: 12px; }
.player__play { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--grad); color: #2a0b19; font-size: 16px; padding-left: 3px; box-shadow: var(--shadow-glow); transition: transform 0.25s var(--ease-spring); }
.player__play.is-playing { padding-left: 0; }
.player__play:hover { transform: scale(1.06); }
.player__meta { flex: 1; min-width: 0; display: grid; }
.player__title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__time { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wave { position: relative; height: 64px; margin: 12px 0 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); overflow: hidden; }
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#mWave { cursor: pointer; }
.wave__viz { pointer-events: none; mix-blend-mode: screen; opacity: 0.85; }
.player__controls { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 14px; }
.player__controls .slider { margin: 0; }
.player__controls .switch--row { width: auto; margin: 0 0 2px; }
.track-list { display: grid; gap: 6px; margin-bottom: 12px; }
.track-group { margin: 6px 2px 2px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.track { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); text-align: left; transition: border-color 0.2s, background 0.2s; }
.track:hover { background: var(--surface-2); }
.track[aria-checked="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.track__emoji { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); font-size: 17px; }
.track__name { font-weight: 500; font-size: 13px; }
.track__mood { display: block; font-size: 11px; color: var(--text-3); }
.track__state { font-size: 11px; color: var(--accent); min-width: 14px; text-align: right; }
.upload-song { display: grid; gap: 6px; }

/* --------------------------------------------------------------- video */
.thumb-row { display: grid; grid-template-columns: 108px 1fr; gap: 14px; align-items: start; }
.thumb { display: grid; place-items: center; width: 108px; height: 140px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); overflow: hidden; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.thumb-side .field { margin-bottom: 10px; }
.wm-fields { transition: opacity 0.2s; }
.wm-fields.is-off { opacity: 0.45; }
.caps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.caps li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.caps li::before { content: '•'; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); font-size: 11px; }
.caps li.ok::before { content: '✓'; background: rgba(95, 211, 161, 0.2); color: #9ff0c9; }
.caps li.no::before { content: '–'; background: rgba(255, 107, 129, 0.15); color: #ffb3c0; }

/* -------------------------------------------------------------- modals */
.tpl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl-card { display: grid; gap: 6px; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); text-align: left; transition: border-color 0.2s, transform 0.25s var(--ease-spring), background 0.2s; }
.tpl-card:hover, .tpl-card:focus-visible { border-color: var(--accent); transform: translateY(-3px); background: rgba(var(--accent-rgb), 0.08); }
.tpl-card__top { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.tpl-card__top span { font-size: 22px; }
.tpl-card p { margin: 0; color: var(--text-3); font-size: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.share-opt { display: grid; justify-items: start; gap: 2px; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); text-align: left; transition: border-color 0.2s, transform 0.25s var(--ease-spring); }
.share-opt:hover { border-color: var(--accent); transform: translateY(-2px); }
.share-opt span { font-size: 20px; margin-bottom: 4px; }
.share-opt small { color: var(--text-3); font-size: 11.5px; }
.export-progress { display: grid; gap: 12px; padding-bottom: 4px; }
.export-progress__visual { display: grid; place-items: center; padding: 6px 0 4px; }
.export-reel { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent)); animation: reelSpin 2.2s linear infinite; box-shadow: 0 0 50px -6px rgba(var(--accent-rgb), 0.7); }
.export-reel span { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; background: #1f1526; font-size: 30px; animation: reelSpin 2.2s linear infinite reverse; }
@keyframes reelSpin { to { transform: rotate(360deg); } }
.export-progress__status { margin: 0; text-align: center; font-weight: 500; min-height: 1.5em; }
.export-progress__meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.export-progress__note { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 204, 102, 0.1); border: 1px solid rgba(255, 204, 102, 0.3); color: #ffe2a8; font-size: 12.5px; }
.export-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.export-steps li { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); transition: color 0.3s; }
.export-steps li::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; transition: all 0.3s; }
.export-steps li.is-active { color: var(--text); }
.export-steps li.is-active::before { border-color: var(--accent); border-top-color: transparent; animation: reelSpin 0.8s linear infinite; }
.export-steps li.is-done { color: var(--text-2); }
.export-steps li.is-done::before { content: '✓'; display: grid; place-items: center; font-size: 10px; background: var(--success); border-color: var(--success); color: #062016; }
.export-result { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 18px; align-items: start; }
.export-result__player { display: grid; place-items: center; border-radius: 16px; background: #000; overflow: hidden; max-height: 60vh; }
.export-result__player video { max-width: 100%; max-height: 60vh; }
.export-result__meta { margin: 0; display: grid; gap: 10px; }
.export-result__meta div { display: grid; gap: 1px; }
.export-result__meta dt { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.export-result__meta dd { margin: 0; font-size: 13px; word-break: break-all; }
.export-result__share-note { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--text-3); text-align: center; }
@media (max-width: 640px) { .export-result { grid-template-columns: 1fr; } .export-result__meta { grid-template-columns: 1fr 1fr; } }

/* ---------------------------------------------------------- bottom nav */
.bottom-nav { display: none; }

/* ============================================================ RESPONSIVE */
@media (max-width: 1440px) {
  .workspace { grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(320px, 360px); }
}
@media (max-width: 1279px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar .seg--view { justify-self: center; }
  .brand__sub { display: none; }
  .workspace { grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); }
  .panel--left, .panel--right { grid-column: 1; grid-row: 1; border-right: 1px solid var(--border); border-left: 0; }
  .panel--left, .panel--right { display: none; }
  .studio[data-tab="edit"] .panel--left { display: flex; }
  .studio[data-tab="design"] .panel--right, .studio[data-tab="music"] .panel--right, .studio[data-tab="video"] .panel--right { display: flex; }
  .studio[data-tab="preview"] .panel--left { display: flex; }
  .panel-tabs { display: none; }
  .stage { grid-column: 2; grid-row: 1; }
  .bottom-nav {
    display: flex; flex: none; justify-content: space-around; gap: 4px; padding: 6px 8px max(6px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: rgba(14, 9, 18, 0.9); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); z-index: 40;
  }
  .bottom-nav button { flex: 1; max-width: 120px; display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border: 0; border-radius: 12px; background: transparent; color: var(--text-3); font-size: 11px; font-weight: 500; transition: color 0.2s, background 0.2s; }
  .bottom-nav button span { font-size: 19px; line-height: 1.1; filter: grayscale(0.6); transition: filter 0.2s, transform 0.3s var(--ease-spring); }
  .bottom-nav button[aria-current="page"] { color: var(--text); background: rgba(var(--accent-rgb), 0.12); }
  .bottom-nav button[aria-current="page"] span { filter: none; transform: translateY(-1px) scale(1.08); }
  .bottom-nav [data-tab-btn="preview"] { display: none; }
}
@media (max-width: 860px) {
  .hide-md { display: none; }
  .topbar { grid-template-columns: 1fr auto; padding: 10px 12px; gap: 10px; }
  .topbar .seg--view { display: none; }
  .brand__title { font-size: 15px; }
  .brand__logo { width: 36px; height: 36px; font-size: 19px; border-radius: 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel--left, .panel--right { border: 0; }
  .stage { grid-column: 1; display: none; }
  .studio[data-tab="preview"] .stage { display: flex; }
  .studio[data-tab="preview"] .panel--left { display: none; }
  .bottom-nav [data-tab-btn="preview"] { display: grid; }
  .stage .seg--view-mobile { display: inline-flex; }
  .device-wrap { inset: 0 6px 10px; }
  .scene-inputs { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .hide-sm { display: none; }
  .topbar__actions { gap: 6px; }
  .topbar__actions .btn { padding: 8px 10px; min-height: 38px; }
  .brand__text { display: none; }
  .panel__scroll { padding: 12px; }
  .card { padding: 15px; }
  .field-grid { grid-template-columns: 1fr; }
  .shape-grid { gap: 4px; }
  .shape-grid button { font-size: 10px; }
  .chip-grid { grid-template-columns: repeat(4, 1fr); }
  .vplayer__vol { display: none; }
  .vplayer__time { min-width: 0; }
  .stage__bar { padding: 10px; }
  .stage__view--video { padding: 0 10px 10px; }
  .menu--right { position: fixed; left: 10px; right: 10px; top: 64px; min-width: 0; }
  .menu:not(.menu--right) { position: fixed; left: 10px; right: 10px; top: 64px; }
  .thumb-row { grid-template-columns: 90px 1fr; }
  .thumb { width: 90px; height: 120px; }
}

/* view switch inside stage (mobile only) */
.seg--view-mobile { display: none; }

/* ------------------------------------------------------------------ print */
#printArea { display: none; }
@media print {
  @page { margin: 10mm; }
  html.is-printing body > *:not(#printArea) { display: none !important; }
  html.is-printing body { background: #fff !important; height: auto; overflow: visible; }
  html.is-printing #printArea { display: block !important; }
  html.is-printing #printArea img { display: block; width: 100%; max-width: 160mm; max-height: 260mm; object-fit: contain; margin: 0 auto; }
}
.share-opt--wide { grid-column: 1 / -1; }

/* share dialog: greeting link */
.link-box { display: grid; gap: 12px; padding: 18px; border-radius: 18px; background: var(--grad-soft); border: 1px solid rgba(var(--accent-rgb), 0.25); }
.link-box__title { margin: 0; font-size: 16px; }
.link-box__text { margin: 0; color: var(--text-2); font-size: 13px; }
.link-box__ready { display: grid; gap: 12px; }
.link-result { display: grid; gap: 10px; }
.link-result__row { display: flex; gap: 8px; }
.link-result__row .input { min-width: 0; flex: 1; font-size: 12.5px; }
.link-progress { display: grid; gap: 6px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; font-size: inherit; }
.link-setup { display: grid; gap: 4px; }
.setup-steps { margin: 4px 0 10px; font-size: 13px; color: var(--text-2); }
.setup-steps summary { cursor: pointer; font-weight: 600; color: var(--text); }
.setup-steps ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.setup-sql { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); font-size: 12px; white-space: pre-wrap; overflow-x: auto; }
.setup-steps code { padding: 1px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.3); }
.link-setup__error { color: #ffb3c0; min-height: 0; }
.link-setup__error:empty { display: none; }
@media (max-width: 520px) { .link-result__row { flex-direction: column; } }
