/* TW IP BARE — extension download hub */
.tw-ext-head { margin-bottom: 1.5rem; }
.tw-ext-lead { max-width: 52ch; }

.tw-ext-tutorial {
  margin-bottom: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.94), rgba(8, 17, 35, 0.9));
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.28);
  overflow: hidden;
}

.tw-ext-tutorial-teaser {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tw-ext-tutorial-teaser:hover {
  background: rgba(14, 165, 233, 0.06);
}

.tw-ext-tutorial-teaser-icon {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: #e0f2fe;
  background: linear-gradient(135deg, #0284c7, #06b6d4);
}

.tw-ext-tutorial-teaser-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.tw-ext-tutorial-teaser-title {
  font-size: 0.92rem;
  color: #e2e8f0;
}

.tw-ext-tutorial-teaser-hint {
  font-size: 0.78rem;
  line-height: 1.35;
}

.tw-ext-tutorial-teaser-action {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(14, 165, 233, 0.1);
}

.tw-ext-tutorial.is-collapsed .tw-ext-tutorial-panel {
  display: none;
}

.tw-ext-tutorial:not(.is-collapsed) .tw-ext-tutorial-teaser {
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
}

@media (min-width: 769px) {
  .tw-ext-tutorial:not(.is-collapsed) .tw-ext-tutorial-panel {
    display: block;
    padding-top: 0.15rem;
  }
}

.tw-ext-tutorial-panel {
  padding: 0 0.9rem 0.85rem;
}

.tw-ext-tutorial-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.tw-ext-tutorial-title {
  margin: 0;
  font-size: 0.95rem;
}

.tw-ext-tutorial-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #020617;
  aspect-ratio: 16 / 9;
  max-width: 520px;
  max-height: 292px;
  margin: 0 auto;
}

.tw-ext-tutorial-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.tw-ext-tutorial-watermark {
  position: absolute;
  right: 0.55rem;
  bottom: 0.45rem;
  padding: 0.18rem 0.4rem;
  border-radius: 6px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(2, 6, 23, 0.55);
  pointer-events: none;
  user-select: none;
}

.tw-ext-tutorial-status {
  margin: 0.45rem 0 0;
  font-size: 0.74rem;
  text-align: center;
}

.tw-ext-tutorial-status.err {
  color: #f87171;
}

.tw-ext-tutorial-backdrop {
  display: none;
}

body.tw-ext-tutorial-open .tw-ext-tutorial-backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(4px);
}

body.tw-ext-page.tw-ext-tutorial-open {
  overflow: hidden;
}

.tw-ext-setup {
  margin-bottom: 1.75rem;
}

.tw-ext-setup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tw-ext-setup-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.tw-ext-setup-hint {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.tw-ext-setup-badge {
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.tw-ext-setup-badge.is-ready {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.35);
}

.tw-ext-steps {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .tw-ext-steps { grid-template-columns: 1fr 1fr; }
}

.tw-ext-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  border-radius: 16px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(8, 17, 35, 0.88));
  box-shadow: 0 12px 40px rgba(2, 6, 23, 0.35);
}

.tw-ext-step.is-complete {
  border-color: rgba(74, 222, 128, 0.28);
}

.tw-ext-step.is-complete .tw-ext-step-num {
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.tw-ext-step-num {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #e0f2fe;
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
}

.tw-ext-step h3,
.tw-ext-step h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.tw-ext-step-status { margin: 0.65rem 0 0; font-size: 0.9rem; }
.tw-ext-step-status.ok { color: #4ade80; }
.tw-ext-step-status.err { color: #f87171; }

.tw-ext-catalog-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

.tw-ext-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .tw-ext-grid { grid-template-columns: 1fr 1fr; }
}

.tw-ext-card {
  display: grid;
  grid-template-rows: auto auto;
  gap: 1rem;
  padding: 1.35rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 55%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.92));
  min-height: 100%;
}

