:root {
  color-scheme: light dark;
  --accent: #ff0033;
  --bg: #0f1115;
  --panel: #1a1d24;
  --text: #f2f2f2;
  --muted: #9aa0aa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

main {
  width: 100%;
  max-width: 900px;
}

h1 {
  margin: 0 0 0.25rem;
}

.subtitle {
  color: var(--muted);
  margin-top: 0;
  line-height: 1.4;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.5rem 0 0.75rem;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.search-result-card {
  cursor: pointer;
  background: var(--panel);
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
  padding: 0;
}

.search-result-card:hover {
  border-color: var(--accent);
}

.search-result-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #000;
}

.search-result-info {
  padding: 0.5rem 0.6rem;
}

.search-result-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-meta {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.search-results-status {
  color: var(--muted);
  margin: 0 0 1rem;
}

.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: -0.25rem 0 1rem;
}

.search-pagination button {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  background: var(--panel);
  border: 1px solid #333;
}

.search-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.search-pagination-label {
  color: var(--muted);
  font-size: 0.85rem;
}

#video-input {
  flex: 1 1 300px;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
}

button {
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

#connect-btn {
  background: #2d6cdf;
}

.status {
  color: var(--muted);
  min-height: 1.2em;
}

video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: black;
  border-radius: 12px;
  margin-top: 0.5rem;
}

#unmute-btn {
  margin-top: 0.5rem;
  background: #2d6cdf;
}

.google-login {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid #333;
  border-radius: 10px;
  background: var(--panel);
}

.google-login summary {
  cursor: pointer;
  font-weight: 600;
}

.google-login .hint {
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.9rem;
}

.google-login ol {
  padding-left: 1.2rem;
  line-height: 2.2;
}

.google-login a {
  color: #6ea8fe;
}

.google-login button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  background: #2d6cdf;
}

#cookies-file-input {
  color: var(--text);
}

#cookies-text-input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  resize: vertical;
}

#login-gate {
  margin-top: 2rem;
  padding: 2rem;
  border: 1px solid #333;
  border-radius: 12px;
  background: var(--panel);
  text-align: center;
}

.google-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  background: #2d6cdf;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.google-login-btn:hover {
  filter: brightness(1.1);
}

.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}

#logout-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: var(--panel);
  border: 1px solid #333;
}

#status-btn,
#check-btn {
  background: #2d6cdf;
}

.diagnostics-output {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid #333;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
  /* Console-like: fixed height, scrolls instead of growing the whole page.
     Newest entries are rendered first (see app.js), so the freshest line
     is always right at the top without needing to scroll for it. */
  max-height: 260px;
  overflow-y: auto;
}
