/* ═══════════════════════════════════════════════════════
   Prominence Player — TED Demo Styles
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #0b0c1e;
  --bg2: #111228;
  --bg3: #1a1b3a;
  --surface: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --tx: #e8e8f0;
  --tx2: #8888aa;
  --accent: #6c8cff;
  --accent2: #a78bfa;
  --gold: #fbbf24;
  --success: #34d399;
  --glass: rgba(17,18,39,0.85);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
  overflow-y: auto;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* ═══ Header ═══ */
.header {
  text-align: center;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.header__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header__icon { font-size: 1.6rem; }

.header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header__sub {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--tx2);
}

/* ═══ Clip Grid ═══ */
.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.clip-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.clip-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(108,140,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.clip-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(108,140,255,0.15);
}

.clip-card.active {
  border-color: var(--accent);
  background: var(--bg3);
  box-shadow: 0 0 0 2px rgba(108,140,255,0.3);
}

.clip-card__name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.clip-card__speaker {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.clip-card__title {
  font-size: 0.72rem;
  color: var(--tx2);
  line-height: 1.3;
  margin-bottom: 8px;
}

.clip-card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.clip-badge {
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--tx2);
}

.clip-badge.high { border-color: var(--gold); color: var(--gold); }
.clip-badge.low  { border-color: var(--accent); color: var(--accent); }

/* ═══ Player ═══ */
.player-section { display: none; }
.player-section.visible { display: block; }

.player-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
  margin-bottom: 10px;
}

.player-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-subtitle-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 40px 36px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
  pointer-events: none;
}

.player-subtitle-text {
  text-align: center;
  line-height: 1.6;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

/* Line-based display */
.sub-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15em;
  transition: opacity 0.25s ease;
}

.sub-line--current { opacity: 1; }
.sub-line--next    { opacity: 0.35; }

.sub-line-placeholder {
  color: rgba(255,255,255,0.3);
  font-size: 0.9rem;
  font-weight: 400;
  font-style: italic;
}

/* Subtitle word styles */
.sub-word {
  display: inline-block;
  color: white;
  font-weight: 700;
  text-shadow:
    -2px -2px 0 rgba(0,0,0,0.9),
     2px -2px 0 rgba(0,0,0,0.9),
    -2px  2px 0 rgba(0,0,0,0.9),
     2px  2px 0 rgba(0,0,0,0.9),
     0 0 10px rgba(0,0,0,0.5);
  transition: color 0.08s, opacity 0.08s, text-shadow 0.08s;
  opacity: 0.25;
  cursor: default;
  vertical-align: baseline;
}

.sub-word.active {
  opacity: 1;
  color: #fff;
}

.sub-word.past {
  opacity: 0.5;
  color: #ccc;
}

.sub-word.prominent {
  color: #c8d8ff;
  text-shadow:
    -2px -2px 0 rgba(0,0,0,0.9),
     2px -2px 0 rgba(0,0,0,0.9),
    -2px  2px 0 rgba(0,0,0,0.9),
     2px  2px 0 rgba(0,0,0,0.9),
     0 0 16px rgba(108,140,255,0.4);
}

.player-fullscreen-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.player-wrapper:hover .player-fullscreen-btn { opacity: 1; }
.player-fullscreen-btn:hover { background: rgba(0,0,0,0.7); }

/* Transport */
.transport {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.transport__btns { display: flex; gap: 4px; }

.transport__btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--tx);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.transport__btn:hover {
  border-color: var(--accent);
  background: rgba(108,140,255,0.1);
}

.transport__seek {
  flex: 1;
  -webkit-appearance: none;
  background: var(--border);
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
}

.transport__seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.transport__time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--accent);
  min-width: 90px;
  text-align: right;
}

/* Condition Bar */
.condition-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.condition-label {
  font-size: 0.75rem;
  color: var(--tx2);
  white-space: nowrap;
}

.condition-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.condition-tab {
  padding: 5px 14px;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--tx2);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.condition-tab:hover { border-color: var(--accent); color: var(--tx); }

.condition-tab.active {
  background: rgba(108,140,255,0.12);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Clip Info */
.clip-info {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--tx2);
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

#clip_speaker { font-weight: 600; color: var(--tx); }

/* Legend */
.legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 16px;
  margin-top: 10px;
}

.legend-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.legend-word {
  font-weight: 700;
  text-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.legend-small  { font-size: 14px; opacity: 0.6; }
.legend-normal { font-size: 20px; opacity: 0.85; }
.legend-large  { font-size: 28px; color: #c8d8ff; }

.legend-desc {
  font-size: 0.7rem;
  color: var(--tx2);
}

/* ═══ Fullscreen ═══ */
.player-wrapper:fullscreen {
  border-radius: 0;
  max-width: none;
}

.player-wrapper:fullscreen .player-subtitle-overlay {
  padding-bottom: 56px;
}

.player-wrapper:fullscreen .sub-word { font-size: 130% !important; }

/* ═══ Responsive ═══ */
@media (max-width: 640px) {
  .clip-grid { grid-template-columns: repeat(2, 1fr); }
  .condition-bar { flex-direction: column; align-items: flex-start; }
  .player-subtitle-overlay { padding: 16px 20px 28px; }
}
