/* ==========================================================================
   TEAM DETAIL PAGE  (team-detail.css)
   Load AFTER style.css.

   Layout
   - Phone landscape / tablet / desktop (>= 700px wide): two panes.
       LEFT  rail  = identity (crest, name, rank, form, members, actions)
       RIGHT main  = tabs (Overview / Squad / Training / Chat / Rules)
     The page never scrolls; only the active tab pane (and, if needed, the
     rail) scroll inside themselves, with hidden scrollbars, like the rest
     of teams.html.
   - Narrow screens (< 700px): everything stacks and the page scrolls.

   Colours come from the same crest theme the team cards use (--t-* vars set
   by team-detail.js), with brass fallbacks when a team has no crest image.
   ========================================================================== */

#teamDetailScreen.td-screen {
  --td-top:       var(--t-top,       #241a12);
  --td-bot:       var(--t-bot,       #14100b);
  --td-edge:      var(--t-edge,      #5a4528);
  --td-edge-soft: var(--t-edge-soft, #33271a);
  --td-glow:      var(--t-glow,      rgba(245, 200, 66, .22));
  --td-accent:    var(--t-accent,    #f5c842);
  --td-muted:     var(--t-muted,     #a8977e);
  --td-text:      var(--t-text,      #f0e6d4);
  --td-track:     var(--t-track,     #2c2117);

  --td-rail-w: clamp(14rem, 31vw, 18rem);
  --td-crest:  4.4rem;
  --td-pad:    .75rem;
  color: var(--td-text);
}

/* ---------- top bar (back + share) ---------- */
.td-topbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  /* left padding clears the floating hamburger button */
  padding: .5rem .6rem .35rem 3.4rem;
  position: relative;
  z-index: 2;
}
.td-topbar h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.05rem;
  color: var(--td-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-back, .td-share {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 .75rem;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  border-radius: 999px;
  border: 1px solid var(--td-edge-soft);
  background: rgba(0, 0, 0, .28);
  color: var(--td-text);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#teamShareBtn.td-share { border: 1px solid var(--td-edge-soft); border-radius: 999px; background: rgba(0, 0, 0, .28); color: var(--td-text); }
#teamShareBtn.td-share:hover:not(:disabled) { border-color: var(--td-accent); color: var(--td-accent); background: rgba(0, 0, 0, .4); }
.td-back:hover, .td-share:hover:not(:disabled) { border-color: var(--td-accent); color: var(--td-accent); background: rgba(0, 0, 0, .4); }
.td-back:active, .td-share:active { transform: scale(.96); }

/* ---------- rail ---------- */
.td-rail {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: .4rem var(--td-pad) 1rem;
  background: linear-gradient(170deg, var(--td-top), var(--td-bot));
  border-bottom: 1px solid var(--td-edge-soft);
}

.td-hero { display: flex; align-items: center; gap: .75rem; min-width: 0; }

.td-crest {
  position: relative;
  flex: 0 0 auto;
  width: var(--td-crest);
  height: var(--td-crest);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--td-track);
  border: 2px solid var(--td-edge);
  box-shadow: 0 0 22px var(--td-glow), 0 6px 14px rgba(0, 0, 0, .45);
}
.td-crest img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; }
.td-crest.crest-feather img {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
                      linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
              linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  mask-composite: intersect;
}
.td-crest-emoji { position: relative; z-index: 1; font-size: calc(var(--td-crest) * .6); line-height: 1; }

.td-hero-text { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.td-badge {
  align-self: flex-start;
  background: #f5c842;
  color: #1a1410;
  font-size: .55rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .1rem .4rem;
  border-radius: 5px;
}
.td-name {
  margin: 0;
  color: var(--td-accent);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.12;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.td-name.name-long { font-size: 1rem; }
.td-name.name-xl   { font-size: .9rem; }
.td-country { display: flex; align-items: center; gap: .3rem; font-size: .74rem; color: var(--td-text); min-width: 0; }
.td-country span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-lead { font-size: .68rem; color: var(--td-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.td-league { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.td-league-name {
  min-width: 0;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--td-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-rank {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: .25rem;
  padding: .12rem .65rem;
  border-radius: 999px;
  background: var(--td-track);
  border: 1px solid var(--td-edge);
  color: var(--td-accent);
  font-size: .68rem;
}
.td-rank b { font-size: 1rem; font-weight: 800; }
.td-rank.rank-gold   { background: #f5c842; border-color: #f5c842; color: #1a1410; }
.td-rank.rank-silver { background: #c9ccd1; border-color: #c9ccd1; color: #1a1410; }
.td-rank.rank-bronze { background: #c98a4b; border-color: #c98a4b; color: #1a1410; }

.td-form { display: flex; align-items: center; gap: .3rem; }
.td-form-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--td-muted); margin-right: .15rem; }
.td-form .form-dot { width: 1.2rem; height: 1.2rem; font-size: .58rem; }
.td-form-empty { font-size: .7rem; font-style: italic; color: var(--td-muted); }

.td-members-bar .tcm-text { color: var(--td-muted); margin-bottom: .3rem; }
.td-members-bar .tcm-text strong { color: var(--td-text); }
.td-members-bar .tcm-bar { background: var(--td-track); }
.td-members-bar .tcm-bar span { background: var(--td-accent); }
.td-members-bar .tcm-bar.low span  { background: #f5a742; }
.td-members-bar .tcm-bar.full span { background: #e8604c; }

.td-actions { display: flex; flex-direction: column; gap: .4rem; margin-top: auto; padding-top: .2rem; }
.td-actions-row { display: flex; gap: .4rem; }
.td-actions-row > * { flex: 1; }
.td-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 38px;
  padding: .4rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--td-edge);
  background: rgba(0, 0, 0, .3);
  color: var(--td-text);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.td-btn:hover:not(:disabled) { border-color: var(--td-accent); color: var(--td-accent); }
.td-btn:active:not(:disabled) { transform: scale(.97); }
.td-btn:disabled { opacity: .5; cursor: default; }
.td-btn-primary { background: var(--td-accent); border-color: var(--td-accent); color: #14100b; font-size: .85rem; }
.td-btn-primary:hover:not(:disabled) { filter: brightness(1.1); color: #14100b; }
.td-btn-danger { color: #ff9a8f; border-color: #6a2a22; }
.td-btn-danger:hover:not(:disabled) { color: #ffb8b0; border-color: #e8604c; }
.td-btn-sm { min-height: 32px; padding: .25rem .6rem; font-size: .72rem; border-radius: 8px; }

/* ---------- main pane + tabs ---------- */
.td-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--td-bot); }

.td-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: .3rem;
  padding: .45rem var(--td-pad);
  overflow-x: auto;
  border-bottom: 1px solid var(--td-edge-soft);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.td-tabs::-webkit-scrollbar { display: none; }
.td-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 34px;
  padding: 0 .85rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--td-muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.td-tab:hover { color: var(--td-text); }
.td-tab[aria-selected="true"] { background: var(--td-accent); color: #14100b; }
.td-tab i { font-style: normal; font-size: .66rem; opacity: .75; }
.td-tab.has-new::after { content: ''; width: .45rem; height: .45rem; border-radius: 50%; background: #e8604c; box-shadow: 0 0 6px #e8604c; }

.td-panes { flex: 1 1 0; min-height: 0; position: relative; }
.td-pane {
  display: none;
  padding: .75rem var(--td-pad) 1.25rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.td-pane::-webkit-scrollbar { display: none; }
.td-pane.active { display: block; }

.td-h {
  margin: 1.1rem 0 .5rem;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--td-muted);
}
.td-h:first-child { margin-top: 0; }
.td-h small { font-weight: 600; letter-spacing: 0; text-transform: none; margin-left: .35rem; }

.td-card {
  background: rgba(0, 0, 0, .26);
  border: 1px solid var(--td-edge-soft);
  border-radius: 12px;
  padding: .7rem .85rem;
}
.td-empty { color: var(--td-muted); font-size: .82rem; font-style: italic; padding: .4rem 0; }
.td-warn {
  background: #3a1a0a; color: #ffb070; border: 1px solid #6a2a0a;
  border-radius: 10px; padding: .5rem .75rem; font-size: .78rem; margin-bottom: .6rem;
}

/* ---------- Overview ---------- */
.td-quote {
  margin: 0 0 .6rem;
  padding: .1rem 0 .1rem .8rem;
  border-left: 3px solid var(--td-accent);
  font-size: 1.02rem;
  font-style: italic;
  line-height: 1.35;
  color: var(--td-text);
}
.td-about { margin: 0 0 .9rem; font-size: .85rem; line-height: 1.55; color: var(--td-text); opacity: .92; white-space: pre-wrap; overflow-wrap: anywhere; }

.td-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.td-stat {
  display: flex; flex-direction: column; align-items: center; gap: .05rem;
  padding: .55rem .25rem;
  background: rgba(0, 0, 0, .26);
  border: 1px solid var(--td-edge-soft);
  border-radius: 12px;
}
.td-stat b { font-size: 1.45rem; line-height: 1.05; font-weight: 800; color: var(--td-text); }
.td-stat span { font-size: .58rem; text-transform: uppercase; letter-spacing: .07em; color: var(--td-muted); }
.td-stat.w b { color: #5fcf7a; } .td-stat.d b { color: #f5c842; } .td-stat.l b { color: #ff7a66; }
.td-winrate { margin-top: .45rem; display: flex; align-items: center; gap: .6rem; font-size: .7rem; color: var(--td-muted); }
.td-winrate .bar { flex: 1; height: 6px; border-radius: 3px; overflow: hidden; background: var(--td-track); display: flex; }
.td-winrate .bar i { display: block; height: 100%; }
.td-winrate .bar .w { background: #5fcf7a; } .td-winrate .bar .d { background: #f5c842; } .td-winrate .bar .l { background: #e8604c; }

.td-next {
  display: flex; align-items: center; gap: .8rem;
  margin-bottom: .55rem;
  padding: .6rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--td-edge);
  border-left: 4px solid var(--td-accent);
  background: rgba(0, 0, 0, .3);
}
.td-next-ico { font-size: 1.5rem; line-height: 1; }
.td-next-main { min-width: 0; }
.td-next-label { font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--td-muted); }
.td-next-when { font-size: 1.02rem; font-weight: 800; color: var(--td-accent); line-height: 1.2; }
.td-next-sub { font-size: .72rem; color: var(--td-muted); }

.td-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; }
.td-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  min-height: 3rem; padding: .3rem .1rem;
  border-radius: 9px;
  border: 1px dashed var(--td-edge-soft);
  color: var(--td-muted);
  font-size: .56rem; text-align: center; line-height: 1.15;
}
.td-day b { font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; }
.td-day.on { border-style: solid; border-color: var(--td-edge); background: var(--td-track); color: var(--td-text); }
.td-day.on b { color: var(--td-accent); }
.td-day.today { box-shadow: 0 0 0 2px var(--td-accent); }
.td-day span { overflow-wrap: anywhere; }
.td-note { margin-top: .5rem; font-size: .76rem; color: var(--td-muted); font-style: italic; }
.td-ethos { margin: 0 0 .9rem; padding: .1rem 0 .1rem .7rem; border-left: 2px solid var(--td-muted); font-size: .76rem; line-height: 1.45; color: var(--td-muted); font-style: italic; opacity: .9; }

.td-locked { margin-top: 1rem; text-align: center; font-size: .78rem; color: var(--td-muted); }

/* ---------- Squad ---------- */
.td-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: .45rem; align-items: start; }
.td-member {
  background: rgba(0, 0, 0, .26);
  border: 1px solid var(--td-edge-soft);
  border-radius: 12px;
  min-width: 0;
}
.td-member[open] { grid-column: 1 / -1; border-color: var(--td-edge); background: rgba(0, 0, 0, .34); }
.td-member summary {
  list-style: none;
  display: flex; align-items: center; gap: .6rem;
  min-height: 48px; padding: .4rem .65rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.td-member summary::-webkit-details-marker { display: none; }
.td-av {
  flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; background: var(--td-track); border: 1px solid var(--td-edge-soft);
}
.td-mi { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.td-mname { font-size: .86rem; font-weight: 700; color: var(--td-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-you { font-style: normal; font-size: .55rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; background: #4fc3f7; color: #0a2733; border-radius: 4px; padding: .05rem .3rem; margin-left: .3rem; vertical-align: middle; }
.td-msub { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; font-size: .66rem; color: var(--td-muted); }
.td-role { font-size: .55rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding: .08rem .38rem; border-radius: 5px; background: var(--td-track); color: var(--td-accent); }
.td-role.owner { background: #f5c842; color: #1a1410; }
.td-slot { font-family: 'Courier New', monospace; font-weight: 700; font-size: .66rem; padding: .05rem .35rem; border-radius: 5px; border: 1px solid var(--td-edge-soft); color: var(--td-text); }
.td-slot.w::before, .td-slot.b::before { content: ''; display: inline-block; width: .5em; height: .5em; border-radius: 50%; margin-right: .3em; border: 1px solid rgba(255,255,255,.5); vertical-align: .02em; }
.td-slot.w::before { background: #f4efe6; } .td-slot.b::before { background: #111; }
.td-av { overflow: hidden; }
.td-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.td-media { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; }
.td-photo, .td-video {
  width: 8.5rem; height: 8.5rem; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--td-edge-soft); background: #000;
}
@media (max-width: 480px) { .td-photo, .td-video { width: calc(50% - .3rem); height: auto; aspect-ratio: 1 / 1; } }
.td-chev { flex: 0 0 auto; color: var(--td-muted); font-size: 1.1rem; transition: transform .15s; }
.td-member[open] .td-chev { transform: rotate(90deg); }

.td-mbody { padding: .1rem .75rem .75rem 3.4rem; display: flex; flex-direction: column; gap: .5rem; font-size: .78rem; }
.td-mbio { margin: 0; color: var(--td-text); opacity: .9; line-height: 1.45; overflow-wrap: anywhere; }
.td-accts { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.td-accts a { color: var(--td-accent); font-weight: 700; text-decoration: none; }
.td-accts a:hover { text-decoration: underline; }
.td-accts em { font-style: normal; color: var(--td-muted); font-size: .72rem; margin-left: .2rem; }
.td-manage { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding-top: .45rem; border-top: 1px dashed var(--td-edge-soft); }
.td-manage select {
  background: #0a0a0a; color: var(--td-text); border: 1px solid var(--td-edge-soft);
  border-radius: 8px; padding: .35rem .5rem; font: inherit; font-size: .75rem; min-height: 32px; max-width: 10rem;
}
.td-vacant { border-style: dashed; opacity: .75; }
.td-vacant .td-av { border-style: dashed; color: var(--td-muted); }
.td-vacant .td-mname { font-style: italic; color: var(--td-muted); }
.td-vac-desc { font-size: .64rem; color: var(--td-muted); line-height: 1.3; }
.td-vacant-row { display: flex; align-items: center; gap: .6rem; padding: .4rem .65rem; min-height: 48px; }

/* ---------- Training ---------- */
.td-cta {
  display: flex; align-items: center; gap: .8rem;
  padding: .75rem .9rem; margin-bottom: .6rem;
  border-radius: 12px; border: 1px solid #3a8a5a;
  background: linear-gradient(135deg, #14301f, #0d1f15);
}
.td-cta-ico { font-size: 1.7rem; }
.td-cta-text { flex: 1; min-width: 0; }
.td-cta-text b { display: block; font-size: .92rem; color: #d7ffe6; }
.td-cta-text span { font-size: .72rem; color: #8fbfa0; line-height: 1.35; }
.td-cta .td-btn { background: #2d7a4a; border-color: #3a8a5a; color: #fff; flex: 0 0 auto; }
.td-train-row {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .5rem .7rem; margin-bottom: .35rem;
  background: rgba(0, 0, 0, .26); border: 1px solid var(--td-edge-soft); border-radius: 10px; font-size: .8rem;
}
.td-train-row strong { color: var(--td-accent); }
.td-train-row small { color: var(--td-muted); white-space: nowrap; font-size: .7rem; }

/* ---------- Chat ---------- */
.td-pane-chat.active { display: flex; flex-direction: column; padding-bottom: .5rem; }
#teamDetailBody .td-pane-chat .team-chat-list {
  flex: 1 1 0; min-height: 0; max-height: none; margin-bottom: .5rem;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--td-edge-soft); border-radius: 12px;
  scrollbar-width: none;
}
#teamDetailBody .td-pane-chat .team-chat-list::-webkit-scrollbar { display: none; }
.td-pane-chat .team-chat-item { background: rgba(255, 255, 255, .04); border-color: var(--td-edge-soft); }
.td-pane-chat .team-chat-user { color: var(--td-accent); }
.td-pane-chat .team-chat-time { color: var(--td-muted); }
.td-pane-chat .team-chat-text { color: var(--td-text); }
.td-pane-chat .team-chat-input-row input { background: rgba(0, 0, 0, .4); border-color: var(--td-edge-soft); color: var(--td-text); min-height: 38px; }
.td-pane-chat .team-chat-input-row input:focus { border-color: var(--td-accent); }
.td-pane-chat .profile-status { min-height: 1em; margin: .2rem 0 0; }

/* ---------- Rules ---------- */
.td-rules-text { margin: 0; font-size: .86rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.td-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.td-chip { font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--td-edge-soft); background: rgba(0,0,0,.26); color: var(--td-text); }
.td-link-btn { margin-top: .8rem; }

/* ==========================================================================
   TWO-PANE LAYOUT  (any landscape phone, tablets, desktop)
   ========================================================================== */
@media (min-width: 700px), (orientation: landscape) and (max-height: 700px) {
  body.teams-body #teamDetailScreen.td-screen {
    display: grid;
    grid-template-columns: var(--td-rail-w) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
  }
  /* one continuous tinted column behind the top bar and the rail */
  #teamDetailScreen.td-screen::before {
    content: '';
    grid-column: 1;
    grid-row: 1 / -1;
    background: linear-gradient(170deg, var(--td-top), var(--td-bot));
    border-right: 1px solid var(--td-edge-soft);
  }
  #teamDetailBody { display: contents; }

  .td-topbar { grid-column: 1; grid-row: 1; padding-left: 3.4rem; justify-content: space-between; }
  .td-topbar h1 { display: none; }              /* the rail already shows the name */

  .td-rail {
    grid-column: 1; grid-row: 2;
    min-height: 0;
    overflow-y: auto;
    border-bottom: 0;
    background: none;
    padding-left: calc(var(--td-pad) + env(safe-area-inset-left, 0px));
    scrollbar-width: none;
  }
  .td-rail::-webkit-scrollbar { display: none; }

  .td-main { grid-column: 2; grid-row: 1 / -1; padding-right: env(safe-area-inset-right, 0px); }
  .td-tabs { padding-top: .55rem; padding-bottom: .5rem; }
  .td-pane { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  /* "Loading…" / error text while the body is empty */
  #teamDetailBody > .teams-empty { grid-column: 1 / -1; grid-row: 1 / -1; place-self: center; z-index: 3; }

  /* Edit-settings form becomes a full-screen sheet instead of pushing the layout */
  #teamSettingsForm {
    position: fixed; inset: 0; z-index: 1100;
    margin: 0; border-radius: 0; border: 0;
    overflow-y: auto; background: #1a1410;
    padding: .75rem max(1rem, env(safe-area-inset-left, 0px)) 2rem;
  }
}

/* Roomier on tall screens (desktop / tablets) */
@media (min-width: 700px) and (min-height: 701px) {
  #teamDetailScreen.td-screen { --td-rail-w: 19rem; --td-crest: 6.2rem; --td-pad: 1.1rem; }
  .td-name { font-size: 1.35rem; }
  .td-name.name-long { font-size: 1.2rem; }
  .td-name.name-xl { font-size: 1.05rem; }
  .td-hero { flex-direction: column; align-items: flex-start; gap: .9rem; }
  .td-stat b { font-size: 1.8rem; }
  .td-members { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
}

/* Small landscape phones (<= ~760px wide): tighter tabs so all five fit */
@media (max-width: 760px) and (orientation: landscape) {
  .td-tabs { gap: .1rem; }
  .td-tab { padding: 0 .6rem; font-size: .76rem; }
}

/* Phone landscape: squeeze everything to a ~360px-tall viewport */
@media (max-width: 1099px) and (max-height: 700px) and (orientation: landscape) {
  body.teams-body #teamDetailScreen.td-screen { max-width: none; }
  .td-topbar { padding-top: .5rem; padding-bottom: .15rem; }
  .td-rail { gap: .5rem; padding-top: .3rem; }
  .td-name { font-size: 1.05rem; }
  .td-stat { padding: .4rem .2rem; }
  .td-stat b { font-size: 1.25rem; }
  .td-next { padding: .45rem .75rem; }
  .td-pane { padding-top: .6rem; }
  .td-btn { min-height: 36px; }
}

/* ==========================================================================
   NARROW + PORTRAIT (< 700px): stacked, page scrolls
   ========================================================================== */
@media (max-width: 699px) and (orientation: portrait), (max-width: 699px) and (min-height: 701px) {
  body.teams-body #teamDetailScreen.td-screen { padding: 0 0 2rem; max-width: none; }
  .td-rail { border-bottom: 1px solid var(--td-edge-soft); }
  .td-tabs { position: sticky; top: 0; z-index: 5; background: var(--td-bot); }
  .td-members { grid-template-columns: 1fr; }
  .td-pane-chat.active { min-height: 22rem; }
  #teamDetailBody .td-pane-chat .team-chat-list { max-height: 18rem; }
}

@media (prefers-reduced-motion: reduce) {
  .td-chev, .td-btn, .td-back, .td-share { transition: none; }
}

/* ---------- Fan button (rail) ---------- */
.td-btn-fan {
    color: #ff9f40;
    border-color: #6a4520;
}
.td-btn-fan:hover:not(:disabled) {
    color: #ffb070;
    border-color: #ff9f40;
}
.td-btn-fan.is-fan {
    background: rgba(255, 159, 64, 0.12);
    border-color: #ff9f40;
    color: #ffb070;
}
.td-fan-count {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--td-muted);
    font-size: .72rem;
    margin-top: .1rem;
}
.td-fan-count strong { color: var(--td-text); }

/* ---------- News ---------- */
.td-news-compose {
    background: rgba(0, 0, 0, .28);
    border: 1px solid var(--td-edge-soft);
    border-radius: 12px;
    padding: .7rem .85rem;
    margin-bottom: .9rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.td-news-compose input,
.td-news-compose textarea {
    background: rgba(0, 0, 0, .4);
    border: 1px solid var(--td-edge-soft);
    border-radius: 8px;
    color: var(--td-text);
    font: inherit;
    font-size: .85rem;
    padding: .45rem .6rem;
    width: 100%;
    box-sizing: border-box;
}
.td-news-compose input:focus,
.td-news-compose textarea:focus {
    outline: none;
    border-color: var(--td-accent);
}
.td-news-compose textarea { resize: vertical; min-height: 5rem; }
.td-news-compose-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
}

.td-news-list { display: flex; flex-direction: column; gap: .6rem; }
.td-news-item {
    background: rgba(0, 0, 0, .26);
    border: 1px solid var(--td-edge-soft);
    border-radius: 12px;
    padding: .8rem .95rem;
}
.td-news-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    font-size: .72rem;
    color: var(--td-muted);
    margin-bottom: .3rem;
}
.td-news-byline { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; min-width: 0; }
.td-news-author { color: var(--td-text); font-weight: 700; }
.td-news-when { flex-shrink: 0; }
.td-news-title {
    margin: 0 0 .4rem;
    font-size: 1rem;
    color: var(--td-accent);
    line-height: 1.25;
}
.td-news-body {
    margin: 0;
    font-size: .86rem;
    line-height: 1.55;
    color: var(--td-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.td-news-body.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;   /* line-clamp needs normal wrapping */
}
.td-news-toggle {
    margin-top: .5rem;
    padding: .25rem .1rem;
    background: none;
    border: 0;
    color: var(--td-accent);
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
    cursor: pointer;
}
.td-news-toggle:hover { text-decoration: underline; }


/* ---- Fixtures / team challenges ---- */
#tdFixtures .tc-form { display:flex; gap:8px; flex-wrap:wrap; margin:6px 0; }
#tdFixtures input[type="datetime-local"] { padding:6px 8px; border-radius:8px; border:1px solid rgba(255,255,255,.2); background:rgba(0,0,0,.25); color:inherit; font:inherit; max-width:100%; }
#tdFixtures .tc-row { padding:10px 12px; margin:8px 0; border-radius:10px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.04); }
#tdFixtures .tc-row.tc-live { border-color:#f5c842; }
#tdFixtures .tc-row.tc-declined, #tdFixtures .tc-row.tc-cancelled, #tdFixtures .tc-row.tc-void { opacity:.6; }
#tdFixtures .tc-when { margin-top:2px; }
#tdFixtures .tc-status { margin-left:6px; font-size:.8em; opacity:.85; }
#tdFixtures .tc-actions { margin-top:8px; display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
#tdFixtures .tc-counter { display:flex; gap:6px; flex-wrap:wrap; width:100%; }
#tdFixtures .tc-msg { margin:8px 0; color:#f5c842; }


/* ==========================================================================
   TEAM SETTINGS FORM  (the ⚙️ Settings button on a team's page)
   Self-contained: the form's classes (profile-label, ct-row-2, practice-day-*,
   btn ...) were not styled on this page, so it rendered as bare browser
   controls. It now opens as a full-screen sheet on every screen size.
   ========================================================================== */
#teamSettingsForm {
  position: fixed; inset: 0; z-index: 1100;
  display: block; margin: 0; border: 0; border-radius: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--pg-bot, #1a1410);
  color: var(--pg-text, #d6c3ab);
  padding: max(.9rem, env(safe-area-inset-top, 0px))
           max(1rem, calc((100vw - 40rem) / 2))
           max(2.5rem, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
#teamSettingsForm *, #teamSettingsForm *::before, #teamSettingsForm *::after { box-sizing: border-box; }

#teamSettingsForm .teams-panel-title-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  margin: 0 0 .9rem; padding-bottom: .7rem;
  border-bottom: 1px solid var(--pg-line, #3a2a1a);
}
#teamSettingsForm .teams-panel-title { margin: 0; font-size: 1.15rem; color: var(--pg-accent, #f5c842); }
#teamSettingsForm .team-detail-close {
  width: 2.4rem; height: 2.4rem; flex: 0 0 auto; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--pg-line, #3a2a1a); border-radius: 50%;
  background: var(--pg-track, #241a12); color: var(--pg-text, #d6c3ab);
  font-size: 1rem; cursor: pointer;
}
#teamSettingsForm .team-detail-close:hover { border-color: var(--pg-accent, #f5c842); color: var(--pg-accent, #f5c842); }

#teamSettingsForm .profile-label {
  display: block; margin: .95rem 0 .3rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--pg-muted, #8a7a68);
}
#teamSettingsForm .profile-hint { margin: 0 0 .5rem; font-size: .8rem; line-height: 1.35; color: var(--pg-muted, #8a7a68); }

#teamSettingsForm input[type="text"],
#teamSettingsForm textarea {
  width: 100%; padding: .6rem .7rem;
  background: var(--pg-track, #241a12); color: var(--pg-text, #d6c3ab);
  border: 1px solid var(--pg-line, #3a2a1a); border-radius: 10px;
  font: inherit; font-size: .95rem;
}
#teamSettingsForm textarea { resize: vertical; min-height: 4.5rem; }
#teamSettingsForm input[type="text"]:focus,
#teamSettingsForm textarea:focus { outline: none; border-color: var(--pg-accent, #f5c842); box-shadow: 0 0 0 2px rgba(245, 200, 66, .18); }
#teamSettingsForm input:disabled { opacity: .55; cursor: not-allowed; }
#teamSettingsForm input[type="file"] { width: 100%; color: var(--pg-muted, #8a7a68); font-size: .8rem; }
#teamSettingsForm input[type="file"]::file-selector-button {
  margin-right: .6rem; padding: .4rem .7rem; cursor: pointer;
  background: var(--pg-track, #241a12); color: var(--pg-text, #d6c3ab);
  border: 1px solid var(--pg-edge, #5a4a3a); border-radius: 8px; font: inherit; font-size: .8rem;
}

#teamSettingsForm .ct-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 520px) { #teamSettingsForm .ct-row-2 { grid-template-columns: 1fr; gap: 0; } }

#teamSettingsForm .practice-day-picker { display: grid; gap: .4rem; }
#teamSettingsForm .practice-day-row {
  display: grid; grid-template-columns: auto 5.5rem 1fr; align-items: center; gap: .6rem;
  margin: 0; padding: .4rem .6rem; cursor: pointer;
  background: var(--pg-track, #241a12); border: 1px solid var(--pg-line, #3a2a1a); border-radius: 10px;
}
#teamSettingsForm .practice-day-row .pd-name { font-size: .88rem; font-weight: 600; }
#teamSettingsForm .practice-day-row .pd-time { padding: .4rem .55rem; font-size: .85rem; }
#teamSettingsForm input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--pg-accent, #f5c842); margin: 0; }

#teamSettingsForm .ct-checkbox {
  display: flex; align-items: center; gap: .55rem; margin: 1rem 0 0; cursor: pointer; font-size: .92rem;
}

#teamSettingsForm .profile-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem;
  margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--pg-line, #3a2a1a);
}
#teamSettingsForm .btn {
  min-height: 2.5rem; padding: .5rem 1.1rem; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--pg-edge, #5a4a3a);
  font: inherit; font-size: .9rem; font-weight: 700;
}
#teamSettingsForm .btn-success { background: var(--pg-accent, #f5c842); border-color: var(--pg-accent, #f5c842); color: #1a1410; }
#teamSettingsForm .btn-success:hover:not(:disabled) { filter: brightness(1.08); }
#teamSettingsForm .btn-secondary { background: var(--pg-track, #241a12); color: var(--pg-text, #d6c3ab); }
#teamSettingsForm .btn-secondary:hover { border-color: var(--pg-accent, #f5c842); color: var(--pg-accent, #f5c842); }
#teamSettingsForm .btn:disabled { opacity: .5; cursor: not-allowed; }


/* ---------- practice schedule: time pickers + time-zone notes ---------- */
.td-zone { margin: .5rem 0 0; font-size: .74rem; color: var(--td-muted, #a8977e); }
.td-sessions { list-style: none; margin: .45rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .84rem; }
.td-sessions li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; }
.td-sessions b { min-width: 2.3rem; color: var(--td-accent, #f5c842); }
.td-sessions small { color: var(--td-muted, #a8977e); font-size: .72rem; }

.practice-tz-select {
  width: 100%; margin: 0 0 .5rem; padding: .5rem .6rem;
  background: #0a0a0a; color: #e8ddd0; border: 1px solid #3a2a1a; border-radius: 8px;
  font: inherit; font-size: .82rem; color-scheme: dark;
}
.practice-day-row { grid-template-columns: auto 5.2rem 1fr; cursor: default; }
.practice-day-row .pd-times { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.practice-day-row .pd-times .pd-time { flex: 1 1 0; min-width: 0; width: auto; color-scheme: dark; }
.practice-day-row .pd-to { font-size: .72rem; color: #8a7a68; }
@media (max-width: 420px) {
  .practice-day-row { grid-template-columns: auto 1fr; }
  .practice-day-row .pd-times { grid-column: 1 / -1; }
}
#teamSettingsForm .practice-tz-select { background: var(--pg-track, #241a12); border-color: var(--pg-line, #3a2a1a); }
#teamSettingsForm .practice-day-row { grid-template-columns: auto 5.2rem 1fr; cursor: default; }
@media (max-width: 420px) { #teamSettingsForm .practice-day-row { grid-template-columns: auto 1fr; } }

/* ---------- Why Join + How to Play ---------- */
.td-list { margin: 0; padding-left: 1.2rem; display: grid; gap: .55rem; font-size: .86rem; line-height: 1.5; }
.td-list b { color: var(--td-accent); }

/* ---------- Chat notifications ---------- */
.td-push { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; font-size: .74rem; color: var(--td-muted); }
.td-push[hidden] { display: none; }

/* ---------- Voice notes ---------- */
.td-voice { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.td-voice:empty { display: none; }
.td-voice-status { font-size: .74rem; color: var(--td-muted); }

/* ---------- News attachments ---------- */
.td-news-attach-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.td-news-attach-row .td-btn { max-width: 100%; overflow-wrap: anywhere; }
.td-news-attach-row small { font-weight: 400; opacity: .7; }
.td-news-media { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; margin-top: .6rem; }
.td-media-item { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; max-width: 100%; }
.td-media-item img, .td-media-item video { max-width: 100%; max-height: 18rem; border-radius: 10px; background: #000; }
.td-media-item audio { width: 18rem; max-width: 100%; }
.td-news-save { font-size: .74rem; font-weight: 700; color: var(--td-accent); }
.td-news-foot { display: flex; justify-content: flex-end; margin-top: .6rem; }


/* ---- Merchandise tab ---- */
.td-merch-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.td-merch-head .td-h { margin: 0; }
.td-merch-tools { display: flex; align-items: center; gap: .4rem; }
.td-merch-cart { font-size: .75rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; border: 1px solid var(--td-edge-soft); background: rgba(0, 0, 0, .26); color: var(--td-text); white-space: nowrap; }
.td-merch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: .6rem; }
.td-merch-card { display: flex; flex-direction: column; gap: .2rem; text-align: left; font: inherit; color: var(--td-text); cursor: pointer; padding: .4rem; border-radius: 12px; border: 1px solid var(--td-edge-soft); background: rgba(255, 255, 255, .04); }
.td-merch-card:hover { border-color: var(--td-accent); }
.td-merch-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; background: rgba(0, 0, 0, .3); display: block; }
.td-merch-ph { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; }
.td-merch-name { font-size: .8rem; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.td-merch-price { font-size: .85rem; font-weight: 700; color: var(--td-accent); }
.td-merch-detail { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.td-merch-detail > .td-btn { align-self: flex-start; }
.td-merch-big { width: 100%; max-height: 320px; object-fit: cover; border-radius: 10px; background: rgba(0, 0, 0, .3); aspect-ratio: 4 / 3; }
.td-merch-name-lg { margin: .2rem 0 0; font-size: 1.05rem; }
.td-merch-desc { margin: 0; font-size: .85rem; color: var(--td-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.td-merch-sizes { display: flex; flex-wrap: wrap; gap: .4rem; }
.td-merch-size { font: inherit; font-size: .85rem; cursor: pointer; color: var(--td-text); background: transparent; border: 1px solid var(--td-edge-soft); border-radius: 8px; padding: .3rem .75rem; min-height: 36px; }
.td-merch-size.on { background: var(--td-accent); border-color: var(--td-accent); color: #14100b; font-weight: 700; }
.td-merch-note { min-height: 1.1em; margin: 0; font-size: .82rem; color: #8fd18f; }
.td-merch-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.td-merch-two { display: grid; grid-template-columns: 2fr 1fr; gap: .5rem; }
.td-merch-select { background: rgba(0, 0, 0, .4); border: 1px solid var(--td-edge-soft); border-radius: 8px; color: var(--td-text); font: inherit; font-size: .85rem; padding: .45rem .4rem; width: 100%; box-sizing: border-box; }

/* ---------- How to Play tab (colours and font follow the team theme; images stay as they are) ---------- */
.td-howto-key { border-color: var(--td-accent); }
.td-howto-key h4, .td-howto-steps h4 { margin: 0 0 .4rem; font-size: .95rem; line-height: 1.3; color: var(--td-accent); }
.td-howto-key p, .td-howto-steps p { margin: 0 0 .6rem; font-size: .86rem; line-height: 1.5; }
.td-howto-key > :last-child { margin-bottom: 0; }
.td-howto-key b, .td-howto-steps b { color: var(--td-accent); }
.td-howto-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .6rem; margin-bottom: .6rem; }
.td-howto-steps figure { display: flex; flex-direction: column; justify-content: space-between; margin: 0; min-width: 0; }
.td-howto-img { display: block; width: 100%; max-width: min(22rem, 62vh); height: auto; margin: 0 auto; border-radius: 8px; }


/* Inbox deep link: briefly highlight the chat message / news article that was opened */
.td-flash { animation: td-flash 2.2s ease-out; }
@keyframes td-flash {
  0%, 35% { box-shadow: 0 0 0 3px rgba(245, 200, 66, .85); background: rgba(245, 200, 66, .22); }
  100%    { box-shadow: 0 0 0 3px rgba(245, 200, 66, 0);   background: transparent; }
}

/* Chat is readable by everyone; this replaces the message box for people who cannot post */
.team-chat-readonly {
  margin: .5rem 0 0; padding: .65rem .85rem; border-radius: 10px;
  background: rgba(255, 255, 255, .06); border: 1px dashed rgba(255, 255, 255, .22);
  font-size: .85rem; line-height: 1.4; opacity: .9;
}

/* The "notifications are on for this device" row took a full line of the chat. It is hidden;
   notifications are managed from the inbox (bell) instead. */
#tdPushRow, .td-push { display: none !important; }

/* Profile card opened from a name / flag in the chat */
.td-pback { position: fixed; inset: 0; z-index: 1300; background: rgba(0, 0, 0, .7); display: flex; align-items: center; justify-content: center; padding: 12px; }
.td-pcard {
  position: relative; width: min(94vw, 420px); max-height: 92vh; overflow: auto;
  background: #17120d; color: var(--td-text, #f1e7d6); border: 1px solid var(--td-edge, rgba(255, 255, 255, .22));
  border-radius: 14px; padding: .9rem 1rem 1rem; box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
}
.td-pclose { position: absolute; top: .45rem; right: .55rem; background: none; border: 0; color: inherit; font-size: 1.05rem; cursor: pointer; opacity: .7; }
.td-pclose:hover { opacity: 1; }
.td-phead { display: flex; align-items: center; gap: .7rem; padding-right: 1.6rem; }
.td-pbody { display: flex; flex-direction: column; gap: .55rem; margin-top: .7rem; font-size: .82rem; }
.td-pnote { margin: 0; font-size: .72rem; opacity: .6; }
.td-pactions { margin-top: .8rem; display: flex; justify-content: flex-end; }


/* ---------- News: block articles (editor + reader) ---------- */

/* Editor */
.td-news-compose.closed { background: none; border: 0; padding: 0; align-items: flex-start; }
.td-blk-list { display: flex; flex-direction: column; gap: .5rem; }
.td-blk-edit {
    display: flex; flex-direction: column; gap: .4rem;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--td-edge-soft);
    border-radius: 10px;
    padding: .5rem .55rem;
}
.td-blk-top { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.td-blk-tag { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--td-muted); }
.td-blk-ctl { display: flex; gap: .25rem; }
.td-blk-btn {
    min-width: 2.1rem; min-height: 2.1rem;
    border-radius: 8px; border: 1px solid var(--td-edge-soft);
    background: rgba(0, 0, 0, .35); color: var(--td-text);
    font: inherit; font-size: .8rem; line-height: 1; cursor: pointer;
}
.td-blk-btn:hover:not(:disabled) { border-color: var(--td-accent); color: var(--td-accent); }
.td-blk-btn:disabled { opacity: .35; cursor: default; }
.td-news-compose .td-blk-input-h { font-weight: 700; font-size: 1rem; }
.td-news-compose textarea.td-blk-input { min-height: 4.5rem; overflow: hidden; resize: none; line-height: 1.5; }
.td-blk-prev { max-width: 100%; max-height: 12rem; border-radius: 8px; background: #000; align-self: flex-start; }
.td-blk-aud { width: 100%; }
.td-blk-file { font-size: .7rem; color: var(--td-muted); overflow-wrap: anywhere; }
.td-blk-add { display: flex; flex-wrap: wrap; gap: .4rem; }
.td-blk-hint { margin: 0; }

/* Reader */
.td-blocks { display: flex; flex-direction: column; gap: .7rem; }
.td-news-blocks:not(.open) .td-blocks { display: none; }
.td-news-blocks.open .td-news-preview { display: none; }
.td-blk-h { margin: .3rem 0 0; font-size: .98rem; line-height: 1.3; color: var(--td-text); }
.td-blk-p { margin: 0; font-size: .86rem; line-height: 1.6; color: var(--td-text); white-space: pre-wrap; overflow-wrap: anywhere; }
.td-blk-media { margin: 0; display: flex; flex-direction: column; gap: .3rem; max-width: 100%; }
.td-blk-media figcaption { font-size: .74rem; font-style: italic; color: var(--td-muted); }
.td-media-slot { max-width: 30rem; }
.td-media-slot .td-media-item { align-items: stretch; }
.td-media-slot .td-media-item img, .td-media-slot .td-media-item video { width: 100%; max-height: 22rem; object-fit: contain; }
.td-news-media { gap: .8rem; }

/* Tap-to-load card: thumbnail with a bar underneath (or just the bar when there is no thumbnail) */
.td-mcard {
    position: relative; display: flex; flex-direction: column; width: 100%; padding: 0; overflow: hidden;
    border-radius: 10px; border: 1px solid var(--td-edge-soft);
    background: rgba(0, 0, 0, .3); color: var(--td-text);
    font: inherit; text-align: left; cursor: pointer;
}
.td-mcard:hover { border-color: var(--td-accent); }
.td-mcard.loading { opacity: .65; cursor: progress; }
.td-mcard-thumb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.td-mcard-bar { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; font-size: .78rem; font-weight: 700; }
.td-mcard-icon { font-size: 1.05rem; line-height: 1; color: var(--td-accent); }
.td-mcard.has-thumb .td-mcard-bar { background: rgba(0, 0, 0, .55); }
.td-mcard-video.has-thumb .td-mcard-icon {
    position: absolute; left: 50%; top: calc(50% - 1.1rem);
    transform: translate(-50%, -50%);
    width: 3.2rem; height: 3.2rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .6); border: 2px solid var(--td-accent);
    font-size: 1.2rem; padding-left: .15rem;
}

/* Collapsed article: cover image, a few lines of text, and what is inside */
.td-news-cover { display: block; width: 100%; max-height: 10rem; object-fit: cover; border-radius: 10px; margin-bottom: .5rem; background: #000; }
.td-news-chips { margin-top: .4rem; font-size: .74rem; color: var(--td-muted); }
