/* Dataset gallery: reuse the paper's type, blue accent, and quiet rounded media. */
.simulation-gallery { margin-top: 48px; scroll-margin-top: 26px; }
.gallery-heading { font-size: 26px; line-height: 1.3; letter-spacing: -.6px; text-align: center; margin: 0 0 16px; }
.gallery-intro { max-width: 730px; }
.task-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.task-card {
  position: relative; isolation: isolate; display: flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 196px; padding: 38px 15px 24px; overflow: hidden;
  border: 1px solid #dce2eb; border-radius: 10px; background: #46505e; color: white;
  text-align: center; cursor: pointer; transform: scale(1);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.task-card::after { content: ""; position: absolute; z-index: -1; inset: 0; background: rgba(22, 31, 46, .46); }
.task-card img { position: absolute; z-index: -2; inset: -8%; width: 116%; height: 116%; object-fit: cover; filter: blur(2px); }
.task-card-number { position: absolute; top: 11px; left: 13px; font-size: 10.5px; font-weight: 600; letter-spacing: .3px; color: #eef3fb; }
.task-card-text { font-size: 14px; line-height: 1.45; font-weight: 600; text-wrap: pretty; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.task-card-open { position: absolute; right: 11px; top: 11px; width: 17px; height: 17px; opacity: .75; }
.task-card-open svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .task-card:hover { z-index: 2; transform: scale(1.045); border-color: #adc7ed; box-shadow: 0 9px 24px rgba(29, 35, 48, .2); }
}
.task-card:focus-visible { z-index: 2; transform: scale(1.025); outline-offset: 3px; }
.task-card[aria-busy="true"] { opacity: .7; }
.gallery-status, .gallery-note { text-align: center; color: var(--muted); font-size: 13px; }
.gallery-status { margin: 12px 0 0; }
.gallery-status:empty { display: none; }
.gallery-note { margin: 22px auto 0; }

.task-gallery-dialog {
  width: calc(100vw - 48px); max-width: 1280px; max-height: calc(100dvh - 40px);
  padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink);
  background: #fff; overflow: auto; overscroll-behavior: contain;
}
.task-gallery-dialog::backdrop { background: rgba(18, 23, 32, .72); backdrop-filter: blur(4px); }
.gallery-dialog-topbar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 57px; padding: 10px 26px; border-bottom: 1px solid var(--line); background: #fff;
}
.gallery-task-position { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.gallery-browse { display: flex; align-items: center; gap: 8px; }
.gallery-icon-button, .gallery-close {
  display: inline-flex; align-items: center; justify-content: center; min-height: 34px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); background: #fff; font-size: 12px; cursor: pointer;
}
.gallery-icon-button { width: 34px; }
.gallery-icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.gallery-close { margin-left: 6px; gap: 12px; }
.gallery-close span { font-size: 21px; line-height: 1; }
.gallery-icon-button:hover, .gallery-close:hover { background: var(--wash); }
.gallery-icon-button:disabled { opacity: .35; cursor: default; }
.gallery-dialog-content { padding: 22px 26px 18px; }
.gallery-task-header { text-align: left; }
.gallery-task-header h2 { max-width: 1050px; font-size: 23px; line-height: 1.35; letter-spacing: -.5px; text-align: left; margin: 0 0 7px; }
.gallery-task-header p { color: var(--muted); font-size: 13px; margin: 0; }
.gallery-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; margin: 20px 0 22px; }
.gallery-controls p { font-size: 12px; color: var(--muted); margin: 0; }
.spin-switch { position: relative; display: inline-flex; gap: 9px; align-items: center; cursor: pointer; font-size: 13px; font-weight: 600; user-select: none; }
.spin-switch input { position: absolute; opacity: 0; width: 36px; height: 22px; margin: 0; }
.spin-switch-track { width: 36px; height: 22px; border-radius: 20px; background: #b3bbc7; position: relative; transition: background 150ms; }
.spin-switch-track::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform 150ms; }
.spin-switch input:checked + .spin-switch-track { background: var(--accent); }
.spin-switch input:checked + .spin-switch-track::after { transform: translateX(14px); }
.spin-switch input:focus-visible + .spin-switch-track { outline: 3px solid var(--accent); outline-offset: 4px; }
.gallery-scene-group + .gallery-scene-group { margin-top: 23px; }
.gallery-row-heading { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.gallery-row-heading h3 { font-size: 15px; letter-spacing: -.15px; margin: 0; }
.gallery-row-heading > span { font-size: 11.5px; color: var(--muted); }
.gallery-scenes { display: grid; gap: 12px; }
.training-scenes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.evaluation-scenes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gallery-scene { min-width: 0; margin: 0; }
.gallery-scene-player {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden; aspect-ratio: 16/9;
  border: 1px solid #e2e6ed; border-radius: 8px; background: var(--wash); cursor: pointer;
}
.gallery-scene-player video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; background: #f6f7f9; opacity: 0; pointer-events: none; }
.gallery-scene-player video.is-active { opacity: 1; }
.gallery-scene-state {
  position: absolute; bottom: 7px; left: 7px; max-width: calc(100% - 14px); padding: 3px 7px;
  border-radius: 4px; background: rgba(29, 35, 48, .77); color: #fff; font-size: 10px; line-height: 1.4;
  pointer-events: none; opacity: 0; transition: opacity 150ms;
}
.gallery-scene-player:hover .gallery-scene-state, .gallery-scene-player:focus-visible .gallery-scene-state,
.gallery-scene.is-loading .gallery-scene-state, .gallery-scene.has-error .gallery-scene-state { opacity: 1; }
.gallery-scene-caption { text-align: center; font-size: 11.5px; margin-top: 6px; color: var(--muted); }
.gallery-modal-note { margin: 18px 0 0; color: var(--muted); font-size: 11.5px; }

@media (max-width: 1000px) {
  .task-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-card { min-height: 182px; }
  .gallery-dialog-content { padding: 20px; }
  .gallery-dialog-topbar { padding: 10px 20px; }
  .evaluation-scenes { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(210px, 30%); overflow-x: auto; scroll-snap-type: x proximity; padding: 5px 3px 10px; margin: -5px -3px -10px; }
  .gallery-scene { scroll-snap-align: start; }
}
@media (max-width: 620px) {
  .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .task-card { min-height: 207px; padding: 33px 12px 19px; }
  .task-card-text { font-size: 13px; line-height: 1.4; }
  .task-card-number { font-size: 10px; left: 10px; }
  .task-gallery-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 10px; }
  .gallery-dialog-topbar { padding: 9px 14px; }
  .gallery-dialog-content { padding: 18px 14px; }
  .gallery-task-header h2 { font-size: 20px; }
  .gallery-controls { gap: 9px; margin: 18px 0 22px; }
  .gallery-controls p { flex-basis: 100%; }
  .training-scenes, .evaluation-scenes { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 85%; overflow-x: auto; scroll-snap-type: x mandatory; padding: 5px 3px 10px; margin: -5px -3px -10px; }
  .gallery-scene-state { opacity: 1; }
  .gallery-row-heading h3 { font-size: 14px; }
  .gallery-icon-button { width: 36px; min-height: 36px; }
  .gallery-close { min-height: 36px; }
  .nav-links { gap: 10px 15px; }
}
@media (max-width: 350px) {
  .task-card { min-height: 240px; padding-inline: 10px; }
  .task-card-text { font-size: 12.5px; }
  .gallery-task-position { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .task-card:hover, .task-card:focus-visible { transform: none; }
}
