:root {
  --sync-shadow: 0 18px 50px rgba(30, 51, 87, 0.12);
  --sync-soft: #eff5fb;
}

.sync-container {
  width: min(100%, 1920px);
  max-width: none;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 12px;
  padding-bottom: 16px;
}

.sync-shell {
  flex: 1;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(268px, 306px) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 0;
}

.sync-shell > .panel {
  margin-top: 0;
}

.sync-sidebar,
.sync-viewer-panel {
  min-height: 0;
}

.sync-sidebar {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 14px 12px;
}

.sync-sidebar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.sync-sidebar-head h2 {
  margin-bottom: 6px;
}

.sync-sidebar-player {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(127, 148, 180, 0.24);
  border-radius: 16px;
  background: linear-gradient(180deg, #f9fbff 0, #f1f6fd 100%);
}

.sync-back-link {
  font-size: 13px;
}

.sync-sidebar-status .status {
  margin: 0;
}

.sync-sidebar-status .status + .status {
  margin-top: 6px;
}

.sync-sidebar-buttons {
  margin-bottom: 0;
}

.sync-sidebar-buttons .button {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
}

.sync-sidebar-settings {
  margin-bottom: 0;
}

.sync-sidebar-settings label {
  flex: 1 1 100%;
  justify-content: space-between;
}

.sync-sidebar-settings select {
  width: 100%;
  min-width: 0;
}

.sync-sidebar-settings .button {
  width: 100%;
}

.sync-track-list {
  flex: 1 1 auto;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0 2px 0 0;
  display: grid;
  gap: 8px;
  overflow: auto;
}

.sync-track-btn {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 9px 10px;
  color: var(--text);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sync-track-btn:hover {
  border-color: #8fb0d7;
  background: #f7fbff;
  transform: translateY(-1px);
}

.sync-track-btn.active {
  border-color: var(--accent);
  background: #ecfaf7;
  box-shadow: 0 10px 24px rgba(14, 122, 106, 0.12);
}

.sync-track-no {
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  color: #22344d;
  text-align: right;
}

.sync-track-copy {
  min-width: 0;
}

.sync-track-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sync-track-page {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.sync-viewer-title h2 {
  margin: 0;
  font-size: clamp(16px, 1.45vw, 20px);
  line-height: 1.2;
  white-space: nowrap;
}

.sync-audio {
  margin-top: 0;
}

.sync-viewer-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 10px 12px 12px;
}

.sync-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sync-viewer-title {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.sync-viewer-title .status {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.sync-viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sync-viewer-controls .button {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.sync-page-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.sync-page-input {
  width: 76px;
  min-width: 76px;
  padding: 6px 8px;
}

.sync-pdf-viewport {
  margin-top: 6px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 10px 8px 12px;
  background:
    radial-gradient(circle at top right, rgba(14, 122, 106, 0.08) 0, rgba(14, 122, 106, 0) 28%),
    linear-gradient(180deg, #f7fbff 0, #eff4fa 100%);
}

.sync-pdf-pages {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sync-pdf-page {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sync-pdf-stage {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(127, 148, 180, 0.3);
  border-radius: 14px;
  box-shadow: var(--sync-shadow);
}

.sync-pdf-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
}

.sync-pdf-links {
  position: absolute;
  inset: 0;
}

.sync-pdf-link {
  position: absolute;
  display: block;
  border-radius: 4px;
  background: rgba(14, 122, 106, 0);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.sync-pdf-link:hover,
.sync-pdf-link:focus-visible {
  background: rgba(14, 122, 106, 0.14);
  box-shadow: inset 0 0 0 1px rgba(14, 122, 106, 0.4);
  outline: none;
}

.sync-pdf-page-no {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .sync-container {
    height: auto;
  }

  .sync-shell {
    grid-template-columns: 1fr;
  }

  .sync-sidebar {
    height: auto;
    max-height: none;
  }

  .sync-viewer-panel {
    height: auto;
  }

  .sync-pdf-viewport {
    min-height: 560px;
  }
}

@media (max-width: 760px) {
  .sync-track-btn {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 9px 10px;
  }

  .sync-track-no {
    font-size: 16px;
  }

  .sync-track-title {
    font-size: 15px;
  }

  .sync-sidebar-buttons .button {
    flex-basis: calc(50% - 6px);
  }

  .sync-pdf-viewport {
    min-height: 64vh;
    padding: 12px 8px 14px;
  }

  .sync-viewer-controls,
  .sync-top-meta {
    gap: 10px;
  }
}
