@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/stix-two-text-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/stix-two-text-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/stix-two-text-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'STIX Two Text';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/stix-two-text-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #000000;
  --ink: #ecebf3;
  --muted: #8d8a9c;
  --faint: #55525f;
  --line: #24232b;
  --accent: #9c80e8;
  --accent-soft: rgba(156, 128, 232, 0.14);
  /* Цвета наклеек — те же, что у кубика и на схеме. */
  --c-white: #f0eef0;
  --c-yellow: #f5d850;
  --c-green: #4ca055;
  --c-blue: #3c80f0;
  --c-red: #e24846;
  --c-orange: #f67734;
  /* «Пластик» кубика: почти чёрные плитки с мягкой рамкой. */
  --plastic: #0e0e11;
  --plastic-edge: #1e1e25;
  --serif: 'STIX Two Text', 'Times New Roman', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Цвета, которые меняются вместе с темой */
  --surface: #0e0e11;          /* карточки и листы */
  --surface-2: #16161b;
  --orbit: #504f5d;            /* окружности схемы */
  --band: #f8f8fa;             /* подсветка активного кольца */
  --tag-bg: #000000;
  --tag-ink: #f2f2f4;
  --dot-stroke: transparent;   /* обводка точек (нужна на светлом фоне) */
  --active-bg: var(--c-white); /* выбранная «наклейка» в переключателях */
  --active-ink: #121216;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* Светлая тема */
