/* Magic Spec — оформление по ai-patterns (shoomov.scanably.io/ai-patterns): тёмный холст, засвет слева сверху,
   стеклянные пилюли контролов, нижняя форма. Отступы от краёв — 24, верхний ряд на оси y = 14 + 35/2 */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; color: #fff; }
html { background: #1B1B1B; }   /* фон только у html: иначе фон body перекроет засвет (z-index: -1) */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
[hidden] { display: none !important; }

:root { --glass-bg: rgba(255, 255, 255, .08); --glass-border: 1px solid rgba(255, 255, 255, .15); --glass-shadow: 0 14px 14px rgba(0, 0, 0, .15); --edge: 24px;
  /* акцентная кнопка — как «Новый Ai-паттерн» на «Всех сервисах» (Yango Play) */
  --btn-fg: #fff; --btn-border: rgba(255, 255, 255, .1);
  --btn-bg: url("data:image/svg+xml;utf8,<svg viewBox='0 0 119 48' xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none'><rect x='0' y='0' height='100%' width='100%' fill='url(%23grad)' opacity='0.37'/><defs><radialGradient id='grad' gradientUnits='userSpaceOnUse' cx='0' cy='0' r='10' gradientTransform='matrix(3.2404 0 0 0.50809 31.845 0)'><stop stop-color='rgba(244,218,217,0.95)' offset='0'/><stop stop-color='rgba(245,169,191,0.9)' offset='0.14'/><stop stop-color='rgba(246,120,164,0.85)' offset='0.28'/><stop stop-color='rgba(246,120,164,0.45)' offset='0.52'/><stop stop-color='rgba(188,71,180,0.225)' offset='0.76'/><stop stop-color='rgba(130,22,197,0)' offset='1'/></radialGradient></defs></svg>") 0 0 / 100% 100% no-repeat,
    linear-gradient(129.62deg, #291A54 18.62%, #5C28B1 49.71%, #9227D5 64.37%, #E668E5 82.92%, #F4BBE5 96.8%); }

/* ---------- Холст ---------- */
#viewport { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
#viewport.panning { cursor: grabbing; }
#glow { position: fixed; top: 0; left: 0; width: min(467px, 60vw); height: auto; z-index: -1; pointer-events: none; user-select: none; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#world.animate { transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
#board { padding: 40px; user-select: none; -webkit-user-select: none; }

/* Пустой лейаут: рамка-заготовка, пока раскладка спек не нарисована */
.blank { position: relative; width: 1200px; height: 720px; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center;
  border-radius: 32px; border: 1px dashed rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .02); }
.blank .b-emoji { font-size: 44px; line-height: 1; }
.blank h2 { margin: 6px 0 0; font-size: 22px; font-weight: 700; }
.blank p { margin: 0; font-size: 13px; line-height: 1.4; color: #777; }

/* ---------- Табы по центру сверху ---------- */
.tabs { position: fixed; top: 14px; height: 35px; display: flex; align-items: center; z-index: 3;
  background: var(--glass-bg); border: var(--glass-border); border-radius: 100px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--glass-shadow); }
.tabs button { min-width: 111px; height: 33px; padding: 0 16px; border: 0; border-radius: 35px; background: transparent; color: rgba(255, 255, 255, .4);
  font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer; transition: background .2s, color .2s, scale .15s ease; }
.tabs button:hover { color: rgba(255, 255, 255, .7); }
.tabs button.active { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 700; }
#sections { left: 50%; transform: translateX(-50%); }

/* ---------- Язык: справа сверху, на оси табов. Материал — как в try-your-luck: 32×32, белый 10%, обводка 15% ---------- */
.lang-toggle { position: fixed; z-index: 6; right: calc(var(--edge) + 1.5px);   /* по одной оси с панелью масштаба (35 px) */ top: calc(14px + (35px - 32px) / 2); width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .15); border-radius: 35px; background: rgba(255, 255, 255, .1);
  box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 16px/1 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; color: #fff; cursor: pointer; transition: background .15s ease, scale .15s ease; }
.lang-toggle:hover { background: rgba(255, 255, 255, .18); }
.lang-toggle:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* ---------- Масштаб — вертикальная панель у правого края ---------- */
.zoom { position: fixed; top: 50%; right: var(--edge); transform: translateY(-50%); width: 35px; padding: 1px 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--glass-bg); border: var(--glass-border); border-radius: 100px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--glass-shadow); z-index: 3; }
.zoom button { width: 33px; height: 33px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 35px; background: transparent; color: rgba(255, 255, 255, .7);
  cursor: pointer; font-size: 12px; font-weight: 500; transition: background .2s, color .2s, scale .15s ease; }
