:root {
  --surface: #171717;
  --textfield: rgba(0, 0, 0, 0.2);
  --float-panel: #242424;
  --stroke: #1f1f1f;
  --elevation-0: rgba(255, 255, 255, 0.03);
  --elevation-1: rgba(255, 255, 255, 0.06);
  --elevation-2: rgba(255, 255, 255, 0.12);
  --primary: #f2f2f2;
  --secondary: #999;
  --tertiary: #4d4d4d;
  --brand: #33bbff;
  --brand-hover: #66ccff;
  --brand-dark: #006699;
  --danger: #ffab02;
  --low: #ffbb33;
  --mid: #ff7433;
  --high: #df0000;
  --ok: #1eb500;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--surface);
  color: var(--primary);
  font-family: Inter, "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.1px;
  user-select: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

svg {
  width: 20px;
  height: 20px;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.hidden { display: none !important; }
.muted { color: var(--secondary); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  width: fit-content;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: transparent;
  color: var(--secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s cubic-bezier(0, 0, 0.6, 1), background-color 0.2s cubic-bezier(0, 0, 0.6, 1), box-shadow 0.2s cubic-bezier(0, 0, 0.6, 1);
}

.button:hover:enabled,
.button.menu-open {
  background: var(--elevation-0);
  color: var(--primary);
  box-shadow: 0 0 0 2px var(--elevation-0);
}

.button:active:enabled {
  background: var(--elevation-1);
  color: var(--secondary);
  box-shadow: none;
}

.button:disabled {
  color: var(--tertiary);
  cursor: not-allowed;
}

.button:disabled:hover {
  background: transparent;
  box-shadow: none;
}

.button.primary {
  background: var(--brand);
  color: #000;
}

.button.primary:hover:enabled {
  background: var(--brand-hover);
  color: #000;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.input {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 8px;
  outline: 0;
  background: var(--textfield);
  color: var(--primary);
  padding: 12px;
  transition: box-shadow 0.2s cubic-bezier(0, 0, 0.6, 1);
}

.input::placeholder {
  color: var(--secondary);
}

.input:focus {
  box-shadow: 0 0 0 1px var(--brand-dark);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--elevation-1);
  border-radius: 12px;
  background: var(--float-panel);
  padding: 32px;
  text-align: center;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.12);
}

.login-logo {
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.login-logo img,
.brand-mark img {
  display: block;
  border-radius: 8px;
}

.brand-text {
  display: grid;
  place-items: center;
  height: 36px;
  padding: 0 10px;
  font-family: "Instrument Sans", Inter, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  color: #061425;
  background: var(--brand);
  border-radius: 8px;
  white-space: nowrap;
}
.brand-text-lg {
  height: 56px;
  padding: 0 18px;
  font-size: 26px;
  border-radius: 14px;
}

.login-card h1,
.modal-card h2 {
  margin: 0 0 8px;
  font-family: "Instrument Sans", Inter, sans-serif;
  font-size: 24px;
  font-weight: 500;
  line-height: 28px;
  letter-spacing: 0.2px;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--secondary);
}

.field {
  display: block;
  text-align: left;
  margin-bottom: 16px;
}

.field > span,
.eyebrow {
  display: block;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.field > span {
  margin-bottom: 6px;
}

.folder-row {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: var(--textfield);
  padding: 12px;
}

.folder-row input[type="file"] {
  width: 100%;
  color: var(--secondary);
  font-size: 13px;
}

.folder-row input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--elevation-1);
  color: var(--primary);
  padding: 6px 12px;
  cursor: pointer;
}

.login-start {
  width: 100%;
  margin-top: 8px;
}

#app {
  height: 100vh;
}

.main-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

.workspace {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.topbar {
  z-index: 40;
  height: 60px;
  min-height: 60px;
  border-bottom: 1px solid var(--stroke);
  background: var(--surface);
  padding: 8px 12px;
}

.topbar-nav {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  min-width: 44px;
  height: 44px;
  place-items: center;
}

.topbar-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

.topbar-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  white-space: nowrap;
}

