:root {
  color-scheme: dark;
  --td23-bg: #07101d;
  --td23-panel: rgba(13, 23, 40, 0.96);
  --td23-panel-2: #111c30;
  --td23-line: rgba(151, 174, 214, 0.18);
  --td23-text: #f7f9ff;
  --td23-muted: #9aa9c1;
  --td23-blue: #6c8cff;
  --td23-blue-strong: #4f7cff;
  --td23-orange: #f5a623;
  --td23-orange-hover: #ffb33d;
  --td23-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --td23-toolbar-height: 76px;
  --td23-radius: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--td23-bg);
  color: var(--td23-text);
}

button, a { font: inherit; }
button { color: inherit; }

.td23-viewer {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% -10%, rgba(79, 124, 255, 0.18), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(245, 166, 35, 0.08), transparent 28%),
    var(--td23-bg);
}

.td23-toolbar {
  position: relative;
  z-index: 20;
  min-height: var(--td23-toolbar-height);
  max-height: 180px;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto auto auto;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--td23-line);
  background: var(--td23-panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
  overflow: hidden;
  transition: min-height .24s ease, max-height .24s ease, padding .24s ease, opacity .18s ease, transform .24s ease, border-color .24s ease;
}

.td23-brand-wrap,
.td23-brand,
.td23-actions,
.td23-device-switcher,
.td23-device-btn,
.td23-btn,
.td23-browser-cap,
.td23-toolbar-toggle,
.td23-toolbar-reveal {
  display: flex;
  align-items: center;
}

.td23-brand-wrap { min-width: 0; gap: 15px; }

.td23-brand {
  flex: 0 0 auto;
  gap: 9px;
  color: var(--td23-text);
  text-decoration: none;
}

.td23-brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--td23-blue), #8b6cff);
  box-shadow: 0 10px 28px rgba(79,124,255,.28), inset 0 1px rgba(255,255,255,.28);
  font-weight: 900;
  letter-spacing: -.08em;
}

.td23-brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.035em;
  white-space: nowrap;
}
.td23-brand-name span { color: var(--td23-blue); }

.td23-demo-meta {
  min-width: 0;
  padding-left: 15px;
  border-left: 1px solid var(--td23-line);
}

.td23-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--td23-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.td23-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #48d597;
  box-shadow: 0 0 0 4px rgba(72,213,151,.12);
}

.td23-demo-title {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--td23-text);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td23-device-switcher {
  justify-self: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--td23-line);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.td23-device-btn {
  gap: 7px;
  height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--td23-muted);
  cursor: pointer;
  transition: .18s ease;
}

.td23-device-btn:hover { color: var(--td23-text); background: rgba(255,255,255,.055); }
.td23-device-btn.is-active {
  color: #fff;
  background: rgba(108,140,255,.18);
  box-shadow: inset 0 0 0 1px rgba(108,140,255,.28);
}

.td23-device-btn svg,
.td23-btn svg,
.td23-icon-btn svg,
.td23-browser-cap svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.td23-device-btn span { font-size: 12px; font-weight: 700; }

.td23-actions { justify-self: end; gap: 8px; }

.td23-label-mobile { display: none; }

.td23-toolbar-toggle {
  justify-self: end;
  width: auto;
  gap: 7px;
  padding: 0 11px;
}

.td23-toolbar-toggle span {
  font-size: 11px;
  font-weight: 800;
}

.td23-toolbar-reveal {
  position: fixed;
  z-index: 80;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  height: 40px;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid rgba(151,174,214,.3);
  border-radius: 11px;
  background: rgba(13,23,40,.92);
  color: var(--td23-text);
  box-shadow: 0 12px 34px rgba(0,0,0,.3);
  backdrop-filter: blur(16px);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-16px);
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease, background .16s ease;
}

.td23-toolbar-reveal:hover { background: rgba(22,34,56,.97); }
.td23-toolbar-reveal svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.td23-toolbar-reveal span { font-size: 11px; font-weight: 800; }