.zoom button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.zoom-sep { width: 19px; height: 1px; margin: 2px 0; background: rgba(255, 255, 255, .15); }
#zoomPct { font-size: 10px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

#note { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 8px 14px; border-radius: 10px; background: #2a1a0b; color: #f5a623;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; }
#note.show { opacity: 1; }

/* ---------- Бургер справа внизу (44px, по центру относительно свёрнутой кнопки 56px) и меню над ним ---------- */
.burger { position: fixed; z-index: 4; right: max(var(--edge), env(safe-area-inset-right)); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 6px);
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--glass-bg); border: var(--glass-border); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, .8); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color .2s, background-color .2s, scale .15s ease; }
.burger:hover, .burger[aria-expanded="true"] { color: #fff; background-color: rgba(255, 255, 255, .14); }
.view-menu { position: fixed; z-index: 5; right: max(var(--edge), env(safe-area-inset-right)); bottom: calc(max(24px, env(safe-area-inset-bottom)) + 6px + 44px + 8px);
  width: 288px; max-width: calc(100vw - 24px); padding: 8px; display: flex; flex-direction: column; gap: 2px;
  border-radius: 24px; background: rgba(40, 40, 40, .72); border: var(--glass-border); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); transform-origin: right bottom; }
.vm-empty { margin: 0; padding: 10px; font-size: 13px; color: rgba(255, 255, 255, .4); }

/* ---------- Нижняя панель с формой ---------- */
#dock { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(640px, calc(100% - 24px)); max-width: calc(100% - 24px);
  background: rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border: var(--glass-border); box-shadow: var(--glass-shadow);
  border-radius: 32px; overflow: hidden; z-index: 4; display: flex; flex-direction: column; max-height: min(78vh, 820px); }
