:root {
  --bg-a: #e8f4ff;
  --bg-b: #dbe9ff;
  --card: #ffffff;
  --ink-strong: #10254a;
  --ink-soft: #456084;
  --primary: #00a8e8;
  --primary-2: #1a63ff;
  --accent: #d5f6ff;
  --success: #147a43;
  --border: #b8d0ea;
  --banner-cyan: #33d7ff;
  --banner-magenta: #d34db7;
  --banner-green: #2dd9a6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100dvh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink-strong);
  background:
    radial-gradient(950px 360px at 5% -10%, rgba(51, 215, 255, 0.2) 0%, transparent 60%),
    radial-gradient(850px 340px at 95% 0%, rgba(211, 77, 183, 0.14) 0%, transparent 58%),
    linear-gradient(180deg, var(--bg-a), var(--bg-b));
}

body {
  padding-top: 54px;
  overflow: hidden;
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1200;
  background: linear-gradient(90deg, #f3fbff 0%, #edf4ff 60%, #f5efff 100%);
  border-bottom: 1px solid var(--border);
}

.skip-link {
  position: fixed;
  left: 0.75rem;
  top: -48px;
  z-index: 2000;
  background: #0b2f62;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
  border-radius: 0.55rem;
  transition: top 120ms ease;
}

.skip-link:focus-visible {
  top: 0.55rem;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.top-bar-inner {
  max-width: 100%;
  margin: 0 auto;
  min-height: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0.75rem;
}

.top-bar-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.top-bar-clock {
  font-size: clamp(1.12rem, 2.1vw, 1.55rem);
  font-weight: 800;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  color: var(--primary-2);
  line-height: 1;
  text-align: center;
  display: inline-block;
  min-width: 8ch;
  letter-spacing: 0;
}

.app-shell {
  max-width: 100%;
  height: calc(100vh - 54px);
  height: calc(100dvh - 54px);
  padding: 0;
  position: relative;
  z-index: 1;
}

.app-shell main {
  height: 100%;
}

.backoffice-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  position: relative;
  isolation: isolate;
}

body.sidebar-collapsed .backoffice-layout {
  grid-template-columns: 84px minmax(0, 1fr);
}

.backoffice-sidebar {
  position: sticky;
  top: 0;
  height: 100%;
  min-height: 0;
  background: linear-gradient(180deg, #f3fbff 0%, #edf6ff 100%);
  border-right: 1px solid var(--border);
  z-index: 6;
}

.backoffice-sidebar-body {
  height: 100%;
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.backoffice-main {
  min-height: 0;
  overflow: hidden;
  background: transparent;
  position: relative;
  z-index: 1;
}

.nav-header {
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--border);
}

.nav-banner {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
}

.sidebar-menu {
  display: grid;
  gap: 0.85rem;
}

.sidebar-group {
  display: grid;
  gap: 0.45rem;
}

.sidebar-group-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #6a7f99;
  padding: 0 0.15rem;
}

.sidebar-menu-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: #fff;
  color: var(--ink-strong);
  text-align: left;
  padding: 0.78rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  position: relative;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.sidebar-menu-item:hover {
  border-color: #75bce9;
  background: #f6fdff;
}

.sidebar-menu-item.active {
  background: linear-gradient(90deg, #def8ff 0%, #e9f0ff 70%, #f3ebff 100%);
  border-color: #6fb1ff;
  color: #0b2f62;
}

.sidebar-menu-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--banner-cyan), var(--primary-2), var(--banner-magenta));
}

.sidebar-menu-label {
  font-weight: 800;
  font-size: 0.96rem;
}

.sidebar-menu-icon {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  background: linear-gradient(180deg, #e6fbff, #eaf1ff);
  color: #1d4f8b;
  flex: 0 0 auto;
}

.sidebar-menu-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-menu-meta {
  color: #4c627f;
  font-size: 0.8rem;
  font-weight: 600;
}

body.sidebar-collapsed .sidebar-group-title,
body.sidebar-collapsed .sidebar-menu-text,
body.sidebar-collapsed .nav-header .label-sm,
body.sidebar-collapsed .nav-header h2 {
  display: none;
}

body.sidebar-collapsed .nav-banner {
  display: none;
}

body.sidebar-collapsed .nav-header {
  border-bottom: none;
  padding-bottom: 0.25rem;
}

body.sidebar-collapsed .nav-header::after {
  content: "Menu";
  display: block;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a7f99;
}

body.sidebar-collapsed .backoffice-sidebar-body {
  padding: 0.8rem 0.6rem;
}

body.sidebar-collapsed .sidebar-menu {
  gap: 0.45rem;
}

body.sidebar-collapsed .sidebar-menu-item {
  justify-content: center;
  padding: 0.6rem;
}

body.sidebar-collapsed .sidebar-menu-icon {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.88rem;
}

.sidebar-toggle-btn {
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  padding: 0.42rem 0.55rem;
}

.backoffice-content-body {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 20px;
  position: relative;
  z-index: 1;
  scroll-padding-top: 90px;
  scrollbar-gutter: stable;
}

.backoffice-page {
  min-height: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 auto;
  position: relative;
  isolation: isolate;
  animation: pageFadeIn 160ms ease;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.round-header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.question-nav-compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  width: 224px;
}

.question-nav-compact .btn {
  min-height: 44px;
  max-height: 44px;
  font-size: 0.84rem;
  line-height: 1;
  padding: 0.38rem 0.6rem;
}

#toggleAnswerBtn {
  min-height: 44px;
  padding-top: 0.38rem;
  padding-bottom: 0.38rem;
}