.td23-viewer.is-toolbar-collapsed .td23-toolbar {
  min-height: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
}

.td23-viewer.is-toolbar-collapsed .td23-toolbar-reveal {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.td23-viewer.is-toolbar-collapsed .td23-stage {
  height: 100%;
}

.td23-viewer.is-toolbar-collapsed .td23-browser-cap { display: none; }
.td23-viewer.is-toolbar-collapsed .td23-frame-wrap { height: 100%; }

.td23-viewer.is-toolbar-collapsed[data-device="desktop"] .td23-stage { padding: 0; }
.td23-viewer.is-toolbar-collapsed[data-device="desktop"] .td23-device-shell {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}


.td23-btn,
.td23-icon-btn {
  height: 40px;
  border-radius: 10px;
  text-decoration: none;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.td23-btn {
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.td23-btn:hover, .td23-icon-btn:hover { transform: translateY(-1px); }

.td23-btn-secondary {
  color: var(--td23-text);
  border-color: var(--td23-line);
  background: rgba(255,255,255,.04);
}
.td23-btn-secondary:hover { border-color: rgba(108,140,255,.5); background: rgba(108,140,255,.09); }

.td23-btn-primary {
  color: #15100a;
  background: var(--td23-orange);
  box-shadow: 0 10px 24px rgba(245,166,35,.18);
}
.td23-btn-primary:hover { background: var(--td23-orange-hover); }

.td23-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  padding: 0;
  border: 1px solid var(--td23-line);
  background: rgba(255,255,255,.035);
  cursor: pointer;
}

.td23-stage {
  height: calc(100% - var(--td23-toolbar-height));
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  transition: height .24s ease, padding .24s ease;
}

.td23-device-shell {
  --td23-device-width: 100%;
  width: min(var(--td23-device-width), 100%);
  min-width: 0;
  height: 100%;
  min-height: 540px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--td23-line);
  border-radius: var(--td23-radius);
  background: #fff;
  box-shadow: var(--td23-shadow);
  transition: width .28s cubic-bezier(.2,.8,.2,1), height .24s ease, border-radius .28s ease, box-shadow .24s ease;
}

.td23-viewer[data-device="desktop"] .td23-device-shell { border-radius: 12px; }
.td23-viewer[data-device="tablet"] .td23-device-shell { border-radius: 20px; }
.td23-viewer[data-device="mobile"] .td23-device-shell { border-radius: 26px; }

.td23-browser-cap {
  height: 38px;
  gap: 6px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(9,19,34,.13);
  background: #eef2f8;
  color: #526179;
}

.td23-browser-cap > span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c8d0dc;
}
.td23-browser-cap > span:first-child { background: #ff736b; }
.td23-browser-cap > span:nth-child(2) { background: #f6c74f; }
.td23-browser-cap > span:nth-child(3) { background: #62cb77; }

.td23-address {
  min-width: 0;
  flex: 1;
  margin-left: 8px;
  padding: 6px 12px;
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  color: #5f6f86;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td23-browser-cap a {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #65748a;
}
.td23-browser-cap a:hover { background: rgba(76,99,130,.1); }

.td23-frame-wrap { position: relative; height: calc(100% - 38px); background: #fff; }

#td23DemoFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.td23-loader {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  background: #f6f8fc;
  color: #15233a;
  text-align: center;
  transition: opacity .22s ease, visibility .22s ease;
}
.td23-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.td23-loader strong { font-size: 16px; }
.td23-loader small { color: #6c7b91; }

.td23-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(79,124,255,.2);
  border-top-color: var(--td23-blue-strong);
  border-radius: 50%;
  animation: td23-spin .75s linear infinite;
}
@keyframes td23-spin { to { transform: rotate(360deg); } }

.td23-error {
  max-width: 540px;
  margin: 9vh auto 0;
  padding: 42px;
  border: 1px solid var(--td23-line);
  border-radius: 22px;
  background: var(--td23-panel-2);
  box-shadow: var(--td23-shadow);
  text-align: center;
}
.td23-error-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: rgba(245,166,35,.15);
  color: var(--td23-orange);
  font-size: 28px;
  font-weight: 900;
}
.td23-error h1 { margin: 0 0 10px; font-size: 27px; }
.td23-error p { margin: 0 0 24px; color: var(--td23-muted); line-height: 1.6; }
.td23-error .td23-btn { display: inline-flex; }

/*
 * В режиме «Компьютер» iframe получает высоту полноценного окна браузера,
 * а не только свободного пространства под панелью просмотрщика. Это важно
 * для сайтов, где размеры hero-изображений и секций зависят от vh.
 */
@media (min-width: 761px) {
  .td23-viewer[data-device="desktop"] .td23-device-shell {
    height: calc(100vh + 38px);
    height: calc(100dvh + 38px);
  }
}

@media (max-width: 1120px) {
  :root { --td23-toolbar-height: 70px; }
  .td23-toolbar { grid-template-columns: minmax(210px, 1fr) auto auto auto; gap: 10px; padding-inline: 12px; }
  .td23-brand-name, .td23-device-btn span, .td23-btn-secondary .td23-label-desktop, .td23-toolbar-toggle span { display: none; }
  .td23-device-btn { width: 38px; justify-content: center; padding: 0; }
  .td23-btn-secondary { width: 40px; padding: 0; }
}

@media (max-width: 760px) {
  :root { --td23-toolbar-height: 104px; }
  .td23-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand collapse"
      "actions actions";
    align-content: center;
    gap: 7px 9px;
    padding: 8px 9px;
  }
  .td23-brand-wrap { grid-area: brand; gap: 9px; }
  .td23-toolbar-toggle { grid-area: collapse; height: 36px; padding-inline: 10px; }
  .td23-toolbar-toggle span { display: inline; }
  .td23-actions {
    grid-area: actions;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1.08fr;
    gap: 6px;
  }
  /* На телефоне сам экран уже задаёт мобильную ширину.
     Переключатели «Компьютер / Планшет / Телефон» здесь только занимают место. */
  .td23-device-switcher { display: none; }
  .td23-brand-name { display: none; }
  .td23-demo-meta { padding-left: 9px; }
  .td23-status { font-size: 8px; }
  .td23-demo-title { max-width: 56vw; margin-top: 2px; font-size: 11px; }
  .td23-reload-btn { display: none; }
  .td23-actions .td23-btn {
    width: 100%;
    height: 35px;
    gap: 6px;
    padding: 0 7px;
    font-size: 10px;
  }
  .td23-actions .td23-btn-secondary .td23-label-desktop,
  .td23-actions .td23-btn-primary .td23-label-desktop { display: none; }
  .td23-actions .td23-label-mobile { display: inline; }
  .td23-actions .td23-btn svg { width: 16px; height: 16px; }
  .td23-stage { padding: 0; }
  .td23-browser-cap { display: none; }
  .td23-frame-wrap { height: 100%; }
  .td23-device-shell {
    min-height: 500px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .td23-toolbar-reveal { top: max(8px, env(safe-area-inset-top)); right: 8px; height: 38px; padding-inline: 11px; }
  .td23-viewer.is-toolbar-collapsed .td23-stage { padding: 0; }
}

@media (max-width: 430px) {
  :root { --td23-toolbar-height: 102px; }
  .td23-device-btn span { font-size: 9px; }
  .td23-demo-title { max-width: 52vw; }
  .td23-toolbar-toggle span { display: none; }
  .td23-toolbar-toggle { width: 36px; padding: 0; justify-content: center; }
  .td23-actions .td23-btn { font-size: 9px; }
  .td23-toolbar-reveal span { display: none; }
  .td23-toolbar-reveal { width: 38px; padding: 0; justify-content: center; }
}