:root[data-theme='light'] {
  --bg: #f3f2f7;
  --ink: #17161c;
  --muted: #6b6779;
  --faint: #a7a3b4;
  --line: #dddbe5;
  --accent: #7556d6;
  --accent-soft: rgba(117, 86, 214, 0.12);
  --plastic: #ffffff;
  --plastic-edge: #e3e1ea;
  --surface: #ffffff;
  --surface-2: #f7f6fa;
  --orbit: #c9c6d4;
  --band: #1b1a21;
  --tag-bg: #ffffff;
  --tag-ink: #17161c;
  --dot-stroke: rgba(23, 22, 28, 0.38);
  --active-bg: #17161c;
  --active-ink: #ffffff;
  --shadow: 0 18px 50px rgba(40, 30, 80, 0.16);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.app {
  /* Высоту берём из самого окна, а не из переменной Telegram: после сворачивания и
     разворачивания приложения та переменная иногда остаётся маленькой, и всё «съезжало» вверх. */
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
  grid-template-areas: 'cube' 'diagram' 'history' 'toolbar';
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  overflow: hidden;
}


.stage {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stage-3d {
  grid-area: cube;
}

.stage-2d {
  grid-area: diagram;
}

/* Режимы: только кубик, кубик со схемой, только схема. */
.app[data-mode='cube'] {
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: 'cube' 'history' 'toolbar';
}
.app[data-mode='cube'] .stage-2d {
  display: none;
}
.app[data-mode='map'] {
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: 'diagram' 'history' 'toolbar';
}
.app[data-mode='map'] .stage-3d {
  display: none;
}
.app[data-mode='map'] .diagram-wrap {
  margin: 56px 6px 0;
}

/* Верхняя полоса поверх экрана: в углах свободно и над кубиком, и над схемой. */
.overlay-top {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 12px 0;
  pointer-events: none;
}

.overlay-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.modes {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--plastic);
  border: 1px solid var(--plastic-edge);
  pointer-events: auto;
}

.modes button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.modes svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Выбранный режим — белая «наклейка». */
.modes button[aria-checked='true'] {
  background: var(--active-bg);
  color: var(--active-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.stats {
  padding-left: 4px;
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--muted);
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

.move-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.move-badge.idle {
  visibility: hidden;
}

.move-name {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
}

.move-desc {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
}

.move-desc .dir {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.move-badge[data-dir='cw'] .dir-cw,
.move-badge[data-dir='ccw'] .dir-ccw {
  display: block;
}

.move-count {
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.move-count:empty {
  display: none;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.diagram-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: -6px;
}

#diagram {
  touch-action: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* История ходов — своей строкой над кнопками. */
.history-row {
  grid-area: history;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px 0 12px;
}

.history {
  flex: 1;
  min-width: 0;
  padding: 6px 16px 2px;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.3;
  min-height: 1.6em;
  color: var(--muted);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}

/* 2D-схема: размеры в пикселях оригинального кадра видео. */
.orbit {
  fill: none;
  stroke: var(--orbit);
  stroke-width: 7;
}

.band {
  fill: none;
  stroke: var(--band);
  stroke-width: 11;
  transition: opacity 0.6s ease;
}

.trail {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.6s ease;
}

.dot {
  stroke: var(--dot-stroke);
  stroke-width: 2;
}

.band.fading,
.trail.fading {
  opacity: 0;
}

.move-tag rect {
  fill: var(--tag-bg);
}

.move-tag text {
  font-family: var(--serif);
  font-size: 42px;
  fill: var(--tag-ink);
}


.history .last {
  color: var(--accent);
}

.toolbar {
  grid-area: toolbar;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px 12px;
}

/* Кнопка — кубик: тёмный пластик, внутри цветная наклейка с иконкой. */
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px 7px;
  border-radius: 16px;
  border: 1px solid var(--plastic-edge);
  background: var(--plastic);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.7rem;
  line-height: 1.1;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease;
  min-width: 0;
}

.sticker {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tone);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.sticker svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #121216;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool:active:not(:disabled) {
  transform: scale(0.95);
  border-color: color-mix(in srgb, var(--tone) 55%, var(--plastic-edge));
}

.tool:disabled {
  cursor: default;
  color: var(--faint);
}

.tool:disabled .sticker {
  opacity: 0.28;
}

.tool[aria-busy='true'] .sticker {
  animation: busy 0.9s ease-in-out infinite alternate;
}

@keyframes busy {
  to {
    filter: brightness(0.6);
  }
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 12px);
  width: max-content;
  max-width: min(92vw, 420px);
  padding: 13px 16px 11px;
  border-radius: 14px;
  background: var(--plastic);
  border: 1px solid var(--plastic-edge);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Тонкая полоска из шести цветов кубика сверху уведомления. */
.toast::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--c-white) 0 16.66%,
    var(--c-red) 0 33.33%,
    var(--c-blue) 0 50%,
    var(--c-orange) 0 66.66%,
    var(--c-green) 0 83.33%,
    var(--c-yellow) 0
  );
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Широкий экран (Telegram Desktop, планшет в альбомной ориентации): кубик и схема рядом. */
@media (min-aspect-ratio: 5/4) {
  .app[data-mode='both'] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas: 'cube diagram' 'history history' 'toolbar toolbar';
  }
  .toolbar {
    max-width: 640px;
    width: 100%;
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .trail,
  .band,
  .tool {
    transition: none;
  }
  .tool[aria-busy='true'] .sticker {
    animation: none;
  }
}

/* =====================================================================
   Профиль, рейтинг, обучение, результат
   ===================================================================== */

.overlay-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border-radius: 30%;
  background: var(--av);
  color: #fff;
  font-weight: 700;
  font-family: var(--sans);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-sm { width: 36px; height: 36px; font-size: 16px; }
.avatar-md { width: 52px; height: 52px; font-size: 22px; }
.avatar-lg { width: 72px; height: 72px; font-size: 30px; }

/* ---------- общие кнопки ---------- */
.cta,
.ghost,
.show {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 16px;
  font: 600 1rem/1 var(--sans);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease;
}
.cta {
  border: 0;
  background: var(--c-yellow);
  color: #121216;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}
.ghost {
  border: 1px solid var(--plastic-edge);
  background: var(--surface-2);
  color: var(--ink);
}
.show {
  border: 0;
  background: var(--c-green);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.show svg { width: 18px; height: 18px; fill: currentColor; }
.cta:active, .ghost:active, .show:active { transform: scale(0.97); }
.cta.wide, .ghost.wide { width: 100%; }
.cta.small { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 0.9rem; }
.ghost.square { width: 50px; padding: 0; }
.ghost svg, .icon-btn svg, .row-arrow svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
button:disabled { opacity: 0.4; cursor: default; }
.link {
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.9rem var(--sans);
  padding: 8px 4px;
  cursor: pointer;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn.ghost-space { visibility: hidden; }

/* ---------- обучение ---------- */
.app.tutorial-on {
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: 'cube' 'sheet';
}
.app.tutorial-on .toolbar,
.app.tutorial-on .history,
.app.tutorial-on .stage-2d,
.app.tutorial-on .modes,
.app.tutorial-on .avatar-btn,
.app.tutorial-on .stats { display: none; }

.tutorial {
  grid-area: sheet;
  position: relative;
  z-index: 3;
  margin: 0 8px 8px;
  padding: 14px 16px 16px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--plastic-edge);
  box-shadow: var(--shadow);
  animation: sheet-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }
.tut-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tut-progress { display: flex; gap: 5px; }
.tut-progress i {
  width: 14px; height: 14px; border-radius: 4px;
  background: var(--surface-2); border: 1px solid var(--plastic-edge);
  transition: background 0.3s, transform 0.3s;
}
.tut-progress i.done { background: var(--c); border-color: transparent; }
.tut-progress i.now { border: 2px solid var(--c); transform: scale(1.15); }
.tut-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 9px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--ink);
  font: 600 0.75rem var(--sans);
  letter-spacing: 0.02em;
}
.tut-title { margin: 8px 0 4px; font: 700 1.45rem/1.15 var(--sans); letter-spacing: -0.01em; }
.tut-text { margin: 0; color: var(--muted); font: 0.92rem/1.45 var(--sans); }
.tut-alg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 14px; min-height: 34px; }
.chip {
  min-width: 34px; height: 34px; padding: 0 9px;
  display: inline-grid; place-items: center;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--plastic-edge);
  font: 1.1rem var(--serif); color: var(--ink);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.chip.on { background: var(--accent); color: #fff; border-color: transparent; transform: translateY(-2px) scale(1.08); }
.times { margin-left: 2px; font: 600 0.95rem var(--sans); color: var(--muted); }
.tut-actions { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; }

/* ---------- приветствие ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transition: opacity 0.25s ease;
}
.welcome.open { opacity: 1; }
.welcome-card {
  width: min(100%, 380px); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.welcome-card h1 { margin: 10px 0 0; font: 800 2rem/1.1 var(--sans); letter-spacing: -0.02em; }
.welcome-card h1 .accent { color: var(--accent); }
.welcome-card p { margin: 0 0 8px; color: var(--muted); font: 1rem/1.5 var(--sans); }
.welcome-card small { color: var(--faint); font: 0.8rem var(--sans); margin-top: 4px; }
.logo-grid {
  display: grid; grid-template-columns: repeat(3, 34px); gap: 6px; padding: 10px;
  border-radius: 18px; background: var(--plastic); border: 1px solid var(--plastic-edge);
}
.logo-grid i {
  width: 34px; height: 34px; border-radius: 8px; background: var(--c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; animation-delay: var(--d);
}
@keyframes pop { from { transform: scale(0); } }

/* ---------- панель профиля и топа ---------- */
.panel {
  position: fixed; inset: 0; z-index: 25;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  transform: translateY(24px); opacity: 0;
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s ease;
}
.panel.open { transform: none; opacity: 1; }
.panel-head {
  display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 12px;
  padding: 10px 14px;
}
.tabs {
  justify-self: center; display: flex; gap: 2px; padding: 3px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--plastic-edge);
}
.tabs button {
  min-width: 96px; height: 36px; border: 0; border-radius: 11px; background: transparent;
  color: var(--muted); font: 600 0.92rem var(--sans); cursor: pointer;
}
.tabs button[aria-selected='true'] { background: var(--active-bg); color: var(--active-ink); }
.panel-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 6px 16px calc(24px + env(safe-area-inset-bottom, 0px));
}
.profile, .top { display: flex; flex-direction: column; gap: 14px; max-width: 520px; margin: 0 auto; }