#dockBar { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 52px; padding: 0 20px; border: 0; background: transparent; color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; flex: none; }
.bar-t { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ic { flex: none; display: block; }
#dock:not(.collapsed) #dockIcon { display: none; }
#dock.collapsed form { display: none; }
#dock:not(.collapsed) { overflow-y: auto; overscroll-behavior: contain; display: block; }
#dock:not(.collapsed) #dockBar { height: auto; padding: 22px 20px 6px; font-size: 20px; cursor: default; justify-content: flex-start; }
#dock.collapsed { width: auto; background: var(--btn-bg); border: 1px solid var(--btn-border); background-origin: border-box; background-repeat: no-repeat; }
#dock.collapsed #dockBar { width: auto; height: 54px; padding: 0 24px; font-size: 14px; white-space: nowrap; color: var(--btn-fg); }   /* 54 + рамка 2 = 56 */

form .scroll { padding: 12px 20px 42px; display: grid; gap: 18px; }
.field { display: grid; gap: 8px; position: relative; }
.label { font-size: 13px; color: #9a9a9a; }
.label b { color: rgba(255, 255, 255, .4); font-weight: 400; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: start; position: relative; }
@media (max-width: 640px) { .pair { grid-template-columns: 1fr; row-gap: 18px; } }
input[type=text], input[type=url] { width: 100%; height: 42px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 15px; }
input::placeholder { color: rgba(255, 255, 255, .45); }
input:focus { outline: none; border-color: rgba(255, 255, 255, .4); }
.field.invalid .multi, .field.invalid > input { border-color: #a33; }

/* Дизайнер: поле с тегом и выпадающим списком, как в форме ai-patterns */
.multi { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 5px 8px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; background: rgba(255, 255, 255, .08); cursor: text; }
.multi:focus-within { border-color: rgba(255, 255, 255, .4); }
.multi .chips { display: contents; }
.multi input { flex: 1; min-width: 140px; height: 30px; padding: 0 4px; border: 0; background: transparent; }
.multi input:focus { border: 0; }
.multi.filled input { display: none; }   /* дизайнер один: после выбора поле — только тег */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px; border-radius: 8px; background: rgba(255, 255, 255, .12); font-size: 14px; }
.tag button { width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: #888; cursor: pointer; font-size: 15px; line-height: 1; }
.tag button:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.dropdown { list-style: none; margin: 0; padding: 4px; max-height: 220px; overflow: auto; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; background: rgba(255, 255, 255, .08); }
.dropdown li { display: flex; align-items: center; padding: 7px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.dropdown li.active, .dropdown li:hover { background: rgba(255, 255, 255, .1); }
.dropdown li.add { color: #8ab4ff; }
.dropdown li.empty { color: #555; cursor: default; background: none; }
.person { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ava { flex: none; border-radius: 50%; object-fit: cover; background: #2a2a2a; }
.ava.initials { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; letter-spacing: .02em; }

/* Обложка: зона для картинки (перетащить / вставить / выбрать), с превью */
.cover-drop { position: relative; display: grid; place-items: center; min-height: 132px; padding: 16px; border: 1px dashed rgba(255, 255, 255, .2); border-radius: 16px;
  background: rgba(255, 255, 255, .05); color: rgba(255, 255, 255, .5); font-size: 13px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; overflow: hidden; }
.cover-drop:hover, .cover-drop:focus-visible, .cover-drop.over { outline: none; border-color: rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .8); }
.cover-hint { display: grid; justify-items: center; gap: 8px; max-width: 280px; line-height: 1.4; }
.cover-drop.has { padding: 0; border-style: solid; border-color: rgba(255, 255, 255, .12); }
.cover-drop img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #111; }
.cover-clear { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: var(--glass-border); border-radius: 50%;
  background: rgba(30, 30, 30, .7); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; cursor: pointer; }
.cover-clear:hover { background: rgba(60, 60, 60, .85); }

.actions { z-index: 3; display: flex; align-items: center; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; flex: none;
  margin-top: -26px; padding: 36px 10px 10px 20px;   /* 10 + 1 (рамка) = 32 (радиус панели) − 21 (радиус кнопки): углы концентричны */
  background: linear-gradient(to bottom, rgb(42 42 42 / 0), rgb(42 42 42 / .75) 35%, rgb(42 42 42 / .96) 65%, rgb(42 42 42 / .98));
  pointer-events: none; }
.actions > * { pointer-events: auto; }
#formError { margin-right: auto; color: #ff6b6b; font-size: 13px; }
.actions button { height: 42px; padding: 0 20px; border: 0; border-radius: 21px; background: #fff; color: #000; font-size: 14px; font-weight: 600; cursor: pointer; }
.actions button[type=submit] { display: inline-flex; align-items: center; gap: 6px; background: var(--btn-bg); border: 1px solid var(--btn-border); background-origin: border-box; background-repeat: no-repeat; color: var(--btn-fg); }
.actions button.ghost { background: transparent; color: #aaa; }
.actions button.ghost:hover { color: #fff; }
.actions button:disabled { opacity: .6; cursor: progress; }

/* Узко: контролы ближе к краю */
@media (max-width: 920px) {
  :root { --edge: 12px; }
  .burger { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 6px); }
  .view-menu { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 6px + 44px + 8px); }
  #dock { bottom: max(16px, env(safe-area-inset-bottom)); }
}

/* Отклик на нажатие: всё нажимаемое сжимается до 0.9 */
:where(button:not(#dockBar):not(:disabled), #dock.collapsed):active { scale: .9; }
:where(#dock.collapsed) { transition: scale .15s ease; }