.tw-ext-card-top {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.tw-ext-card-body {
  min-width: 0;
  flex: 1;
}

.tw-ext-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

.tw-ext-card-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.tw-ext-card-title { margin: 0.2rem 0 0.45rem; font-size: 1.2rem; }
.tw-ext-card-desc { margin: 0; color: #94a3b8; line-height: 1.5; }
.tw-ext-card-meta { margin: 0.75rem 0 0; font-size: 0.85rem; color: #64748b; }

.tw-ext-card-actions {
  display: grid;
  gap: 0.65rem;
}

.tw-ext-note-short { display: none; }

.tw-ext-card-note { margin: 0.25rem 0 0; font-size: 0.78rem; line-height: 1.45; }
.tw-ext-card-feedback { margin: 0; min-height: 1.2em; font-size: 0.88rem; }
.tw-ext-card-feedback.ok { color: #4ade80; }
.tw-ext-card-feedback.err { color: #f87171; }

.tw-ext-hint { margin-top: 1rem; text-align: center; }

.tw-ext-security-banner {
  margin-bottom: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: linear-gradient(145deg, rgba(69, 10, 10, 0.45), rgba(15, 23, 42, 0.88));
  color: #fecaca;
}

.tw-ext-security-banner strong {
  display: block;
  margin-bottom: 0.45rem;
  color: #f87171;
  letter-spacing: 0.03em;
}

.tw-ext-security-banner ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  color: #fca5a5;
  font-size: 0.9rem;
  line-height: 1.45;
}

body.tw-ext-terms-open { overflow: hidden; }

.tw-ext-terms-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
}

.tw-ext-terms-dialog {
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 1.35rem 1.45rem 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
  box-shadow: 0 28px 80px rgba(2, 6, 23, 0.55);
}

.tw-ext-terms-head h2 { margin: 0.25rem 0 0.55rem; }
.tw-ext-terms-package { margin: 0.75rem 0 0; color: #bae6fd; }
.tw-ext-terms-body h3 { margin: 0 0 0.65rem; font-size: 1rem; }
.tw-ext-terms-body ul {
  margin: 0 0 0.9rem;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.4rem;
  color: #cbd5e1;
  line-height: 1.45;
}
.tw-ext-terms-legal { margin: 0; font-size: 0.88rem; }
.tw-ext-terms-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
  margin: 1rem 0;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  line-height: 1.45;
}
.tw-ext-terms-check input { margin-top: 0.2rem; }
.tw-ext-terms-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
}

/* Public one-time install page */
.tw-ext-install {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem 3rem;
}

.tw-ext-install-card {
  width: min(560px, 100%);
  padding: 1.75rem;
  border-radius: 20px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.94));
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.tw-ext-install-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.tw-ext-install-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #0284c7, #06b6d4);
}

.tw-ext-install-steps {
  margin: 0 0 1.25rem;
  padding-left: 1.1rem;
  display: grid;
  gap: 1rem;
}

