:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --text: #151821;
  --muted: #687083;
  --line: #d7e0ea;
  --accent: #0f8f8c;
  --accent-dark: #08706e;
  --ink: #102a43;
  --soft: #f6f9fc;
  --shadow: 0 14px 34px rgba(16, 42, 67, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(15, 143, 140, 0.16), transparent 28%),
    linear-gradient(180deg, #f8fbfd 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 24px;
  align-items: end;
  padding: 32px 0 22px;
}

.hero-copy {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.credentials,
.discord-panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-grid label,
.filters label {
  min-width: 0;
}

.field-grid .span-2 {
  grid-column: 1 / -1;
}

.filters,
.import-export {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters {
  padding: 12px;
  margin-bottom: 12px;
}

.filters label,
.field-grid label {
  flex: 1 1 260px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.filters span,
.field-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filters input,
.field-grid input {
  background: transparent;
  padding: 4px 0;
}

.import-export {
  padding: 12px;
  margin-bottom: 14px;
  align-items: center;
}

.file-picker,
.secondary {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 16px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.file-picker input {
  display: none;
}

.import-export button {
  min-height: 42px;
}

.secondary {
  background: #fff;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
}

.search {
  display: flex;
  gap: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 14px;
  font-size: 15px;
  outline: none;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 0 22px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.status {
  margin-bottom: 18px;
  padding: 14px 16px;
  color: var(--muted);
}

.status.error {
  border-color: #ffb8c9;
  color: var(--accent-dark);
}

.result {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none;
}

.video-card,
.comments-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.video-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  padding: 20px;
}

.thumbnail {
  min-height: 292px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f2f3d, #246b6a);
  background-position: center;
  background-size: cover;
}

.platform-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: #dff3f1;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.source,
.meta,
.summary {
  color: var(--muted);
}

h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.stat strong {
  display: block;
  font-size: 20px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.comments-panel {
  overflow: hidden;
  margin-top: 14px;
}

.comments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

h3 {
  margin: 0;
}

.comment-count {
  color: var(--muted);
}

.comments {
  display: grid;
  gap: 0;
}

.comment {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.empty-state,
.error-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.error-card {
  border-color: #ffb8c9;
  color: var(--accent-dark);
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eef1f7;
  color: var(--accent);
  font-weight: 900;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment p {
  margin: 4px 0 8px;
}

.comment small {
  color: var(--muted);
}

@media (max-width: 780px) {
  .toolbar,
  .hero,
  .control-grid,
  .video-card {
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .search {
    flex-direction: column;
  }

  button {
    min-height: 44px;
  }

  .thumbnail {
    min-height: 210px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