.who { display: flex; align-items: center; gap: 14px; padding: 6px 2px; }
.who-name { font: 700 1.3rem/1.2 var(--sans); }
.who-handle { color: var(--muted); font: 0.88rem var(--sans); margin-top: 2px; }

.best-card {
  position: relative; overflow: hidden;
  padding: 18px 18px 16px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--plastic-edge);
}
.best-card::after {
  content: ''; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px;
  border-radius: 34px; transform: rotate(18deg);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
}
.best-label { color: var(--muted); font: 600 0.8rem var(--sans); text-transform: uppercase; letter-spacing: 0.08em; }
.best-time { margin-top: 6px; font: 3.2rem/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; }
.best-time.dim { color: var(--faint); }
.best-meta { margin-top: 6px; color: var(--muted); font: 0.88rem var(--sans); }
.best-note { margin-top: 12px; font: 600 0.92rem var(--sans); color: var(--ink); }
.place-chip {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 12px;
  padding: 6px 12px 6px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--plastic-edge);
  font: 0.88rem var(--sans); color: var(--muted);
}
.place-chip b {
  padding: 3px 8px; border-radius: 8px; background: var(--chip); color: #121216; font-weight: 800;
}

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--plastic-edge); }
.tile-value { font: 1.35rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.tile-label { margin-top: 4px; color: var(--muted); font: 0.78rem var(--sans); }

.list h3, .settings h3 { margin: 6px 2px 8px; font: 700 1rem var(--sans); }
.solves { list-style: none; margin: 0; padding: 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--plastic-edge); }
.solves li {
  display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--surface);
}
.solves li + li { border-top: 1px solid var(--plastic-edge); }
.solve-time { font: 1.15rem var(--serif); font-variant-numeric: tabular-nums; }
.solve-meta { justify-self: end; color: var(--muted); font: 0.82rem var(--sans); }
.tag { padding: 2px 7px; border-radius: 6px; background: var(--c-green); color: #fff; font: 700 0.7rem var(--sans); }
.solves li.is-best .solve-time { color: var(--accent); }

.settings { display: flex; flex-direction: column; gap: 8px; }
.row-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 18px; border: 1px solid var(--plastic-edge);
  background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; font-family: var(--sans);
}
.row-btn.static { cursor: default; }
.row-ico {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--ico);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}
.row-ico svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.row-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.row-text b { font-size: 0.98rem; }
.row-text small { color: var(--muted); font-size: 0.8rem; }
.row-arrow { color: var(--faint); }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--plastic-edge); }
.seg button {
  height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: 600 0.85rem var(--sans); cursor: pointer;
}
.seg button[aria-pressed='true'] { background: var(--active-bg); color: var(--active-ink); }