.topbar-stat strong {
  min-width: 72px;
  border-radius: 8px;
  background: var(--textfield);
  color: var(--primary);
  padding: 8px;
  text-align: center;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}

.menu-wrap {
  position: relative;
  display: inline-flex;
}

.align-right .dropdown-menu {
  right: 0;
  left: auto;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  display: none;
  width: 220px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--elevation-1);
  border-radius: 12px;
  background: var(--float-panel);
  padding: 4px;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.12);
}

.dropdown-menu.open {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--secondary);
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s cubic-bezier(0, 0, 0.6, 1), background-color 0.2s cubic-bezier(0, 0, 0.6, 1);
}

.list-item:hover:enabled {
  background: var(--elevation-0);
  color: var(--primary);
}

.list-item:disabled {
  color: var(--tertiary);
  cursor: default;
}

.check-mark {
  width: 20px;
  color: var(--brand);
  text-align: center;
}

.player-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  background: var(--textfield);
}

.player-wrapper {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  outline: none;
  background: #000;
}

#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  transform-origin: 50% 50%;
  transition: transform 0.12s linear;
}

.player-wrapper.zoom-active {
  cursor: grab;
}

.player-wrapper.zoom-active:active {
  cursor: grabbing;
}

.bottom-controls {
  display: flex;
  height: 60px;
  min-height: 60px;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--stroke);
  background: var(--surface);
  padding: 16px 12px;
}

.control-button,
.speed-pill {
  display: inline-flex;
  height: 28px;
  min-width: 48px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: var(--elevation-1);
  color: var(--primary);
  cursor: pointer;
}

.control-button:hover,
.speed-pill:hover {
  background: var(--elevation-2);
}

.control-button svg {
  fill: currentColor;
  stroke: currentColor;
}

.control-button.icon-only {
  padding: 0 12px;
}

.time-readout {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0 4px;
}

.timeline {
  position: relative;
  flex: 1 1 auto;
  height: 28px;
  min-width: 40px;
  border-radius: 8px;
  background: var(--elevation-1);
  cursor: pointer;
}

.timeline-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  pointer-events: none;
}

/* Saved-marker segments (read-only, all issues of the current video) */
.timeline-saved {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.timeline-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.85;
}
.timeline-seg:hover { opacity: 1; outline: 1px solid rgba(255,255,255,0.5); }
.timeline-seg.seg-low  { background: rgba(255, 187, 51, 0.45); border: 1px solid var(--low); }
.timeline-seg.seg-mid  { background: rgba(255, 116, 51, 0.45); border: 1px solid var(--mid); }
.timeline-seg.seg-high { background: rgba(223, 0, 0, 0.40);   border: 1px solid var(--high); }

/* Edge grips to adjust a saved segment directly on the timeline */
.seg-handle {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 10px;
  cursor: ew-resize;
  z-index: 3;
}
.seg-handle::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 3px;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 2px;
  opacity: 0.85;
}
.seg-handle-start { left: -5px; }
.seg-handle-end   { right: -5px; }
.timeline-seg:hover .seg-handle::after { opacity: 1; }
.seg-time {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
}

.timeline-range {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: rgba(110, 180, 255, 0.18);
  border-left: 2px solid #6FB8FF;
  border-right: 2px solid #6FB8FF;
  pointer-events: none;
  z-index: 2;
}

.range-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 12px;
  background: #6FB8FF;
  cursor: ew-resize;
  pointer-events: auto;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.range-handle::after {
  content: '';
  width: 2px;
  height: 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 1px;
}
.range-handle-start { left: -6px; }
.range-handle-end   { right: -6px; }
.range-handle:hover { background: #8FCAFF; }

.speed-pill {
  width: 48px;
  color: var(--secondary);
  font-weight: 450;
}

.sidebar {
  z-index: 20;
  display: flex;
  width: 324px;
  min-width: 280px;
  max-width: 324px;
  height: 100vh;
  flex-direction: column;
  border-left: 1px solid var(--stroke);
  background: var(--surface);
}

.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
}

