:root {
  --bg: #0f1115;
  --fg: #e6e6e6;
  --accent: #4da3ff;
  --panel: #171a21;
  --border: #2a2f3a;
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
}

main {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

main.dashboard-main { max-width: 900px; }

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.service-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--fg);
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

a.service-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.service-card.disabled { opacity: 0.5; cursor: not-allowed; }

.service-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.service-name { font-weight: 600; margin-bottom: 0.35rem; }
.service-description { font-size: 0.85rem; opacity: 0.75; }

.service-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

h1 { font-size: 1.4rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; opacity: 0.9; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

label { display: block; font-size: 0.85rem; margin-bottom: 0.25rem; opacity: 0.8; }

input, select, textarea {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #0c0e12;
  color: var(--fg);
}

textarea { font-family: inherit; resize: vertical; }

button {
  padding: 0.6rem 1rem;
  border-radius: 4px;
  border: none;
  background: var(--accent);
  color: #06131f;
  font-weight: 600;
  cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: transparent; border: 1px solid var(--border); color: var(--fg); }

.status-line { font-size: 0.85rem; opacity: 0.8; }
.error { color: #ff6b6b; }

#transcript {
  min-height: 240px;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.segment { padding: 0.4rem 0.6rem; border-radius: 4px; background: rgba(255,255,255,0.03); }
.segment.partial { opacity: 0.6; }

/* /viewer/index.html: pure subtitle display, meant for a second screen or an OBS-style capture -
   transparent page background so only the subtitle-bar's own (configurable) background shows. */
body.subtitle-page {
  background: transparent;
  padding: 0;
  display: block;
}

/* /viewer/settings.html: config form. Reuses the standard .panel/<main> layout. */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
}

.settings-row label { margin: 0; }
.settings-row input, .settings-row select { margin: 0; width: auto; flex: 1; }
.settings-row input[type="color"] { padding: 0; height: 1.8rem; }
.settings-row input[type="checkbox"] { flex: none; }

.subtitle-preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}

/* .subtitle-bar's position (fixed on the real display page, absolute inside the frame above for
   the settings-page preview) and most other visual properties are set inline via JS from the
   user's settings (see shared/subtitleSettings.js applySubtitleStyle) - these rules only cover
   structure that never changes. */
.subtitle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  padding: 0.5em 0.8em;
  transition: opacity 0.15s ease;
}

.subtitle-text {
  width: 100%;
  text-align: center;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.subtitle-text .partial-part {
  font-style: italic;
  opacity: 0.78;
}

/* /viewer/fulltext.html: full-screen running transcript, meant for a room/audience display (vs.
   the compact subtitle-bar above, meant to be burned into a video signal). Page fills the
   viewport (body.fulltext-page); the settings-page preview instead boxes the same
   .fulltext-scroll/.fulltext-content structure inside .fulltext-preview-frame - only the
   ancestor's positioning differs, colors/font/width are set inline via JS (see
   shared/fulltextSettings.js applyFulltextStyle). */
body.fulltext-page {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body.fulltext-page .fulltext-scroll {
  position: fixed;
  inset: 0;
}

.fulltext-preview-frame {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: 6px;
  overflow: hidden;
}

.fulltext-preview-frame .fulltext-scroll {
  position: absolute;
  inset: 0;
}

.fulltext-scroll {
  overflow-y: auto;
}

.fulltext-content {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 3vh 1.5vw;
  line-height: 1.5;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.fulltext-paragraph {
  margin: 0 0 0.6em 0;
}

.fulltext-paragraph.fulltext-partial {
  font-style: italic;
  opacity: 0.7;
}