/* топ */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin-top: 8px; }
.pod {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; font-family: var(--sans);
}
.pod.empty { visibility: hidden; }
.pod-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 0.88rem var(--sans); }
.pod-time { font: 1.05rem var(--serif); color: var(--muted); font-variant-numeric: tabular-nums; }
.pod-1 .pod-time { color: var(--accent); font-size: 1.25rem; }
.pod-step {
  width: 100%; display: grid; place-items: center; border-radius: 16px 16px 6px 6px;
  background: var(--medal); color: #121216; font: 800 1.4rem var(--sans);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}
.pod-1 .pod-step { height: 92px; }
.pod-2 .pod-step { height: 66px; }
.pod-3 .pod-step { height: 50px; }
.pod.is-me .pod-name { color: var(--accent); }
.ranks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ranks button {
  display: grid; grid-template-columns: 30px auto 1fr auto; align-items: center; gap: 10px; width: 100%;
  padding: 8px 12px; border-radius: 16px; border: 1px solid var(--plastic-edge); background: var(--surface);
  color: var(--ink); cursor: pointer; text-align: left; font-family: var(--sans);
}
.ranks button.is-me { border-color: var(--accent); background: var(--accent-soft); }
.rank-place { color: var(--muted); font: 700 0.95rem var(--sans); text-align: center; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rank-time { font: 1.05rem var(--serif); font-variant-numeric: tabular-nums; }
.me-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 4px; padding: 10px 10px 10px 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--plastic-edge); box-shadow: var(--shadow);
  font: 0.95rem var(--sans);
}
.me-bar b { color: var(--accent); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 12px; }
.empty-state h3 { margin: 8px 0 0; font: 700 1.2rem var(--sans); }
.empty-state p { margin: 0 0 8px; color: var(--muted); font: 0.95rem/1.5 var(--sans); max-width: 300px; }
.empty-grid { display: grid; grid-template-columns: repeat(3, 18px); gap: 4px; opacity: 0.6; }
.empty-grid i { width: 18px; height: 18px; border-radius: 5px; background: var(--plastic-edge); }