.sidebar.collapsed .sidebar-body,
.sidebar.collapsed .sidebar-actions:first-child {
  display: none;
}

.sidebar.collapsed .sidebar-head {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .sidebar-actions:last-child .menu-wrap {
  display: none;
}

.sidebar.zoom-mode .sidebar-head,
.sidebar.zoom-mode .sidebar-body {
  display: none;
}

.sidebar.zoom-mode .zoom-panel {
  display: flex !important;
}

.sidebar-head {
  display: flex;
  height: 60px;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--stroke);
  padding: 12px 16px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.sidebar-body {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 12px;
}

.current-card {
  border: 1px solid var(--elevation-1);
  border-radius: 8px;
  background: var(--elevation-0);
  padding: 12px;
}
.current-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.back-current-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #6FB8FF;
  background: rgba(111, 184, 255, 0.10);
  color: #6FB8FF;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.back-current-btn:hover { background: rgba(111, 184, 255, 0.18); }
.back-current-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }

.current-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 6px;
  color: var(--primary);
  font-weight: 500;
}

.current-path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
  color: var(--secondary);
  font-size: 13px;
}

.rating-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rate-btn {
  display: grid;
  width: 100%;
  height: 40px;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: var(--elevation-0);
  color: var(--primary);
  padding: 0 16px 0 8px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s cubic-bezier(0, 0, 0.6, 1);
}

.rate-btn:hover:enabled {
  background: var(--elevation-1);
}

.rate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rate-label {
  font-weight: 450;
}

.rate-hk {
  color: var(--secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.level-icon {
  display: grid;
  gap: 3px;
  width: 20px;
}

.level-icon i {
  display: block;
  width: 12px;
  height: 2px;
  margin: 0 auto;
  border-radius: 999px;
  background: var(--tertiary);
}

.level-low i:nth-child(3) { background: var(--low); }
.level-mid i:nth-child(n+2) { background: var(--mid); }
.level-high i { background: var(--high); }

.ok-icon {
  color: var(--ok);
  text-align: center;
  font-weight: 700;
}

.rate-create { border: 1px solid var(--brand); }
.rate-create .create-icon { color: var(--brand); text-align: center; font-weight: 700; font-size: 18px; }
.rate-btn.marking {
  outline: 2px solid #6FB8FF;
  outline-offset: -2px;
  background: var(--elevation-1);
}

.record-list-wrap {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
}

.record-list {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 4px;
}

/* ---- Grouped recent scores (one card per video, issues nested) ---- */
.record-group {
  border-radius: 8px;
  background: var(--elevation-0);
  overflow: hidden;
}
.record-vid {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.record-vid:hover { background: var(--elevation-1); border-color: var(--stroke); }
.record-vid:focus-visible { outline: none; border-color: var(--brand); }
.rv-name {
  flex: 1 1 auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  direction: rtl; text-align: left;        /* keep the ID-bearing TAIL visible */
  color: var(--primary); font-size: 13px;
}
.rv-count { flex: 0 0 auto; color: var(--tertiary); font-size: 12px; }

.record-item {
  display: grid;
  grid-template-columns: 24px auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 16px;
  cursor: pointer;
  border-left: 2px solid var(--stroke);
  margin-left: 8px;
}
.record-item:hover { background: var(--elevation-1); }
.record-item:focus-visible { outline: none; background: var(--elevation-1); }
.ri-num { color: var(--tertiary); font-size: 12px; font-weight: 600; }
.ri-extra { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary); font-size: 13px; }
.ri-time { color: var(--secondary); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.record-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
}

.record-score {
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}

.record-score.score-low { color: var(--low); }
.record-score.score-mid { color: var(--mid); }
.record-score.score-high { color: var(--high); }
.record-score.score-none { color: var(--ok); }
.record-score.score-skip { color: var(--ok); }
.record-score.score-defective,
.record-score.score-corrupted { color: var(--danger); }

.record-path {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--secondary);
  font-size: 12px;
}
.record-num {
  color: var(--tertiary);
  font-weight: 600;
  font-size: 12px;
}
.record-extra {
  color: var(--primary);
  font-weight: 500;
}

.empty-list {
  color: var(--tertiary);
  padding: 12px 4px;
}

.zoom-panel {
  height: 100%;
  min-height: 0;
  flex-direction: column;
  background: var(--surface);
}

.zoom-back {
  width: 100%;
  height: 36px;
  justify-content: flex-start;
  border-bottom: 1px solid var(--stroke);
  border-radius: 0;
  padding: 0 16px;
}

.zoom-back:hover:enabled {
  box-shadow: none;
}

.zoom-settings {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  padding: 18px 16px;
}

.zoom-field {
  display: grid;
  gap: 8px;
}

.zoom-field > span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.zoom-field .input {
  height: 44px;
  background: #101010;
}

.zoom-position-map {
  position: relative;
  height: 134px;
  overflow: hidden;
  border: 0;
  background: #000;
  cursor: crosshair;
}

.zoom-position-map::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 20px 20px;
}

