:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #edf1f3;
  --text: #182026;
  --muted: #64717a;
  --line: #d7dee3;
  --accent: #1d6f72;
  --accent-dark: #15585a;
  --warn: #9a5a16;
  --shadow: 0 12px 32px rgba(24, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(29, 111, 114, 0.35);
  outline-offset: 2px;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  min-height: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fbfcfc;
  padding: 18px 14px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.brand {
  padding: 4px 6px 16px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

.video-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.video-button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.video-button:hover {
  background: var(--surface-strong);
}

.video-button.active {
  border-color: var(--accent);
  background: #e7f2f2;
}

.video-button strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.video-button span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.badge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.model-toggle {
  display: inline-grid;
  grid-auto-flow: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-strong);
}

.model-toggle.single {
  display: inline-block;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.model-button {
  min-width: 72px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.model-button:last-child {
  border-right: 0;
}

.model-button.active {
  background: var(--accent);
  color: #fff;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

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

.video-panel {
  padding: 12px;
}

video {
  width: min(100%, 420px);
  margin: 0 auto;
  aspect-ratio: 25 / 36;
  display: block;
  background: #111;
  border-radius: 6px;
  object-fit: cover;
  object-position: center center;
}

.results-panel {
  padding: 14px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-strong);
}

.tab {
  min-width: 104px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab:last-child {
  border-right: 0;
}

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

.panel-view {
  display: none;
  padding-top: 14px;
}

.panel-view.active {
  display: block;
}

.description {
  margin: 0 0 14px;
  color: #2c383f;
  line-height: 1.45;
}

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

.rating-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.rating-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.rating-head h3,
.section-block h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: 0;
}

.score {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.rating-card p,
.candidate p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.section-block {
  margin-top: 16px;
}

.hint-button {
  position: relative;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  margin-left: 5px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 1px;
  cursor: help;
}

.hint-button:hover,
.hint-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  outline: none;
}

.hint-tooltip {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(100% + 8px);
  width: min(260px, 70vw);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: #3f4c53;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}

.hint-button:hover .hint-tooltip,
.hint-button:focus-visible .hint-tooltip {
  opacity: 1;
}

.plain-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.candidate-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.candidate {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.candidate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.candidate strong {
  font-size: 14px;
}

.confidence {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.components-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
}

.components-list div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.components-list dt {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.components-list dd {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar {
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .video-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 220px;
  }

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

  .workspace {
    overflow: visible;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    display: block;
  }

  .badge {
    display: inline-block;
    margin-top: 10px;
  }

  .topbar-actions {
    justify-content: flex-start;
    margin-top: 10px;
  }

  .badge {
    margin-top: 0;
  }

  .video-list,
  .ratings-grid {
    grid-template-columns: 1fr;
  }
}