.skeleton { display: flex; flex-direction: column; gap: 12px; padding-top: 10px; max-width: 520px; margin: 0 auto; }
.skeleton i {
  height: 64px; border-radius: 18px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface));
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.skeleton i.short { height: 40px; width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- результат ---------- */
.result {
  position: fixed; inset: 0; z-index: 28;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px 10px calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0); transition: background 0.25s ease;
}
.result.open { background: rgba(0, 0, 0, 0.45); }
.result-card {
  width: min(100%, 440px); padding: 22px 20px 18px; border-radius: 28px; text-align: center;
  background: var(--surface); border: 1px solid var(--plastic-edge); box-shadow: var(--shadow);
  transform: translateY(110%); transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.result.open .result-card { transform: none; }
.result-kicker { font: 800 1.05rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.result-time { margin-top: 4px; font: 4rem/1.05 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; }
.result-meta { color: var(--muted); font: 0.95rem var(--sans); }
.result-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 6px; min-height: 34px; }
.badge {
  display: inline-flex; align-items: center; gap: 2px; padding: 7px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--b) 18%, transparent); color: var(--ink); font: 0.9rem var(--sans);
  animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
.badge b { font-weight: 800; }
.badge.loading { color: var(--muted); background: var(--surface-2); animation: none; }
.result-motto { min-height: 1.4em; margin: 8px 6px 16px; color: var(--ink); font: 0.98rem/1.45 var(--sans); }
.result-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }

.confetti { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translate(var(--x), 105vh) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial, .logo-grid i, .badge { animation: none; }
  .panel, .result-card, .welcome { transition: none; }
}

/* =====================================================================
   Верхние кнопки, «Выровнять», автор кубика
   ===================================================================== */
.overlay-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.top-actions { display: flex; gap: 6px; pointer-events: auto; }
.top-btn {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 12px;
  border: 1px solid var(--plastic-edge); background: var(--plastic); color: var(--ink); cursor: pointer;
}
.top-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.top-btn:active { transform: scale(0.94); }
#btn-create { background: var(--c-yellow); color: #121216; border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(0,0,0,.16); }