.zoom-position-map:focus {
  outline: 1px solid var(--brand);
  outline-offset: 2px;
}

.zoom-position-frame {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--brand);
  background: rgba(51, 187, 255, 0.04);
  transform: translate(0, 0);
}

.zoom-reset {
  width: 100%;
  height: 64px;
  border-top: 1px solid var(--stroke);
  border-radius: 0;
  color: var(--secondary);
}

.zoom-reset:hover:enabled {
  box-shadow: none;
}

.toast {
  position: fixed;
  right: 344px;
  bottom: 84px;
  z-index: 100;
  max-width: min(520px, 80vw);
  border: 1px solid var(--elevation-2);
  border-radius: 8px;
  background: var(--float-panel);
  color: var(--primary);
  padding: 10px 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.toast.show { opacity: 1; }
.toast.error { border-color: var(--danger); color: #ffdca0; }

.overlay,
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.68);
  padding: 24px;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(680px, 90vh);
  overflow-y: auto;
  border: 1px solid var(--elevation-1);
  border-radius: 12px;
  background: var(--float-panel);
  padding: 24px;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.modal-body {
  color: var(--secondary);
  padding-right: 20px;
}

.modal-body p {
  margin: 0 0 12px;
}

.modal-body ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.modal-body li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-radius: 8px;
  background: var(--elevation-0);
  padding: 8px 10px;
}

.modal-body kbd {
  border-radius: 6px;
  background: var(--textfield);
  color: var(--primary);
  padding: 2px 7px;
  font-family: Inter, sans-serif;
  font-size: 12px;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(138, 138, 138, 0.58);
}

/* ============ EXTRAS PANEL ============ */
.extras-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--elevation-0);
  overflow: hidden;
  flex: 0 0 auto;
}

/* While the extra-option picker is open, free up the whole sidebar for the
   full list (hide Recent scores) and allow the body to scroll if a short
   screen can't fit every option. */
.extras-panel:not(.hidden) ~ .record-list-wrap {
  display: none;
}
.sidebar-body:has(.extras-panel:not(.hidden)) {
  overflow-y: auto;
}

.extras-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(110, 180, 255, 0.06);
  border-bottom: 1px solid var(--stroke);
}

.extras-input {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--primary);
  font: inherit;
  caret-color: var(--brand);
}
.extras-input::placeholder { color: var(--secondary); }

.extras-chevron {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  stroke: var(--secondary);
  stroke-width: 2;
  fill: none;
}

.extras-list {
  list-style: none;
  margin: 0;
  padding: 4px;
}

.extras-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
}
.extras-item:hover,
.extras-item.active {
  background: var(--elevation-1);
}
.extras-empty {
  padding: 12px;
  color: var(--tertiary);
  text-align: center;
  font-size: 13px;
}

/* ============ MARKER CARD (in sidebar) ============ */
.marker-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--elevation-0);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  min-height: 0;
}
.marker-card.marker-complete {
  flex: 1 1 auto; /* let the issue-name list fill the freed sidebar space */
}

