/* Редактор: полоса сверху, вкладки, холст, боковые панели. */
html, body { height: 100%; overflow: hidden; }
#app { height: 100%; display: flex; flex-direction: column; }

.topbar { height: 56px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tb-left, .tb-mid, .tb-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tb-left { flex: 1; }
.tb-right { flex: 1; justify-content: flex-end; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .02em; margin-right: 8px; white-space: nowrap; }
.logo-mark { color: var(--accent); font-size: 18px; }
.title-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; }
.title-in { width: 240px; max-width: 100%; background: transparent; border-color: transparent; }
.title-in:hover { border-color: var(--line); }
.saved-mark { color: var(--muted); font-size: 12px; white-space: nowrap; }

.dropdown { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 230px; }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; background: none; border: 0; border-radius: 8px; cursor: pointer; text-align: left; }
.dd-item:hover { background: var(--panel2); }
.dd-sep { height: 1px; background: var(--line); margin: 5px 4px; }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 76px 320px 1fr 290px; }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px 6px; gap: 2px; overflow-y: auto; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px 8px; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 11px; }
.rail-btn .ic { width: 22px; height: 22px; }
.rail-btn:hover { color: var(--text); background: var(--panel2); }
.rail-btn.on { color: var(--text); background: var(--panel2); }
.rail-btn.on .ic { color: var(--accent); }
.rail-btn.narrow-only { display: none; }
.rail-btn.ping { animation: ping .9s; }
@keyframes ping { 30% { color: var(--accent); background: var(--panel2); } }

.panel-host { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; min-width: 0; }
.panel { padding: 14px 16px 24px; }
.panel-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.panel-sub { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 10px; }