.align-btn {
  position: absolute; right: 12px; bottom: 10px; z-index: 2;
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 13px;
  border: 1px solid var(--plastic-edge); background: color-mix(in srgb, var(--plastic) 88%, transparent);
  color: var(--muted); cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.align-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.align-btn:active { color: var(--ink); transform: scale(0.94); }
.canvas-wrap { position: relative; }

.creator {
  flex: none; display: inline-flex; align-items: center; gap: 7px; max-width: 62%;
  padding: 4px 10px 4px 4px; border-radius: 12px; border: 1px solid var(--plastic-edge);
  background: var(--plastic); color: var(--ink); font: 600 0.8rem var(--sans); cursor: pointer;
}
.creator-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-xs { width: 24px; height: 24px; font-size: 11px; border-radius: 8px; }

/* =====================================================================
   Каталог кубиков (шторка сверху)
   ===================================================================== */
.catalog { position: fixed; inset: 0; z-index: 24; }
.cat-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .25s ease; }
.catalog.open .cat-backdrop { background: rgba(0,0,0,.45); }
.cat-sheet {
  position: absolute; left: 0; right: 0; top: 0; max-height: 86%;
  display: flex; flex-direction: column; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 14px;
  background: var(--bg); border-bottom: 1px solid var(--plastic-edge);
  border-radius: 0 0 26px 26px; box-shadow: var(--shadow);
  transform: translateY(-104%); transition: transform .3s cubic-bezier(.2,.9,.3,1);
}
.catalog.open .cat-sheet { transform: none; }
.cat-head { display: flex; align-items: center; justify-content: space-between; }
.cat-head b { font: 800 1.2rem var(--sans); }
.cat-sheet .tabs { align-self: stretch; justify-content: stretch; }
.cat-sheet .tabs button { flex: 1; min-width: 0; }
.cat-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 18px;
  border: 1px solid var(--plastic-edge); background: var(--surface); color: var(--ink); text-align: left; font-family: var(--sans);
}
button.cat-card { cursor: pointer; }
.cat-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cat-open { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.cat-thumb { width: 100%; aspect-ratio: 1; border-radius: 12px; object-fit: cover; background: #07060b; display: block; }
.classic-thumb { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 18%; box-sizing: border-box; }
.classic-thumb i { border-radius: 22%; background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.18); }
.create-thumb { display: grid; place-items: center; background: var(--surface-2); border: 2px dashed var(--plastic-edge); box-sizing: border-box; }
.create-thumb svg { width: 40%; height: 40%; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.cat-title { font-weight: 700; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.cat-author { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); overflow: hidden; white-space: nowrap; }
.cat-meta { font-size: .75rem; color: var(--faint); }
.cat-badge { position: absolute; left: 14px; top: 14px; padding: 2px 8px; border-radius: 8px; background: var(--accent); color: #fff; font: 700 .7rem var(--sans); }
.cat-more { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 10px; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; }
.cat-more svg { width: 18px; height: 18px; fill: currentColor; }
.cat-note { grid-column: 1 / -1; margin: 6px 4px; color: var(--muted); font: .9rem/1.45 var(--sans); }
.skeleton-card { min-height: 200px; background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }

.menu { position: fixed; inset: 0; z-index: 35; display: flex; align-items: flex-end; justify-content: center; }
.menu-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.menu-card { position: relative; width: min(100% - 20px, 420px); margin-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 8px; border-radius: 22px; background: var(--surface); border: 1px solid var(--plastic-edge); box-shadow: var(--shadow);
  animation: sheet-in .25s cubic-bezier(.2,.9,.3,1.1); }
.menu-title { padding: 8px 12px 6px; color: var(--muted); font: 600 .85rem var(--sans); }
.menu-item { display: block; width: 100%; padding: 14px 12px; border: 0; border-radius: 14px; background: none; color: var(--ink);
  text-align: left; font: 600 1rem var(--sans); cursor: pointer; }
.menu-item:active { background: var(--surface-2); }
.menu-item.danger, .link.danger { color: var(--c-red); }

/* =====================================================================
   Редактор своего кубика
   ===================================================================== */
.editor { position: fixed; inset: 0; z-index: 26; display: flex; flex-direction: column; background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px); transform: translateY(24px); opacity: 0;
  transition: transform .28s cubic-bezier(.2,.9,.3,1), opacity .2s ease; }
.editor.open { transform: none; opacity: 1; }
.ed-head { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; }
.ed-title { min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--plastic-edge);
  background: var(--surface); color: var(--ink); font: 700 1rem var(--sans); }
.ed-title::placeholder { color: var(--faint); }
.ed-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 14px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 12px; }
.ed-preview { position: sticky; top: 0; z-index: 3; height: min(34vh, 280px); flex: none; border-radius: 22px; overflow: hidden;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.6);
  background: radial-gradient(60% 60% at 50% 50%, var(--accent-soft), transparent 70%), var(--surface); border: 1px solid var(--plastic-edge); }