.marker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.marker-close {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
}
.marker-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.marker-close:hover { background: var(--elevation-1); color: var(--primary); }

.marker-times {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.marker-time {
  width: 78px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: #6FDCF5;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 14px;
  text-align: center;
  cursor: text;
}
.marker-time:hover { border-color: rgba(111, 184, 255, 0.4); }
.marker-time:focus {
  outline: none;
  border-color: #6FB8FF;
  background: rgba(111, 184, 255, 0.12);
}
.marker-arrow { color: var(--secondary); }
.marker-dur {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}
.marker-dur svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.6; fill: none; }

.marker-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.marker-score-pill {
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
}
.marker-score-pill.score-low { color: var(--low); }
.marker-score-pill.score-mid { color: var(--mid); }
.marker-score-pill.score-high { color: var(--high); }
.marker-hint {
  color: #FF9933;
  font-size: 12px;
  font-weight: 500;
}

/* Score selector inside the marker card (edit/confirm state) */
.marker-score-select {
  display: none;
  gap: 6px;
}
.marker-card.marker-complete .marker-score-select { display: flex; }
.ms-pill {
  flex: 1 1 0;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  background: var(--elevation-0);
  color: var(--secondary);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.ms-pill:hover { background: var(--elevation-1); }
.ms-pill.active { color: #fff; }
.ms-pill.ms-low.active  { border-color: var(--low);  background: rgba(255,187,51,0.18); color: var(--low); }
.ms-pill.ms-mid.active  { border-color: var(--mid);  background: rgba(255,116,51,0.18); color: var(--mid); }
.ms-pill.ms-high.active { border-color: var(--high); background: rgba(223,0,0,0.20);   color: var(--high); }
.ms-pill.ms-skip { color: var(--ok); border-color: rgba(30,181,0,0.4); }
.ms-pill.ms-skip:hover { background: rgba(30,181,0,0.14); }

.marker-extras {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.marker-extras .extras-header {
  border-bottom: 1px solid var(--stroke);
  border-radius: 0;
}
.marker-extras .extras-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Active rating button while a marker is being placed */
.rate-btn.marking {
  outline: 2px solid #6FB8FF;
  outline-offset: -2px;
  background: var(--elevation-1);
}

/* While picking the issue name, free up the sidebar for the full list:
   hide the rating buttons and Recent scores. */
.sidebar.flow-extras .rating-stack,
.sidebar.flow-extras .record-list-wrap {
  display: none;
}

@media (max-width: 1100px) {
  .topbar-nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .topbar-nav::-webkit-scrollbar {
    display: none;
  }

  .topbar-spacer {
    min-width: 20px;
  }
}

@media (max-width: 800px) {
  html,
  body,
  #app,
  .main-shell {
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

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

  .topbar {
    position: sticky;
    top: 0;
  }

  .player-panel {
    min-height: calc(100vh - 60px - 188px);
  }

  .player-wrapper {
    min-height: 52vh;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 188px;
    border-top: 1px solid var(--stroke);
    border-left: 0;
  }

  .sidebar-head,
  .current-card,
  .record-list-wrap,
  .zoom-panel {
    display: none;
  }

  .sidebar.zoom-mode .zoom-panel {
    display: flex !important;
    min-height: 240px;
  }

  .sidebar-body {
    padding: 8px;
  }

  .rating-stack {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .rate-btn {
    height: 64px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    justify-items: center;
    padding: 8px 4px;
    text-align: center;
  }

  .rate-hk {
    display: none;
  }

  .bottom-controls {
    gap: 4px;
    padding: 12px 8px;
  }

  .control-button,
  .speed-pill {
    min-width: 36px;
  }

  .toast {
    right: 16px;
    bottom: 100px;
    left: 16px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 24px 20px;
  }

  .topbar-stat span {
    display: none;
  }

  .topbar-stat strong {
    min-width: auto;
  }

  .time-readout {
    display: none;
  }
}