.round-top-sticky {
  position: relative;
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 0 0 0.55rem;
}

.round-sticky-stack {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #eaf2ff;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  padding: 0.75rem 0.85rem 0.7rem;
  box-shadow: 0 1px 0 rgba(16, 36, 62, 0.08);
}

.round-explainer {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.5rem 0 0;
  position: relative;
  z-index: 0;
}

.round-explainer-summary {
  list-style: none;
  cursor: pointer;
  font-weight: 800;
  color: #0d457f;
}

.round-explainer-summary::-webkit-details-marker {
  display: none;
}

.round-explainer-body {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.4rem;
  color: #1f3658;
  font-size: 0.95rem;
}

.round-explainer-body p {
  margin: 0;
}

.answer-explainer {
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: #ffffff;
  padding: 0.55rem 0.75rem;
}

.answer-explainer-body {
  margin-top: 0.55rem;
}

.challenge-stage {
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: linear-gradient(180deg, #ffffff, #f8fdff);
  padding: 0.85rem;
  display: grid;
  gap: 0.8rem;
  width: 100%;
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.intro-panel {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #fff;
  padding: 0.95rem 1rem;
}

.intro-panel-highlight {
  background: linear-gradient(180deg, #e7fbff 0%, #eef4ff 100%);
}

.intro-copy {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: #fff;
  padding: 1.2rem 1.25rem;
  display: grid;
  gap: 0.75rem;
  font-size: 1.03rem;
  line-height: 1.62;
}

.intro-copy p {
  margin: 0;
}

.round-section {
  color: #4c627f;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.label-sm {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-badge {
  font-size: clamp(1.2rem, 2.3vw, 1.8rem);
  font-weight: 800;
  color: var(--primary-2);
}

.question-text {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.4;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: #fbfdff;
}

#audioWrap {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
}

#spotifyWrap {
  margin-top: 0.35rem;
}

.spotify-embed {
  width: 100%;
  min-height: 152px;
  border: 0;
  border-radius: 0.7rem;
  background: #f5f9ff;
}

.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #f5fcff 100%);
}

.presenter-actions {
  width: min(100%, 360px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.presenter-actions .btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.question-start-button {
  width: min(100%, 360px);
}

.timer-question {
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  font-weight: 800;
  font-family: "JetBrains Mono", "Consolas", monospace;
  line-height: 1;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  color: var(--primary-2);
  display: inline-block;
  min-width: 5ch;
}

.answer-list {
  display: grid;
  gap: 0.55rem;
}

.answer-option {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: #fff;
}

.answer-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
}

.answer-image-caption {
  margin-top: 0.55rem;
  font-weight: 600;
}

.answer-correct-note {
  border: 1px solid #53b684;
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: #ebfff3;
  color: #0f4f2a;
}

.answer-correct-note-title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.answer-correct-note-value {
  font-weight: 800;
  font-size: 1rem;
}

.answer-correct-note-extra {
  margin-top: 0.2rem;
  font-weight: 600;
  color: #145735;
}

.answer-option.correct {
  border-color: #53b684;
  background: #ebfff3;
}

.answer-option.hidden-correct {
  opacity: 0.85;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-2);
  --bs-btn-hover-border-color: var(--primary-2);
  --bs-btn-color: #ffffff;
}

@media (max-width: 767.98px) {
  body.sidebar-collapsed .backoffice-layout {
    grid-template-columns: 1fr;
  }

  body {
    padding-top: 50px;
    overflow: auto;
  }

  .top-bar-inner {
    min-height: 42px;
    height: 42px;
  }

  .app-shell {
    max-width: 100%;
    height: auto;
  }

  .backoffice-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .backoffice-sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .backoffice-content-body {
    overflow: visible;
    padding: 0.9rem;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: stretch;
  }

  .round-header-side {
    width: 100%;
    align-items: flex-start;
  }

  .question-nav-compact {
    grid-template-columns: 1fr 1fr;
    width: min(100%, 220px);
  }

  .sidebar-menu-item {
    padding: 0.8rem 0.9rem;
  }
}
