/* Teacher Space: la sala de profes (feed, composer, weekly challenge), the tutorial video
   page, and the tip other pages show. */

.teacher-space-page {
  --ts-radius: 12px;
  --ts-kind: var(--brand-yellow);
  --ts-kind-soft: var(--brand-yellow-soft);
}

.teacher-space-page [hidden] { display: none !important; }

.ts-kind-estrategia { --ts-kind: #4326c9; --ts-kind-soft: #eeeaff; }
.ts-kind-dinamica { --ts-kind: #0e7556; --ts-kind-soft: #dff4ec; }
.ts-kind-pregunta { --ts-kind: #05607d; --ts-kind-soft: #e3f6fd; }
.ts-kind-logro { --ts-kind: #9a5a00; --ts-kind-soft: #fdf3dc; }
.ts-kind-recurso { --ts-kind: #3f4766; --ts-kind-soft: #eef1f6; }

/* ---- Hero ---- */

.ts-room-hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 28px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 28px;
  background-color: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-panel);
}

.ts-room-hero-text { position: relative; z-index: 1; max-width: 60ch; }
.ts-room-hero .eyebrow { color: var(--muted); }
.ts-room-hero h1 { margin: 0 0 6px; color: var(--text); font-size: clamp(1.8rem, 3.4vw, 2.3rem); line-height: 1.1; letter-spacing: -0.02em; }
.ts-room-hero p { margin: 0; color: var(--muted); font-size: 1rem; font-weight: 400; }

.ts-pulse {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.ts-pulse > div {
  min-width: 104px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--surface-soft);
}

.ts-pulse dt { color: var(--muted); font-size: 0.75rem; font-weight: 500; line-height: 1.2; }
.ts-pulse dd { margin: 2px 0 0; color: var(--text); font-family: "Sora", sans-serif; font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.ts-pulse div:last-child dd { color: #0e7556; }

/* ---- Layout ---- */

.ts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}

.ts-main { display: grid; gap: 16px; min-width: 0; }

.ts-rail {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
}

/* ---- Weekly challenge ---- */

.ts-challenge {
  position: relative;
  overflow: hidden;
  border: 1px solid #bfe8f7;
  border-radius: var(--ts-radius);
  padding: 20px 22px;
  background-color: #e3f6fd;
  box-shadow: none;
}

.ts-challenge-eyebrow {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #05394a;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ts-challenge h2 { margin: 0 0 4px; color: var(--brand-navy); font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.2; }
.ts-challenge > p:not(.ts-challenge-eyebrow) { margin: 0; color: #2c4b57; font-weight: 400; }
.ts-challenge-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.ts-challenge-faces { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.ts-challenge-faces:empty { display: none; }
.ts-challenge-faces p { margin: 0; color: #05394a; font-size: 0.88rem; font-weight: 500; }

.ts-faces { display: inline-flex; }
.ts-faces .ts-avatar + .ts-avatar { margin-left: -8px; }
.ts-faces .ts-avatar { box-shadow: 0 0 0 2px #e3f6fd; }

/* ---- Avatars ---- */

.ts-avatar {
  display: inline-grid;
  flex: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  font-size: 0.95rem;
  font-weight: 1000;
  letter-spacing: 0.02em;
}

.ts-avatar-sm { width: 32px; height: 32px; font-size: 0.72rem; }
.ts-avatar-photo { object-fit: cover; background: var(--surface-soft); }

.ts-tone-0 { background: #eeeaff; color: #4326c9; }
.ts-tone-1 { background: #e3f6fd; color: #05607d; }
.ts-tone-2 { background: #dff4ec; color: #0e7556; }
.ts-tone-3 { background: #fdecea; color: #b42318; }
.ts-tone-4 { background: #fdf3dc; color: #9a5a00; }
.ts-tone-5 { background: #eef1f6; color: #3f4766; }

/* ---- Composer ---- */

.ts-composer {
  border: 1px solid var(--line);
  border-radius: var(--ts-radius);
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  scroll-margin-top: 16px;
}

.ts-composer-prompt {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  padding: 6px 6px 6px 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.ts-composer-prompt > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--surface-soft);
  transition: border-color 160ms ease, background 160ms ease;
}

.ts-composer-prompt:hover > span:nth-child(2) { border-color: var(--brand-cyan); background: #fff; }
.ts-composer-prompt:focus-visible { outline: 3px solid var(--brand-cyan); outline-offset: 3px; }

.ts-composer-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 10px 16px;
  background-color: var(--brand-cyan-strong);
  color: #fff;
  font-weight: 600;
}

.ts-composer-cta .ui-icon { width: 18px; height: 18px; }
.ts-composer.is-open .ts-composer-prompt { display: none; }

.ts-compose-form,
.ts-edit-form { display: grid; gap: 14px; padding: 8px; }
.ts-edit-form { padding: 0; margin-top: 4px; }

.ts-kinds,
.ts-level-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; border: 0; padding: 0; min-width: 0; }

.ts-kinds legend,
.ts-level-options legend,
.ts-field > span {
  width: 100%;
  margin-bottom: 6px;
  padding: 0;
  color: var(--brand-navy);
  font-size: 0.9rem;
  font-weight: 1000;
}

.ts-kinds legend small,
.ts-level-options legend small,
.ts-field > span small { color: var(--muted); font-weight: 760; }

.ts-kind-option,
.ts-level-option { position: relative; cursor: pointer; }

.ts-kind-option input,
.ts-level-option input { position: absolute; opacity: 0; pointer-events: none; }

.ts-kind-option > span,
.ts-level-option > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: var(--brand-navy);
  font-weight: 900;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.ts-level-option > span { min-height: 34px; padding: 0 12px; font-size: 0.88rem; }
.ts-kind-option:hover > span,
.ts-level-option:hover > span { border-color: var(--brand-cyan); }

.ts-kind-option input:checked + span { border-color: var(--brand-navy); background: var(--ts-kind-soft); box-shadow: inset 0 0 0 1px var(--brand-navy); }
.ts-level-option input:checked + span { border-color: var(--brand-navy); background: var(--brand-navy); color: #fff; }

.ts-kind-option input:focus-visible + span,
.ts-level-option input:focus-visible + span { outline: 3px solid var(--brand-cyan); outline-offset: 2px; }

.ts-field { display: grid; min-width: 0; }

.ts-field input,
.ts-field textarea,
.ts-comment-form textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  line-height: 1.5;
  transition: border-color 140ms ease, background 140ms ease;
}

.ts-field textarea { min-height: 150px; resize: vertical; }
.ts-field input:focus,
.ts-field textarea:focus,
.ts-comment-form textarea:focus { border-color: var(--brand-cyan); background: #fff; outline: 3px solid rgba(123, 92, 255, 0.18); }

.ts-field-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }

.ts-answering {
  margin: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #e3f6fd;
  color: #05394a;
  font-weight: 800;
}

.ts-privacy { margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 760; }

.ts-form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.ts-form-status { flex: 1; min-width: 160px; margin: 0; color: var(--muted); font-weight: 800; }
.ts-form-status.is-error { color: #a32222; }
.ts-form-status:empty { visibility: hidden; }

/* ---- Filters ---- */

.ts-filters { display: grid; gap: 10px; scroll-margin-top: 16px; }

.ts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px;
}

.ts-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: var(--brand-navy);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.ts-chip:hover { border-color: var(--brand-cyan); }
.ts-chip[aria-pressed="true"] { border-color: var(--brand-navy); background: var(--brand-navy); color: #fff; }
.ts-chip:focus-visible { outline: 3px solid var(--brand-cyan); outline-offset: 2px; }

.ts-filter-row { display: flex; flex-wrap: wrap; gap: 10px; }

.ts-search {
  position: relative;
  display: flex;
  flex: 1 1 240px;
  align-items: center;
}

.ts-search .ui-icon { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

.ts-search input,
.ts-level-filter select {
  width: 100%;
  min-height: 44px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0 16px 0 40px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.ts-level-filter select { padding-left: 16px; cursor: pointer; }
.ts-level-filter { flex: 0 1 220px; }
.ts-search input:focus,
.ts-level-filter select:focus { border-color: var(--brand-cyan); outline: 3px solid rgba(123, 92, 255, 0.18); }

.ts-active-filter { margin: 0; color: #05394a; font-weight: 800; }

/* ---- Feed and posts ---- */

.ts-feed { display: grid; gap: 14px; }

.ts-post {
  position: relative;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--ts-radius);
  padding: 18px 20px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  scroll-margin-top: 16px;
}

.ts-post::before { display: none; }

.ts-post.is-pinned { border-color: rgba(123, 92, 255, 0.45); }
.ts-post.is-new { animation: ts-arrive 900ms ease; }

@keyframes ts-arrive {
  0% { transform: translateY(-8px) scale(0.98); box-shadow: 0 0 0 6px rgba(147, 245, 134, 0.6); }
  100% { transform: none; box-shadow: var(--shadow-card); }
}

.ts-post-head { display: flex; align-items: center; gap: 12px; }
.ts-post-meta { flex: 1; min-width: 0; }
.ts-post-meta p { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 760; }
.ts-post-meta strong { color: var(--brand-navy); font-size: 1rem; font-weight: 1000; }

.ts-role {
  display: inline-block;
  margin-left: 4px;
  border-radius: 999px;
  padding: 1px 8px;
  background: var(--brand-cyan-soft);
  color: var(--brand-cyan-strong);
  font-size: 0.7rem;
  font-weight: 1000;
  vertical-align: 2px;
}

.ts-kind-badge {
  flex: none;
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--ts-kind-soft);
  color: var(--brand-navy);
  font-size: 0.82rem;
  font-weight: 1000;
}

.ts-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.ts-flag { border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; font-weight: 1000; }
.ts-flag-pin { background: var(--brand-cyan-soft); color: var(--brand-cyan-strong); }
.ts-flag-tested { background: var(--accent-green-soft); color: #0e7556; box-shadow: inset 0 0 0 1px rgba(14, 117, 86, 0.25); }

.ts-post-title { margin: 2px 0 0; font-size: 1.22rem; line-height: 1.25; }
.ts-post-title a { color: var(--brand-navy); text-decoration: none; }
.ts-post-title a:hover { text-decoration: underline; text-decoration-color: var(--ts-kind); text-decoration-thickness: 3px; text-underline-offset: 3px; }

.ts-post-challenge { margin: 0; color: #05607d; font-size: 0.86rem; font-weight: 900; }

.ts-rich { color: var(--text); font-weight: 650; line-height: 1.6; overflow-wrap: anywhere; }
.ts-rich p { margin: 0 0 0.7em; }
.ts-rich p:last-child { margin-bottom: 0; }
.ts-rich a { color: var(--brand-cyan-strong); font-weight: 900; }

.ts-post-body.is-clamped {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

.ts-post-body.is-clamped p { display: inline; }
.ts-post-body.is-clamped p + p::before { content: "\A\A"; white-space: pre; }

.ts-link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--brand-cyan-strong);
  font: inherit;
  font-weight: 1000;
  cursor: pointer;
}

.ts-link-button:hover { text-decoration: underline; }
.ts-more-button { justify-self: start; margin-top: -4px; }

.ts-post-link {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  background: var(--surface-soft);
  color: var(--brand-navy);
  text-decoration: none;
}

.ts-post-link:hover { border-color: var(--brand-cyan); }
.ts-post-link .ui-icon { flex: none; width: 20px; height: 20px; color: var(--brand-cyan-strong); }
.ts-post-link span { display: grid; min-width: 0; }
.ts-post-link small { overflow: hidden; color: var(--muted); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.ts-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ts-tags button {
  border: 0;
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 900;
  cursor: pointer;
}

.ts-tags button::before { content: "#"; opacity: 0.6; }
.ts-tags button:hover { background: var(--brand-cyan-soft); color: var(--brand-cyan-strong); }

/* Reactions */

.ts-reactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

.ts-reaction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: var(--brand-navy);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.ts-reaction:hover:not(:disabled) { border-color: var(--brand-navy); transform: translateY(-1px); }
.ts-reaction:focus-visible { outline: 3px solid var(--brand-cyan); outline-offset: 2px; }
.ts-reaction:disabled { cursor: default; opacity: 0.75; }
.ts-reaction:disabled:not(:has(.ts-reaction-count)) { display: none; }
.ts-reaction-icon { display: inline-flex; }
.ts-reaction-icon .ui-icon { width: 16px; height: 16px; }

.ts-reaction-count {
  min-width: 22px;
  border-radius: 999px;
  padding: 1px 7px;
  background: var(--surface-soft);
  font-size: 0.8rem;
  text-align: center;
}

.ts-reaction.is-on { border-color: var(--brand-navy); background: var(--ts-kind-soft); }
.ts-reaction-funciona.is-on { background: var(--accent-green-soft); border-color: #0e7556; color: #0e7556; }
.ts-reaction-gracias.is-on { background: var(--brand-yellow-soft); }
.ts-reaction.is-on .ts-reaction-count { background: #fff; }
.ts-reaction.is-popping .ts-reaction-icon { animation: ts-pop 520ms cubic-bezier(0.3, 1.6, 0.5, 1); }

@keyframes ts-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.7) rotate(-12deg); }
  100% { transform: scale(1); }
}

.ts-who { margin: 0; color: #0e7556; font-size: 0.86rem; font-weight: 800; }

.ts-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin-top: 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.ts-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  padding: 0 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
}

.ts-action .ui-icon { width: 17px; height: 17px; }
.ts-action:hover { background: var(--surface-soft); color: var(--brand-navy); }
.ts-action:focus-visible { outline: 3px solid var(--brand-cyan); outline-offset: 1px; }
.ts-action[aria-expanded="true"] { color: var(--brand-navy); background: var(--surface-soft); }
.ts-action-danger:hover { background: #fff1f1; color: #a32222; }

/* Comments */

.ts-comments { display: grid; gap: 10px; }
.ts-comments ol { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.ts-comment { display: flex; align-items: flex-start; gap: 10px; }

.ts-comment-bubble {
  flex: 1;
  min-width: 0;
  border-radius: 4px 18px 18px 18px;
  padding: 10px 14px;
  background: var(--surface-soft);
}

.ts-comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0 0 2px; font-size: 0.86rem; }
.ts-comment-head strong { color: var(--brand-navy); font-weight: 1000; }
.ts-comment-head time { color: var(--muted); font-weight: 700; }
.ts-comment-head .ts-link-button { margin-left: auto; color: var(--muted); font-size: 0.8rem; }
.ts-comment .ts-rich { font-size: 0.95rem; }

.ts-comment-form { display: flex; align-items: flex-start; gap: 10px; }
.ts-comment-form textarea { flex: 1; min-height: 46px; resize: vertical; }
.ts-comment-form .button { flex: none; }

/* States */

.ts-skeleton { display: grid; gap: 14px; }
.ts-skeleton span {
  height: 150px;
  border-radius: var(--ts-radius);
  background-color: #fff;
  box-shadow: var(--shadow-card);
  animation: ts-breathe 1.2s ease-in-out infinite alternate;
}

@keyframes ts-breathe { to { opacity: 0.45; } }

.ts-empty {
  border: 2px dashed var(--line);
  border-radius: var(--ts-radius);
  padding: 32px 22px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.ts-empty h2 { margin: 0 0 6px; color: var(--brand-navy); font-size: 1.3rem; }
.ts-empty p { max-width: 46ch; margin: 0 auto 14px; color: var(--muted); font-weight: 760; }
.ts-empty .ts-empty-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 10px; place-items: center; border-radius: 50%; background: var(--brand-cyan-soft); color: var(--brand-cyan-strong); }
.ts-empty .ts-empty-icon .ui-icon { width: 24px; height: 24px; }

.ts-toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 24px;
  max-width: min(92vw, 480px);
  margin: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 18px 40px rgba(18, 6, 80, 0.35);
  transform: translateX(-50%);
  animation: ts-toast-in 240ms ease;
}

.ts-toast[hidden] { display: none; }

@keyframes ts-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---- Rail ---- */

.ts-box {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 16px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.ts-box h2 { margin: 0 0 10px; color: var(--brand-navy); font-size: 1.02rem; }
.ts-box p { margin: 0; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.ts-box ul,
.ts-box ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.ts-tested ol { counter-reset: tested; }
.ts-tested li { counter-increment: tested; }
.ts-tested a {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 0 8px;
  border-radius: 14px;
  padding: 8px;
  color: var(--brand-navy);
  text-decoration: none;
}

.ts-tested a::before {
  content: counter(tested);
  grid-row: span 2;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #dff4ec;
  color: #0e7556;
  font-size: 0.8rem;
  font-weight: 1000;
}

.ts-tested a:hover { background: var(--surface-soft); }
.ts-tested strong { font-size: 0.92rem; line-height: 1.3; }
.ts-tested small { color: var(--muted); font-size: 0.8rem; font-weight: 760; }

.ts-tutorials a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  padding: 6px;
  color: var(--brand-navy);
  text-decoration: none;
}

.ts-tutorials a:hover { background: var(--surface-soft); }
.ts-tutorials a > span:last-child { display: grid; min-width: 0; }
.ts-tutorials strong { font-size: 0.92rem; line-height: 1.3; }
.ts-tutorials small { color: var(--muted); font-size: 0.78rem; font-weight: 760; }

.ts-tutorial-icon {
  display: grid;
  flex: none;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-cyan-soft);
  color: var(--brand-cyan-strong);
}

.ts-tutorial-icon .ui-icon { width: 20px; height: 20px; }

.ts-norms li { color: var(--muted); font-size: 0.88rem; font-weight: 700; line-height: 1.45; }
.ts-norms strong { color: var(--brand-navy); }

/* ---- One post on its own page ---- */

.ts-single-page { max-width: 820px; }
.ts-back { margin-top: 18px; }

/* The count of new posts on the menu entry (shares .nav-news-count with News). */
.mobile-nav-link[href="/teacher-space"] { position: relative; }

/* ---- Small screens ---- */

@media (max-width: 1100px) {
  .ts-layout { grid-template-columns: minmax(0, 1fr); }
  .ts-rail { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 720px) {
  .ts-room-hero { border-radius: 26px; }
  .ts-pulse { width: 100%; }
  .ts-pulse > div { min-width: 0; padding: 10px; }
  .ts-pulse dd { font-size: 1.5rem; }
  .ts-field-row { grid-template-columns: minmax(0, 1fr); }
  .ts-post { padding: 16px 14px 12px 16px; }
  .ts-post-head { flex-wrap: wrap; }
  .ts-kind-badge { order: 3; }
  .ts-composer-cta { display: none; }
  .ts-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .ts-comment-form { flex-wrap: wrap; }
  .ts-comment-form textarea { flex-basis: calc(100% - 42px); }
  .ts-comment-form .button { margin-left: 42px; }
  .ts-toast { bottom: 86px; border-radius: 20px; }
}

/* ---- Tutorial video page (addresses kept since 2026-09-30) ---- */

.ts-section { margin-top: 24px; }
.ts-section h2 { margin: 0 0 4px; color: var(--brand-navy); font-size: 1.3rem; }

.ts-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.ts-card {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.ts-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.ts-card:focus-visible { outline: 3px solid var(--brand-cyan); outline-offset: 3px; }

.ts-card-thumb {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: var(--brand-navy);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ts-card-thumb .ui-icon { width: 40px; height: 40px; color: var(--brand-yellow); }

.ts-card-text { display: grid; gap: 4px; }
.ts-card-text strong { color: var(--brand-navy); font-size: 1.05rem; }
.ts-card-text small { color: var(--muted); }
.ts-card-date { font-weight: 800; }
.ts-card-go { align-self: end; color: var(--brand-cyan-strong); }

.ts-video-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 8px 0 16px;
}

.ts-video-head h1 { margin: 0 0 4px; color: var(--brand-navy); }
.ts-video-head p { margin: 0; color: var(--muted); }

.ts-player {
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: calc(100dvh - 220px);
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-panel);
}

.ts-player iframe { display: block; width: 100%; height: 100%; border: 0; }

.ts-player-help { margin: 10px 2px 0; color: var(--muted); font-size: 0.9rem; }
.ts-player-help a { color: var(--brand-cyan-strong); font-weight: 800; }

/* Tip on the page a tutorial explains */
.ts-tip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  background: var(--brand-cyan-soft);
  color: var(--brand-navy);
}

.ts-tip > span:nth-child(2) { flex: 1; }
.ts-tip-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-navy);
  color: var(--brand-yellow);
}

@media (prefers-reduced-motion: reduce) {
  .ts-card,
  .ts-reaction,
  .ts-skeleton span { transition: none; animation: none; }
  .ts-card:hover,
  .ts-reaction:hover:not(:disabled) { transform: none; }
  .ts-post.is-new,
  .ts-reaction.is-popping .ts-reaction-icon,
  .ts-toast { animation: none; }
}

/* Line icons inside pills, badges and small labels. */
.teacher-space-page :is(.ts-kind-badge, .ts-chip, .ts-kind-option > span, .ts-flag, .ts-who, .ts-post-challenge, .ts-challenge-eyebrow, .ts-privacy) .ui-icon {
  flex: none;
  width: 15px;
  height: 15px;
  vertical-align: -2px;
}

.ts-kind-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--ts-kind); font-weight: 600; }
.ts-who-soon { color: var(--muted); }
.ts-post-challenge { display: flex; align-items: center; gap: 6px; color: #05607d; }
.ts-privacy { display: flex; align-items: center; gap: 6px; }
.ts-flag { display: inline-flex; align-items: center; gap: 6px; }
.ts-chip { gap: 6px; }

/* ---- The October raffle ---- */

.ts-raffle {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid #bfe8f7;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
}

.ts-raffle p { margin: 0; color: var(--muted); font-size: 0.92rem; font-weight: 400; }
.ts-raffle .ts-raffle-title { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.ts-raffle-title .ui-icon { width: 16px; height: 16px; color: #e8890c; }

.ts-raffle-steps { display: grid; gap: 6px; margin: 2px 0 0; padding: 0; list-style: none; }
.ts-raffle-steps:empty { display: none; }
.ts-raffle-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.ts-raffle-steps .ui-icon { flex: none; width: 18px; height: 18px; border-radius: 50%; padding: 2px; background: var(--surface-soft); }
.ts-raffle-steps li.is-done { color: #0e7556; }
.ts-raffle-steps li.is-done .ui-icon { background: #dff4ec; }
.ts-raffle-steps li.is-in { font-weight: 600; }
.ts-raffle > .ts-link-button { justify-self: start; font-size: 0.9rem; }

.ts-raffle-list { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.ts-raffle-list ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ts-raffle-list li {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 2fr) auto;
  gap: 4px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.88rem;
}
.ts-raffle-list li.is-eligible { border-color: #9fd9c3; background: #f3fbf7; }
.ts-raffle-list li > span:last-child { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.ts-raffle-list li.is-eligible > span:last-child { color: #0e7556; font-weight: 600; }
.ts-raffle-list .ui-icon { width: 14px; height: 14px; }
.ts-raffle-list a { color: var(--brand-cyan-strong); }

/* The invitation dialog, shown once outside class. */
.ts-raffle-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 1px solid #e2e7f0;
  border-radius: 16px;
  padding: 0;
  background: #fff;
  color: #12142b;
  box-shadow: 0 24px 64px rgba(18, 20, 43, 0.22);
  font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}
.ts-raffle-dialog::backdrop { background: rgba(18, 20, 43, 0.45); }
.ts-raffle-popup { display: grid; gap: 12px; padding: 24px; }
.ts-raffle-popup .eyebrow { margin: 0; color: #5b6380; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.ts-raffle-popup h2 { margin: 0; font-family: "Sora", "DM Sans", sans-serif; font-size: 1.45rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; }
.ts-raffle-popup p { margin: 0; color: #3f4766; line-height: 1.5; }
.ts-raffle-popup ol { display: grid; gap: 8px; margin: 0; padding-left: 1.3em; line-height: 1.45; }
.ts-raffle-popup .ts-raffle-popup-note { border-radius: 10px; padding: 10px 12px; background: #e3f6fd; color: #05394a; font-size: 0.92rem; }
.ts-raffle-popup-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 4px; }

@media (max-width: 720px) {
  .ts-raffle-list li { grid-template-columns: minmax(0, 1fr); }
}
