*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  background: #fafafa;
  color: #111;
  overflow-x: hidden;
}

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar {
  background: white;
  border-bottom: 1px solid #e5e5e5;
  padding: 7px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.session-title {
  font-size: 0.85rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  color: #888;
}

.status-idle  { color: #888; }
.status-live  { color: #0a7a28; }
.status-ended { color: #9a6700; }
.status-error { color: #ca8a04; }

.topbar-controls {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-shrink: 0;
}

.ctrl-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ctrl-group .toggle-switch {
  margin-top: 4px;
}

.ctrl-label {
  font-size: 0.75rem;
  color: #aaa;
  white-space: nowrap;
}

.topbar-controls select {
  font-size: 0.85rem;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 7px;
  background: #f5f5f5;
  color: #333;
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  display: inline-block;
  width: 32px;
  height: 18px;
  background: #ccc;
  border-radius: 999px;
  transition: background 0.2s;
  position: relative;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-track {
  background: #2563eb;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(14px);
}

body.hide-original .final-original {
  display: none;
}

.scroll-btn {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #ffffff;
  border-radius: 50%;
  color: #1f2937;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.15s, background 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.22);
}

.scroll-btn:hover {
  background: #f1f5f9;
}

.scroll-btn.at-bottom {
  opacity: 0.25;
  cursor: default;
}

/* Class rules only apply `display` when NOT [hidden] — a plain unconditional
   `display` here would outrank the browser's own `[hidden] { display: none }`
   rule (equal specificity, author stylesheet wins), silently breaking the
   hidden attribute as a way to show/hide these elements. */
.summary-entry {
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 7px;
  background: #f5f5f5;
  color: #2563eb;
  cursor: pointer;
  transition: background 0.15s;
}
.summary-entry:not([hidden]) {
  display: flex;
}
.summary-entry:hover { background: #eef2f7; }

.summary-toast {
  position: fixed;
  right: 14px;
  bottom: 18px;
  z-index: 150;
  align-items: stretch;
  max-width: min(360px, calc(100vw - 28px));
  background: #1e293b;
  color: #f1f5f9;
  border-radius: 10px;
  border-left: 3px solid #3b82f6;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: summary-toast-in 0.2s ease-out;
}
.summary-toast:not([hidden]) {
  display: flex;
}

@keyframes summary-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-toast-body {
  flex: 1;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.4;
  cursor: pointer;
}

.summary-toast-close {
  border: none;
  border-left: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(241,245,249,0.6);
  padding: 0 12px;
  cursor: pointer;
  font-size: 0.8rem;
}
.summary-toast-close:hover { color: #fff; }

/* ── summary-overview.html: standalone tile-grid page ──────────────────── */

.summary-page-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.summary-page {
  max-width: 960px;
  margin: 0 auto;
}

.summary-page-heading {
  margin-bottom: 22px;
}

.summary-page-title {
  margin: 0 0 4px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #111827;
}

.summary-page-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.summary-empty {
  color: #6b7280;
  font-size: 0.9rem;
  padding: 16px 4px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.summary-grid:not([hidden]) {
  display: grid;
}

.summary-tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.summary-tile:hover {
  box-shadow: 0 6px 18px rgba(15,23,42,0.08);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.summary-tile-icon {
  color: #2563eb;
}

.summary-tile-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.summary-tile-kind {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.summary-tile-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}

.summary-tile-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2563eb;
}
.summary-tile:hover .summary-tile-cta { color: #1d4ed8; }

.terms-gate-overlay {
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
}
.terms-gate-overlay:not([hidden]) {
  display: flex;
}

.terms-gate-box {
  max-width: 420px;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
}

.terms-gate-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}

.terms-gate-text {
  margin: 0 0 18px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #4b5563;
  white-space: pre-line;
}

.terms-gate-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #374151;
  cursor: pointer;
  user-select: none;
}
.terms-gate-checkbox-row input {
  margin-top: 2px;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

.terms-gate-agree {
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.terms-gate-agree:hover { background: #1d4ed8; }
.terms-gate-agree:disabled {
  background: #cbd5e1;
  color: #f8fafc;
  cursor: not-allowed;
}

.announcement-banner {
  background: #1e3a5f;
  color: #e0eeff;
  padding: 10px 16px;
  border-bottom: 2px solid #3b82f6;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.announcement-text {
  white-space: pre-wrap;
}

.announcement-link {
  color: #93c5fd;
  text-decoration: underline;
  word-break: break-all;
}

.content {
  padding: 20px 14px 80px;
  max-width: 900px;
}

#transcript {
  list-style: none;
  padding: 0;
  margin: 0;
}

.entry {
  position: relative;
  margin-bottom: 18px;
}

.entry-speaker {
  border-left: 4px solid var(--speaker-color);
  padding-left: 10px;
}

@keyframes polishing-pulse {
  0%, 100% { border-left-color: var(--speaker-color, #9ca3af); }
  50%       { border-left-color: color-mix(in srgb, var(--speaker-color, #9ca3af) 22%, transparent); }
}

.entry.seg-polishing {
  border-left: 4px solid var(--speaker-color, #9ca3af);
  padding-left: 10px;
  animation: polishing-pulse 1.5s ease-in-out infinite;
  font-style: italic;
}

@keyframes polished-flash {
  0%   { background-color: transparent; }
  20%  { background-color: rgba(0, 0, 0, 0.05); }
  100% { background-color: transparent; }
}

.entry.seg-just-polished {
  animation: polished-flash 0.8s ease-out forwards;
}

@keyframes seg-collapse {
  0%   { opacity: 1; max-height: 300px; margin-bottom: 18px; }
  100% { opacity: 0; max-height: 0; margin-bottom: 0; }
}

.entry.seg-collapsing {
  overflow: hidden;
  animation: seg-collapse 0.6s ease-out forwards;
}

.final-original {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 4px;
}

.final-translation {
  color: #111;
  font-size: 1.2rem;
  line-height: 1.35;
}

.partial {
  color: #111;
  font-style: italic;
  font-size: 1.2rem;
  margin-bottom: 18px;
}

.session-note {
  color: #666;
  font-size: 0.95rem;
  margin: 8px 0 16px 0;
}

@media (min-width: 2200px) {
  html { zoom: 1.3; }
}

@media (min-width: 3000px) {
  html { zoom: 1.75; }
}

@media (max-width: 640px) {
  .content {
    padding: 12px;
    max-width: none;
  }

  .final-translation,
  .partial {
    font-size: 1.05rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .final-original {
    font-size: 0.85rem;
  }
}
