/* ===== Live-Ticker Banner ===== */
#live-ticker-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--accent, #1d6b4f);
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid rgba(0, 0, 0, 0.15);
}

#live-ticker-banner.lt-banner-visible {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lt-banner-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  animation: lt-pulse 1.4s ease-in-out infinite;
}

@keyframes lt-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.lt-banner-text {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lt-banner-text--scrolling {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.lt-banner-text--scrolling .lt-scroll-inner {
  display: inline-block;
  animation: lt-marquee 35s linear infinite;
  will-change: transform;
}

@keyframes lt-marquee {
  from { transform: translateX(var(--lt-start-x, 100%)); }
  to   { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
  .lt-banner-text--scrolling .lt-scroll-inner {
    animation: none;
  }
}

/* Lauftext-Zeile in der Live-Ticker-Karte (Rollenverwaltung) */
.lt-scrolling-setting {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

.lt-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 6px;
}

.lt-speed-label {
  font-size: 0.82rem;
  color: var(--muted, #666);
  flex-shrink: 0;
}

.lt-speed-select {
  padding: 4px 8px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 6px;
  font-size: 0.82rem;
  background: var(--surface, #fff);
  color: var(--tx, #222);
}

.lt-banner-arrow {
  flex-shrink: 0;
  font-size: 1rem;
  opacity: 0.8;
}

/* ===== Live-Ticker View ===== */
#live-ticker-view {
  padding: 0;
}

.lt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 8px;
  flex-wrap: wrap;
}

.lt-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.lt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lt-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
}

.lt-filter-btn {
  padding: 4px 12px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--tx, #222);
  transition: background 0.15s, color 0.15s;
}

.lt-filter-btn.active {
  background: var(--accent, #1d6b4f);
  color: #fff;
  border-color: var(--accent, #1d6b4f);
}

/* Match list */
.lt-match-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lt-match-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e0e0e0);
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}

.lt-match-card:hover {
  background: var(--surface-2, #f5f5f5);
}

.lt-match-card-left {
  flex: 1;
  min-width: 0;
}

.lt-match-teams {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lt-match-meta {
  font-size: 0.78rem;
  color: var(--muted, #666);
  margin-top: 2px;
}

.lt-match-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.lt-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tx, #222);
}

/* Status badges */
.lt-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lt-status-badge.planned {
  background: var(--surface-2, #eee);
  color: var(--muted, #666);
}

.lt-status-badge.running {
  background: #d4edda;
  color: #1a5c28;
}

.lt-status-badge.finished {
  background: #e2e3e5;
  color: #383d41;
}

/* ===== Detail View ===== */
.lt-detail-header {
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border, #e0e0e0);
}

.lt-back-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent, #1d6b4f);
  font-size: 0.85rem;
  padding: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lt-detail-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.lt-detail-subtitle {
  font-size: 0.82rem;
  color: var(--muted, #666);
  margin: 0 0 10px;
}

.lt-mobile-status {
  display: none;
  font-weight: 700;
  color: var(--accent, #1d6b4f);
}

.lt-detail-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.lt-detail-score {
  font-size: 1.4rem;
  font-weight: 700;
}

.lt-status-control {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 4px;
}

.lt-status-btn {
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border, #d0d0d0);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--tx, #222);
}

.lt-status-btn.active {
  border-color: var(--accent, #1d6b4f);
  background: var(--accent, #1d6b4f);
  color: #fff;
}

/* Encounters table */
.lt-encounters-section {
  padding: 12px 16px 0;
}

.lt-encounters-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted, #666);
  margin: 12px 0 6px;
}

.lt-enc-section-update {
  display: inline;
  margin-left: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--tx, #222);
}

.lt-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.lt-encounters-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 340px;
  font-size: 0.85rem;
}

.lt-encounters-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted, #666);
  border-bottom: 2px solid var(--border, #e0e0e0);
  white-space: nowrap;
}

.lt-encounters-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border, #f0f0f0);
  vertical-align: middle;
}

.lt-encounters-table tr:last-child td {
  border-bottom: none;
}

.lt-enc-nr {
  width: 20px;
  font-weight: 700;
  color: var(--muted, #888);
  white-space: nowrap;
  text-align: center;
}

.lt-enc-player {
  color: var(--tx, #222);
}

.lt-enc-score {
  font-weight: 600;
  white-space: nowrap;
}

.lt-enc-si-cell,
.lt-enc-action-cell {
  width: 28px;
  text-align: center;
  white-space: nowrap;
}

/* Winner bold / loser muted per set */
.lt-sc-lo {
  color: var(--muted, #aaa);
  font-weight: normal;
}

.lt-winner-trophy {
  margin-left: 0.25em;
  font-size: 0.82em;
  vertical-align: 0.02em;
}

.lt-enc-si {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lt-enc-si-open    { color: var(--muted, #999); }
.lt-enc-si-running { color: var(--accent, #1d6b4f); }
.lt-enc-si-finished { color: #555; }

.lt-enc-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--accent, #1d6b4f);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lt-enc-edit-btn:hover {
  background: var(--surface-2, #f0f0f0);
}

/* ===== Score input grid (dialog) ===== */
.lt-score-grid {
  display: grid;
  grid-template-columns: 1fr 52px 52px 52px;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}

.lt-sg-head {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #666);
}

.lt-sg-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #555);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 4px;
}

.lt-sg-in {
  width: 100%;
  padding: 6px 2px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
  background: var(--surface, #fff);
  color: var(--tx, #222);
  box-sizing: border-box;
}

/* W.O. buttons */
.lt-wo-row {
  margin-top: 4px;
}

.lt-wo-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lt-wo-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border, #d0d0d0);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--tx, #222);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lt-wo-btn.active {
  background: var(--accent, #1d6b4f);
  color: #fff;
  border-color: var(--accent, #1d6b4f);
}

/* ===== Edit Modal ===== */
.lt-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 560px) {
  .lt-modal-overlay {
    align-items: center;
  }
}

.lt-modal {
  background: var(--surface, #fff);
  border-radius: 12px 12px 0 0;
  padding: 20px 20px 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 560px) {
  .lt-modal {
    border-radius: 12px;
    max-height: 85vh;
  }
}

.lt-modal h3 {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 700;
}

.lt-form-row {
  margin-bottom: 14px;
}

.lt-form-row label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #666);
  margin-bottom: 4px;
}

.lt-form-row input,
.lt-form-row select,
.lt-form-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--surface, #fff);
  color: var(--tx, #222);
  box-sizing: border-box;
}

.lt-score-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lt-score-inputs input {
  width: 60px;
  text-align: center;
  flex-shrink: 0;
}

.lt-score-sep {
  font-weight: 700;
  color: var(--muted, #888);
}

.lt-radio-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lt-radio-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: normal;
  color: var(--tx, #222);
  cursor: pointer;
}

.lt-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.lt-modal-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.lt-btn-primary {
  background: var(--accent, #1d6b4f);
  color: #fff;
}

.lt-btn-secondary {
  background: var(--surface-2, #eee);
  color: var(--tx, #222);
}

/* Empty state */
.lt-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted, #888);
  font-size: 0.9rem;
}

/* New match form */
.lt-new-match-form {
  padding: 0 16px 16px;
  background: var(--surface-2, #f8f8f8);
  border-radius: 8px;
  margin: 0 16px 16px;
}

.lt-new-match-form h3 {
  margin: 0;
  padding: 14px 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
}

@media (max-width: 480px) {
  .lt-mobile-status {
    display: inline;
  }

  .lt-detail-meta-row .lt-status-badge.running {
    display: none;
  }

  .lt-encounters-section {
    padding: 10px 10px 0;
  }

  .lt-encounters-section h3 {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.2;
  }

  .lt-enc-section-update {
    margin-left: 0;
    display: inline-block;
    max-width: 100%;
    text-align: right;
    white-space: normal;
  }

  .lt-table-scroll {
    overflow-x: visible;
  }

  .lt-encounters-table {
    display: block;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .lt-encounters-table thead {
    display: none;
  }

  .lt-encounters-table tbody {
    display: grid;
    gap: 8px;
  }

  .lt-encounters-table tr {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) minmax(56px, auto) 30px 34px;
    grid-template-areas:
      "nr player1 score status action"
      "nr player2 score status action";
    column-gap: 8px;
    align-items: center;
    padding: 9px 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.55);
  }

  .lt-encounters-table tr:last-child {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .lt-encounters-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border-bottom: none;
  }

  .lt-enc-nr {
    grid-area: nr;
    width: auto;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
  }

  .lt-enc-player {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
  }

  .lt-enc-player:nth-of-type(2) {
    grid-area: player1;
  }

  .lt-enc-player:nth-of-type(3) {
    grid-area: player2;
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
  }

  .lt-enc-player:nth-of-type(3)::before {
    content: "vs";
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted, #777);
  }

  .lt-enc-score {
    grid-area: score;
    max-width: 84px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
    line-height: 1.2;
    font-size: 0.78rem;
    align-self: center;
  }

  .lt-enc-si-cell {
    grid-area: status;
    width: 30px;
  }

  .lt-enc-action-cell {
    grid-area: action;
    width: 34px;
  }

  .lt-enc-edit-btn {
    width: 32px;
    height: 32px;
    padding: 0;
  }
}
