/* «Улица проектов». Тема задаётся переменными на контейнере или на :root. */
.sg {
  --sg-accent: #ff3b2f;
  --sg-accent-dark: #b8231b;
  --sg-accent2: #3d5afe;
  --sg-ink: #f4f1ea;
  --sg-bg: #090a1c;
  --sg-panel: #12122a;
  --sg-font-display: 'Dela Gothic One', Impact, sans-serif;
  --sg-font-text: 'Golos Text', system-ui, sans-serif;

  position: relative;
  width: 100%;
  height: clamp(340px, 72vh, 540px);
  overflow: hidden;
  background: var(--sg-bg);
  color: var(--sg-ink);
  font-family: var(--sg-font-text);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.sg:focus-visible { box-shadow: inset 0 0 0 2px var(--sg-accent2); }
.sg *, .sg *::before, .sg *::after { box-sizing: border-box; }
.sg [hidden] { display: none !important; }

.sg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

/* верхняя панель */
.sg-hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; pointer-events: none;
}
.sg-dots { display: flex; gap: 6px; opacity: 0; transition: opacity .3s; }
.sg.is-playing .sg-dots { opacity: 1; }
.sg-dots i { width: 8px; height: 8px; border: 1.5px solid var(--sg-ink); opacity: .55; }
.sg-dots i.is-on { background: var(--sg-accent); border-color: var(--sg-accent); opacity: 1; }
.sg-skip {
  pointer-events: auto;
  color: var(--sg-ink); font-size: 13px; text-decoration: none;
  padding: 8px 12px; border: 1px solid rgba(244,241,234,.35); background: rgba(9,10,28,.55);
}
.sg-skip:hover, .sg-skip:focus-visible { border-color: var(--sg-ink); }

.sg-hint {
  position: absolute; left: 50%; top: 52px; transform: translateX(-50%);
  font-size: 13px; padding: 6px 10px; background: rgba(9,10,28,.7); white-space: nowrap;
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.sg.is-playing .sg-hint { opacity: 1; }
.sg.is-playing .sg-hint.is-gone { opacity: 0; }

/* экранные кнопки */
.sg-pad {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 12px 12px; pointer-events: none;
  opacity: 0; transition: opacity .3s;
}
.sg.is-playing .sg-pad { opacity: 1; }
.sg-btn {
  pointer-events: auto;
  min-width: 52px; height: 52px; padding: 0 16px;
  font: 16px/1 var(--sg-font-display); color: var(--sg-ink);
  background: rgba(9,10,28,.72); border: 1.5px solid rgba(244,241,234,.45);
  touch-action: none; cursor: pointer;
}
.sg-btn:active { background: var(--sg-accent); border-color: var(--sg-accent); }
.sg-o { background: var(--sg-accent); border-color: var(--sg-accent); font-size: 15px; }

/* общие элементы панелей */
.sg-kicker { margin: 0 0 8px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; opacity: .7; }
.sg-title { margin: 0 0 10px; font: 400 clamp(26px, 6vw, 40px)/1 var(--sg-font-display); }
.sg-lead, .sg-text { margin: 0 0 16px; font-size: 15px; line-height: 1.45; max-width: 46ch; }
.sg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-cta, .sg-ghost {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  font: 15px/1 var(--sg-font-text); font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--sg-ink);
}
.sg-cta { background: var(--sg-accent); border-color: var(--sg-accent); color: #fff; }
.sg-ghost { background: transparent; color: var(--sg-ink); }
.sg-cta:focus-visible, .sg-ghost:focus-visible, .sg-btn:focus-visible, .sg-x:focus-visible, .sg-foot:focus-visible { outline: 2px solid var(--sg-accent2); outline-offset: 2px; }

/* заставка */
.sg-poster {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px 20px 28px;
  background: linear-gradient(180deg, rgba(9,10,28,0) 0%, rgba(9,10,28,.55) 35%, rgba(9,10,28,.94) 100%);
  transition: opacity .35s;
}
.sg-poster.is-gone { opacity: 0; pointer-events: none; }
.sg-poster .sg-title { font-size: clamp(32px, 9vw, 56px); }

/* карточка стенда */
.sg-card {
  --sg-hue: var(--sg-accent);
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  max-height: calc(100% - 20px); overflow: auto;
  padding: 20px 18px 18px;
  background: var(--sg-panel); border-top: 4px solid var(--sg-hue);
  animation: sg-up .28s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 720px) { .sg-card { left: auto; right: 16px; bottom: 16px; width: 440px; } }
.sg-card .sg-kicker { color: var(--sg-hue); opacity: 1; padding-right: 36px; }
.sg-stats { display: flex; flex-wrap: wrap; gap: 14px 22px; margin: 0 0 18px; }
.sg-stats div { display: flex; flex-direction: column; gap: 4px; }
.sg-stats b { font: 400 26px/1 var(--sg-font-display); color: var(--sg-hue); }
.sg-stats span { font-size: 12px; opacity: .75; max-width: 14ch; line-height: 1.25; }
.sg-x {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px;
  font-size: 26px; line-height: 1; color: var(--sg-ink); background: transparent; border: 0; cursor: pointer;
}
@keyframes sg-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.sg-toast {
  position: absolute; left: 50%; top: 56px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 14px 18px; background: var(--sg-panel); border: 1.5px solid var(--sg-accent);
  width: max-content; max-width: calc(100% - 24px);
}
.sg-toast b { font: 400 18px/1.1 var(--sg-font-display); }
.sg-toast span { font-size: 13px; opacity: .8; margin-bottom: 6px; }

/* забег */
.sg-run { position: absolute; inset: 0; background: #1d2a9a; display: flex; flex-direction: column; }
.sg-run-canvas { flex: 1 1 auto; width: 100%; min-height: 0; display: block; }
.sg-run-hud {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center;
  display: flex; justify-content: center; gap: 18px;
  font: 400 22px/1 var(--sg-font-display); pointer-events: none;
}
.sg-run-msg {
  position: absolute; left: 50%; top: 48px; transform: translateX(-50%);
  font-size: 14px; text-align: center; pointer-events: none; white-space: nowrap;
}
.sg-run-msg.is-big { top: 22%; font: 400 64px/1 var(--sg-font-display); }
.sg-run-msg.is-result {
  pointer-events: auto; white-space: normal; top: 50px;
  width: min(420px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left;
  padding: 18px; background: var(--sg-panel); border-top: 4px solid var(--sg-accent);
}
.sg-run-msg.is-result b { font: 400 28px/1 var(--sg-font-display); }
.sg-run-msg.is-result span { font-size: 14px; line-height: 1.4; opacity: .85; }
.sg-run-msg.is-result .sg-row { margin-top: 6px; }
.sg-run-pad { display: flex; gap: 10px; padding: 10px; background: #0f1340; }
.sg-foot {
  flex: 1; height: 84px; border: 1.5px solid rgba(244,241,234,.5); background: transparent; color: var(--sg-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  touch-action: none; cursor: pointer;
}
.sg-foot b { font: 400 30px/1 var(--sg-font-display); }
.sg-foot span { font-size: 12px; opacity: .7; }
.sg-foot.is-down { background: var(--sg-accent); border-color: var(--sg-accent); }
.sg-run .sg-x { z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .sg-card { animation: none; }
  .sg-poster, .sg-hint, .sg-pad, .sg-dots { transition: none; }
}