.ed-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.ed-hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: var(--muted); font: .78rem var(--sans); pointer-events: none; }
.ed-faces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ed-face { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border-radius: 12px;
  border: 1px solid var(--plastic-edge); background: var(--surface); color: var(--muted); font: 600 .68rem var(--sans); cursor: pointer; }
.ed-face canvas { width: 100%; aspect-ratio: 1; border-radius: 8px; background: #111; }
.ed-face.is-sel { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.ed-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--plastic-edge); }
.ed-panel-head { display: flex; align-items: center; justify-content: space-between; }
.ed-panel-head b { font: 800 1.05rem var(--sans); }
.ed-sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ed-src { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 14px;
  border: 1px solid var(--plastic-edge); background: var(--surface-2); color: var(--ink); font: 600 .8rem var(--sans); cursor: pointer; }
.ed-src svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ed-src.is-on { border-color: var(--accent); }
.ed-crop { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto; border-radius: 14px; overflow: hidden;
  touch-action: none; cursor: grab; background: #000; box-shadow: 0 0 0 1px var(--plastic-edge); }
.ed-crop-canvas { width: 100%; height: 100%; display: block; }
.ed-grid { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent calc(33.33% - 2px), rgba(0,0,0,.7) calc(33.33% - 2px), rgba(0,0,0,.7) calc(33.33% + 2px), transparent calc(33.33% + 2px), transparent calc(66.66% - 2px), rgba(0,0,0,.7) calc(66.66% - 2px), rgba(0,0,0,.7) calc(66.66% + 2px), transparent calc(66.66% + 2px)),
              linear-gradient(0deg, transparent calc(33.33% - 2px), rgba(0,0,0,.7) calc(33.33% - 2px), rgba(0,0,0,.7) calc(33.33% + 2px), transparent calc(33.33% + 2px), transparent calc(66.66% - 2px), rgba(0,0,0,.7) calc(66.66% - 2px), rgba(0,0,0,.7) calc(66.66% + 2px), transparent calc(66.66% + 2px));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.ed-tip { margin: 0; text-align: center; color: var(--muted); font: .8rem var(--sans); }
.ed-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ghost.small { min-height: 40px; padding: 0 8px; border-radius: 12px; font-size: .85rem; gap: 6px; }
.ghost.small svg { width: 18px; height: 18px; }
.ed-slider { display: grid; grid-template-columns: 74px 1fr 46px; align-items: center; gap: 10px; color: var(--muted); font: 600 .85rem var(--sans); }
.ed-slider input { width: 100%; accent-color: var(--accent); }
.ed-val { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.ed-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font: 600 .85rem var(--sans); }
.ed-row b { color: var(--ink); font-size: .95rem; }
.ed-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.ed-swatch { aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; background: var(--c); cursor: pointer; padding: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -2px 0 rgba(0,0,0,.18); }
.ed-swatch.is-on { border-color: var(--ink); }
.ed-swatch.custom { position: relative; overflow: hidden; background: conic-gradient(#e24846, #f5d850, #4ca055, #3c80f0, #9c80e8, #e24846); }
.ed-color-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ed-color-input.inline { position: static; opacity: 1; width: 44px; height: 32px; border: 0; padding: 0; background: none; }
.ed-settings { display: flex; flex-direction: column; gap: 10px; }
.ed-set { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--plastic-edge); }
.ed-set small { color: var(--muted); font: .8rem/1.4 var(--sans); }
.ed-legal { margin: 2px 4px; color: var(--faint); font: .75rem/1.45 var(--sans); }
.ed-done { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.ed-done-card { width: min(100%, 380px); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ed-done-img { width: 220px; height: 220px; border-radius: 28px; box-shadow: var(--shadow); }
.ed-done-card h2 { margin: 6px 0 0; font: 800 1.45rem/1.2 var(--sans); }
.ed-done-card p { margin: 0 0 6px; color: var(--muted); font: .92rem/1.45 var(--sans); }

/* =====================================================================
   «Поделиться», результат, рейтинги
   ===================================================================== */
.share { position: fixed; inset: 0; z-index: 34; }
.share-backdrop { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(0,0,0,0); transition: background .2s ease; }
.share.open .share-backdrop { background: rgba(0,0,0,.45); }
.share-card { width: min(100%, 420px); display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 26px;
  background: var(--surface); border: 1px solid var(--plastic-edge); box-shadow: var(--shadow);
  transform: translateY(110%); transition: transform .3s cubic-bezier(.2,.9,.3,1.1); }
.share.open .share-card { transform: none; }
.share-head { display: flex; align-items: center; justify-content: space-between; }
.share-head b { font: 800 1.1rem var(--sans); }
.share-preview { width: 100%; max-width: 260px; aspect-ratio: 1; margin: 0 auto; border-radius: 22px; object-fit: cover; }
.share-caption, .share-status { margin: 0; text-align: center; color: var(--muted); font: .92rem var(--sans); }
.share-actions { display: flex; flex-direction: column; gap: 8px; }
.result-actions.three { grid-template-columns: 1fr 1fr; }
.result-actions.three .cta { grid-column: 1 / -1; }
.result-reason { margin: 4px 6px 0; color: var(--muted); font: .82rem/1.45 var(--sans); }
.result-reason:empty { display: none; }
.top-head { display: flex; flex-direction: column; gap: 8px; }
.top-cube { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font: .95rem var(--sans); color: var(--muted); }
.top-cube b { color: var(--ink); }
.board-seg { align-self: stretch; }
.board-seg button { flex: 1; }
.board-note { margin: 0 2px; color: var(--muted); font: .8rem/1.4 var(--sans); }
.alt-best { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--plastic-edge); font-family: var(--sans); }
.alt-label { flex: 1; color: var(--muted); font-size: .85rem; }
.alt-best b { font: 1.2rem var(--serif); font-variant-numeric: tabular-nums; }
.alt-place { color: var(--muted); font-size: .8rem; }
.tag.warn { background: var(--c-orange); }

/* картинка «на 3 грани» и цвет рамок */
.ed-sources.four { grid-template-columns: repeat(4, 1fr); }
.ed-sources.four .ed-src { font-size: .72rem; padding: 10px 2px; }
.ed-iso { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ed-iso path { fill: none; stroke: #8f6bff; stroke-width: 4; stroke-linejoin: round;
  filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 3px rgba(0,0,0,.6)); }
.ed-tools.two { grid-template-columns: 1fr 1fr; }
.ed-frames { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ed-frame { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px;
  border: 1px solid var(--plastic-edge); background: var(--surface-2); color: var(--muted); font: 600 .72rem var(--sans); cursor: pointer; overflow: hidden; }
.ed-frame i { width: 34px; height: 34px; border-radius: 9px; background: var(--c);
  background-image: linear-gradient(90deg, transparent 30%, var(--c) 30% 36%, transparent 36% 64%, var(--c) 64% 70%, transparent 70%),
                    linear-gradient(0deg, transparent 30%, var(--c) 30% 36%, transparent 36% 64%, var(--c) 64% 70%, transparent 70%);
  box-shadow: inset 0 0 0 4px var(--c), 0 0 0 1px rgba(127,127,127,.35); }
.ed-frame i { background-color: #e9e7ef; }
.ed-frame.custom i { --c: #888; background: conic-gradient(#e24846, #f5d850, #4ca055, #3c80f0, #9c80e8, #e24846); box-shadow: none; }
.ed-frame.is-on { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.frame-dots { display: flex; gap: 6px; }
.frame-dot { width: 30px; height: 30px; padding: 0; border-radius: 9px; border: 2px solid var(--plastic-edge); background: var(--c); cursor: pointer;
  box-shadow: inset 0 0 0 3px var(--surface); }
.frame-dot.is-on { border-color: var(--accent); }