.right { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.box { min-height: 0; overflow-y: auto; }
.layers-box { flex: 0 0 auto; max-height: 38%; border-bottom: 1px solid var(--line); }
.props-box { flex: 1; }
.right .panel { padding: 12px 14px 18px; }

/* Холст */
.stage-host { position: relative; min-width: 0; min-height: 0; background: var(--bg); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px; }
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.stage.drop::after { content: ''; position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 16px; pointer-events: none; }
.frame { position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #000; }
.frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.over { touch-action: none; }
.frame.peeking { outline: 2px solid var(--accent); outline-offset: 4px; }
.frame.peeking .over { opacity: 0; }
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.empty-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px 24px; box-shadow: var(--shadow); margin: auto; }
.empty-card { text-align: center; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-card .ic.big { color: var(--accent); }
.empty-card h2 { font-family: var(--display); font-size: 22px; }
.empty-card p { color: var(--muted); margin: 0 0 6px; }
.empty-or { color: var(--muted); font-size: 12.5px; margin-top: 12px; }
.empty-bgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 380px; }
.bg-thumb { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; aspect-ratio: 1; }
.bg-thumb:hover { border-color: var(--accent); }
.bg-thumb canvas { width: 100%; height: 100%; display: block; }

/* Сетки миниатюр */
.thumb-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.thumb { padding: 0; background: var(--panel2); border: 2px solid transparent; border-radius: 12px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-align: left; }
.thumb canvas { width: 100%; aspect-ratio: 1; display: block; }
.thumb span { padding: 6px 9px 8px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb:hover { border-color: var(--line2); }
.thumb.on { border-color: var(--accent); }

/* Эффекты */
.fx-stack { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.fx-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); padding: 6px 10px; }
.fx-card.off .fx-name, .fx-card.off .fx-params { opacity: .45; }
.fx-head { display: flex; align-items: center; gap: 2px; }
.fx-name { flex: 1; min-width: 0; font-weight: 600; cursor: pointer; padding: 6px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl-toggle.mini .ctl-label { display: none; }
.fx-params { padding: 0 2px 4px; }
.fx-group-name { font-size: 12.5px; color: var(--muted); margin: 14px 0 8px; }
.fx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fx-tile { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.fx-tile canvas { width: 100%; aspect-ratio: 1; display: block; background: var(--bg2); }
.fx-tile span { font-size: 11.5px; padding: 5px 4px 6px; line-height: 1.2; min-height: 34px; display: flex; align-items: center; justify-content: center; text-align: center; }
.fx-tile:hover { border-color: var(--accent); }
.fx-link { margin: 10px 0; }

/* Текст */
.add-text { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.add-text .btn { flex-direction: column; height: 62px; gap: 4px; font-size: 12px; border-color: var(--line); background: var(--panel2); white-space: normal; text-align: center; line-height: 1.15; padding: 0 4px; }
.style-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.style-tile { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #111116; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; color: #ddd; }
.style-tile canvas { width: 100%; height: auto; display: block; }
.style-tile span { font-size: 11.5px; padding: 3px 8px 6px; text-align: left; }
.style-tile:hover { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { height: 28px; padding: 0 11px; border-radius: 20px; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.font-list { display: flex; flex-direction: column; gap: 2px; }
.font-row { display: flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 10px; border: 1px solid transparent; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.font-row:hover { background: var(--panel2); }
.font-row.on { border-color: var(--accent); background: var(--panel2); }
.font-row.nocyr .font-sample { opacity: .5; }
.font-sample { font-size: 22px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.font-name { font-size: 11.5px; color: var(--muted); }
.font-name em { font-style: normal; }
.font-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg2); cursor: pointer; font-size: 17px; margin-top: 8px; }

/* Элементы */
.shape-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }.shape-tile { padding: 6px 4px 6px; border: 1px solid var(--line); border-radius: 10px; background: #15151b; color: #ddd; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; line-height: 1.2; text-align: center; }.shape-tile canvas { width: 64px; height: 64px; }
.shape-tile:hover { border-color: var(--accent); }

/* Слои */
.layers { display: flex; flex-direction: column; gap: 2px; }
.layer { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.layer:hover { background: var(--panel2); }
.layer.on { background: var(--panel2); border-color: var(--sel); }
.layer.hidden .layer-name, .layer.hidden canvas { opacity: .4; }
.layer.dragging { opacity: .4; }
.layer.drop-target { box-shadow: inset 0 2px 0 var(--accent); }
.layer canvas { width: 32px; height: 32px; border-radius: 5px; flex: none; }
.layer-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-acts { display: flex; opacity: .55; }
.layer:hover .layer-acts, .layer.on .layer-acts { opacity: 1; }
.badge { font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; }
.layer-tools { display: flex; gap: 2px; justify-content: flex-end; margin-top: 6px; }

/* Свойства */
details.section { border-top: 1px solid var(--line); padding: 4px 0; }
details.section:first-of-type { border-top: 0; }
details.section > summary { cursor: pointer; padding: 8px 0; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: ''; width: 7px; height: 7px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
details.section[open] > summary::after { transform: rotate(45deg); }
.section-body { padding-bottom: 6px; }
.note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; padding: 6px 0 10px; }
.fields { display: flex; flex-direction: column; }

/* Окна редактора */
.export { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.export-prev { width: 100%; border-radius: 10px; display: block; }
.export-right .btn.wide { margin-top: 12px; }

.pc { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 22px; }
.pc-cap { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.pc-col > .pc-cap:not(:first-child) { margin-top: 20px; }
.pc-player { display: flex; align-items: center; gap: 12px; background: #121212; color: #fff; padding: 10px; border-radius: 8px; }
.pc-player .pc-img { width: 56px; height: 56px; border-radius: 4px; }
.pc-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pc-meta b, .pc-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-meta span, .pc-time { color: #a7a7a7; font-size: 12.5px; }
.pc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 260px; }
.pc-grid .pc-img { width: 100%; height: auto; aspect-ratio: 1; }
.pc-tile { aspect-ratio: 1; background: linear-gradient(135deg, #2a2a35, #1b1b22); }
.pc-phone { width: 250px; background: linear-gradient(#3b2b3f, #121214); color: #fff; border-radius: 28px; padding: 18px 15px 22px; display: flex; flex-direction: column; gap: 4px; border: 6px solid #050507; }
.pc-phone .pc-img { width: 100%; height: auto; border-radius: 8px; margin: 10px 0 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.pc-phone-top { font-size: 10px; letter-spacing: .14em; text-align: center; color: #ccc; }
.pc-phone span { color: #bbb; font-size: 13px; }
.pc-bar { height: 3px; background: #555; border-radius: 3px; margin: 12px 0 8px; }
.pc-bar i { display: block; width: 38%; height: 100%; background: #fff; border-radius: 3px; }
.pc-ctrls { text-align: center; font-size: 20px; letter-spacing: .3em; }
.pc-list { display: flex; flex-direction: column; gap: 8px; }
.pc-prob { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.pc-prob .ic { color: #ffb020; margin-top: 1px; }
.pc-ok { display: flex; gap: 10px; align-items: center; color: var(--ok); }

/* Средняя ширина: панель уже */
@media (max-width: 1250px) {
  .workspace { grid-template-columns: 70px 280px 1fr 260px; }
  .hide-s span { display: none; }
  .hide-s { width: 36px; padding: 0; }
  .title-in { width: 160px; }
}

/* Узкий экран: холст сверху, вкладки и панель снизу */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(240px, 52%) auto 1fr; }
  .stage-host { grid-row: 1; }
  .rail { grid-row: 2; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; overflow-x: auto; overflow-y: hidden; }
  .rail-btn { min-width: 64px; padding: 7px 4px 5px; }
  .rail-btn.narrow-only { display: flex; }
  .panel-host { grid-row: 3; border-right: 0; }
  .right { display: none; }
  .tb-mid .sep, .tb-mid .btn:nth-child(4), .tb-mid .btn:nth-child(5) { display: none; }
  .title-wrap, .logo-text { display: none; }
  .hide-s { display: none; }
  .export { grid-template-columns: 1fr; }
  .export-left { max-width: 200px; margin: 0 auto; }
  .pc { grid-template-columns: 1fr; }
  .pc-phone { margin: 0 auto; }
}
@media (max-width: 420px) {
  .topbar { padding: 0 6px; gap: 4px; }
  .fx-grid { grid-template-columns: repeat(3, 1fr); }
}