.tw-ext-install-steps li { line-height: 1.45; }
.tw-ext-install-steps .tw-form-input { margin-top: 0.5rem; width: 100%; }
.tw-ext-install-error {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.tw-ext-install-btn { width: 100%; }
.tw-ext-install-foot { margin-top: 1rem; font-size: 0.82rem; text-align: center; }

.tw-admin-ext-tel-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tw-ext-tutorial-admin-summary {
  margin-bottom: 1rem;
}

.tw-ext-tutorial-admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.tw-ext-tutorial-stat {
  min-width: 8.5rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: rgba(14, 165, 233, 0.08);
}

.tw-ext-tutorial-stat strong {
  display: block;
  font-size: 1.35rem;
  color: #7dd3fc;
  line-height: 1.1;
}

.tw-ext-tutorial-stat span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.76rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tw-ext-tutorial-viewers-wrap {
  margin-bottom: 1rem;
}

/* ─── Mobile: extensions hub + install link page ─── */

@media (max-width: 768px) {
  body.extensions-page .tw-ext-page {
    display: flex;
    flex-direction: column;
  }

  body.extensions-page .tw-ext-head { order: 1; }
  body.extensions-page .tw-ext-security-banner { order: 2; }
  body.extensions-page .tw-ext-setup { order: 3; }
  body.extensions-page .tw-ext-catalog { order: 4; }
  body.extensions-page .tw-ext-tutorial { order: 5; }
  body.extensions-page .tw-ext-hint { order: 6; }

  body.extensions-page .tw-ext-head {
    margin-bottom: 0.85rem;
  }

  body.extensions-page .tw-ext-head h1 {
    font-size: clamp(1.35rem, 5.5vw, 1.65rem);
    line-height: 1.15;
  }

  body.extensions-page .tw-ext-lead {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .tw-ext-tutorial {
    margin-bottom: 0.85rem;
    border-radius: 12px;
  }

  .tw-ext-tutorial-teaser {
    padding: 0.65rem 0.75rem;
    gap: 0.65rem;
  }

  .tw-ext-tutorial-teaser-icon {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.65rem;
  }

  .tw-ext-tutorial-teaser-title {
    font-size: 0.88rem;
  }

  .tw-ext-tutorial-teaser-hint {
    font-size: 0.74rem;
  }

  .tw-ext-tutorial-teaser-action {
    font-size: 0.72rem;
    padding: 0.32rem 0.6rem;
  }

  body.tw-ext-tutorial-open .tw-ext-tutorial-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    margin: 0;
    padding: 0.85rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    border: 1px solid rgba(56, 189, 248, 0.28);
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96));
    box-shadow: 0 -16px 48px rgba(2, 6, 23, 0.55);
    max-height: min(78dvh, 640px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tw-ext-tutorial-frame {
    max-width: none;
    max-height: none;
    width: 100%;
  }

  .tw-ext-tutorial-watermark {
    font-size: 0.6rem;
    right: 0.4rem;
    bottom: 0.35rem;
  }

  .tw-ext-security-banner {
    padding: 0.85rem 0.95rem;
    margin-bottom: 1rem;
  }

  .tw-ext-security-banner strong {
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
  }

  .tw-ext-security-banner ul {
    font-size: 0.84rem;
    gap: 0.4rem;
    padding-left: 1rem;
  }

  .tw-ext-setup {
    margin-bottom: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(56, 189, 248, 0.22);
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(8, 17, 35, 0.92));
    box-shadow: 0 10px 32px rgba(2, 6, 23, 0.35);
    overflow: hidden;
  }

  .tw-ext-setup-head {
    margin-bottom: 0;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.14);
    background: rgba(14, 165, 233, 0.06);
  }

  .tw-ext-setup-title {
    font-size: 0.98rem;
  }

  .tw-ext-setup-hint {
    font-size: 0.84rem;
  }

  .tw-ext-setup-badge {
    align-self: center;
    font-size: 0.68rem;
  }

  .tw-ext-steps {
    gap: 0;
    margin-bottom: 0;
  }

  .tw-ext-step {
    grid-template-columns: auto 1fr;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(56, 189, 248, 0.12);
    box-shadow: none;
    background: transparent;
  }

  .tw-ext-step:last-child {
    border-bottom: none;
  }

  .tw-ext-step h3 {
    font-size: 0.98rem;
  }

  .tw-ext-step .tw-muted {
    font-size: 0.86rem;
    line-height: 1.5;
  }

  .tw-ext-step .tw-btn {
    width: 100%;
    min-height: 46px;
    margin-top: 0.45rem;
    font-size: 0.95rem;
  }

  .tw-ext-step-status {
    display: block;
    margin-top: 0.55rem;
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .tw-ext-step .tw-turnstile-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    margin-top: 0.45rem;
  }

  .tw-ext-catalog-title {
    font-size: 0.98rem;
    margin-bottom: 0.75rem;
  }

  .tw-ext-grid {
    gap: 0.85rem;
  }

  .tw-ext-card {
    padding: 1rem;
    gap: 0.85rem;
    border-radius: 16px;
  }

  .tw-ext-card-top {
    gap: 0.75rem;
  }

  .tw-ext-card-icon {
    width: 2.85rem;
    height: 2.85rem;
    font-size: 1.2rem;
    border-radius: 12px;
  }

  .tw-ext-card-title {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .tw-ext-card-desc {
    font-size: 0.88rem;
  }

  .tw-ext-card-meta {
    font-size: 0.78rem;
    line-height: 1.45;
    word-break: break-word;
  }

  .tw-ext-card-actions {
    gap: 0.55rem;
  }

  .tw-ext-card-actions .tw-btn {
    width: 100%;
    min-height: 46px;
    font-size: 0.95rem;
  }

  .tw-ext-download-btn {
    font-weight: 700;
  }

  .tw-ext-note-full { display: none; }
  .tw-ext-note-short { display: inline; }

  .tw-ext-card-note {
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: center;
  }

  .tw-ext-card-feedback {
    font-size: 0.84rem;
    line-height: 1.45;
    text-align: center;
  }

  .tw-ext-terms-overlay {
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    align-items: center;
  }

  .tw-ext-terms-dialog {
    width: 100%;
    max-height: min(90dvh, 920px);
    padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-radius: 16px;
    display: grid;
    grid-template-rows: auto 1fr auto;
  }

  .tw-ext-terms-head h2 {
    font-size: 1.12rem;
    line-height: 1.25;
  }

  .tw-ext-terms-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tw-ext-terms-body ul {
    font-size: 0.9rem;
  }

  .tw-ext-terms-check {
    font-size: 0.9rem;
  }

  .tw-ext-terms-actions {
    flex-direction: column-reverse;
    gap: 0.55rem;
    padding-top: 0.35rem;
  }

  .tw-ext-terms-actions .tw-btn {
    width: 100%;
    min-height: 46px;
  }

  .tw-ext-install {
    min-height: auto;
    padding: 1rem 0.85rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    align-items: start;
  }

  .tw-ext-install-card {
    padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
    border-radius: 16px;
  }

  .tw-ext-install-head {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .tw-ext-install-head h1 {
    font-size: 1.25rem;
    line-height: 1.2;
  }

  .tw-ext-install-steps {
    padding-left: 1rem;
    gap: 0.85rem;
  }

  .tw-ext-install-steps .tw-btn {
    width: 100%;
    min-height: 46px;
  }

  .tw-ext-install-steps .tw-ext-step-status {
    display: block;
    margin-top: 0.45rem;
  }

  .tw-ext-install-btn {
    min-height: 48px;
    font-size: 1rem;
  }

  .tw-ext-install-foot {
    font-size: 0.8rem;
    line-height: 1.5;
  }
}

@media (max-width: 400px) {
  .tw-ext-step-num {
    width: 2rem;
    height: 2rem;
    font-size: 0.88rem;
  }
}
