.batch-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 clamp(26px, 5vw, 72px) 24px;
  border: 2px solid var(--trip-accent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--trip-accent) 9%, white);
  padding: 15px 18px;
}

.recent-batch-download {
  --trip-accent: var(--accent);
  margin: 20px 0 0;
}

[data-toggle-selection].is-active {
  border-color: var(--trip-accent);
  background: color-mix(in srgb, var(--trip-accent) 12%, white);
  color: color-mix(in srgb, var(--trip-accent) 76%, black);
}

.album-toolbar__views {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.group-view-toggle {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 7px 11px;
  cursor: pointer;
}

.group-view-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.group-view-toggle__switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #b8b5ae;
  transition: background 160ms ease;
}

.group-view-toggle__switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 7px rgba(40, 40, 36, 0.22);
  transition: transform 160ms ease;
}

.group-view-toggle input:checked + .group-view-toggle__switch {
  background: var(--trip-accent);
}

.group-view-toggle input:checked + .group-view-toggle__switch i {
  transform: translateX(18px);
}

.group-view-toggle input:focus-visible + .group-view-toggle__switch {
  outline: 3px solid color-mix(in srgb, var(--trip-accent) 35%, transparent);
  outline-offset: 3px;
}

.group-view-toggle strong,
.group-view-toggle small {
  display: block;
  white-space: nowrap;
}

.group-view-toggle strong {
  font-size: 11px;
}

.group-view-toggle small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
}

.photo-jump-nav {
  position: sticky;
  z-index: 18;
  top: 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 22px clamp(26px, 5vw, 72px) 0;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 249, 0.94);
  padding: 9px;
  box-shadow: 0 10px 28px rgba(48, 44, 37, 0.1);
  scrollbar-width: thin;
  backdrop-filter: blur(14px);
}

.photo-jump-nav[hidden] {
  display: none;
}

.photo-jump-nav button {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  padding: 7px 12px;
  cursor: pointer;
}

.photo-jump-nav button:hover,
.photo-jump-nav button:focus-visible {
  border-color: var(--trip-accent);
  background: color-mix(in srgb, var(--trip-accent) 10%, white);
}

.photo-jump-nav button > span:first-child {
  font-size: 20px;
}

.photo-jump-nav button strong,
.photo-jump-nav button small {
  display: block;
  text-align: left;
}

.photo-jump-nav button strong {
  font-size: 11px;
}

.photo-jump-nav button small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 8px;
}

.photo-grid--grouped {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: 1fr;
  grid-auto-rows: auto;
  gap: 24px;
}

.photo-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(49, 45, 38, 0.07);
  scroll-margin-top: 92px;
}

.photo-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--trip-accent) 7%, white);
  padding: 17px 20px;
}

.photo-section__title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.photo-section__icon {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: white;
  font-size: 25px;
  box-shadow: 0 5px 16px rgba(46, 43, 37, 0.1);
}

.photo-section__title h2,
.photo-section__title p {
  margin: 0;
}

.photo-section__title h2 {
  font-family: "Noto Serif TC", "PMingLiU", serif;
  font-size: 22px;
}

.photo-section__title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.photo-section__collapse {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 8px 13px;
  cursor: pointer;
  font-weight: 800;
}

.photo-section__body {
  padding: 14px;
}

.photo-section__body[hidden] {
  display: none;
}

.photo-section__grid {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 220px;
  gap: 12px;
}

.photo-section__empty {
  display: grid;
  min-height: 150px;
  grid-column: 1 / -1;
  place-items: center;
  border: 1.5px dashed #b8b3a9;
  border-radius: 15px;
  background: var(--paper);
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.photo-section__more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  border-radius: 13px;
  background: var(--paper);
  padding: 10px 12px;
}

.photo-section__more span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.photo-section__more button {
  min-height: 44px;
}

.batch-download-bar[hidden] {
  display: none;
}

.batch-download-bar__status,
.batch-download-bar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.batch-download-bar__icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--trip-accent);
  color: white;
  font-size: 20px;
}

.batch-download-bar__status strong,
.batch-download-bar__status small {
  display: block;
}

.batch-download-bar__status small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.photo-tile {
  cursor: default;
}

.photo-tile__open {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.photo-tile__open:focus-visible {
  outline: 4px solid white;
  outline-offset: -7px;
}

.photo-tile.is-selection-mode .photo-tile__open {
  cursor: pointer;
}

.photo-tile.is-selection-mode .photo-tile__label {
  opacity: 1;
  transform: translateY(0);
}

.photo-tile__select {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  background: rgba(24, 26, 24, 0.72);
  color: white;
  font-size: 18px;
  font-weight: 900;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.photo-tile.is-selected {
  box-shadow: 0 0 0 4px var(--trip-accent), 0 8px 24px color-mix(in srgb, var(--trip-accent) 28%, transparent);
}

.photo-tile.is-selected .photo-tile__select {
  border-color: white;
  background: var(--trip-accent);
}

.photo-tile.is-selection-mode .photo-tile__stop {
  top: 60px;
}

.photo-tile .photo-tile__video {
  top: 12px;
  right: 12px;
}

.photo-tile__label,
.photo-tile__stop,
.photo-tile__video {
  z-index: 2;
  pointer-events: none;
}

.lightbox__download,
.lightbox__rotate {
  position: fixed;
  z-index: 3;
  top: 22px;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  padding: 8px 15px;
  cursor: pointer;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.lightbox__download {
  right: 80px;
}

.lightbox__rotate {
  right: 172px;
}

.lightbox__rotate svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.lightbox__download:hover,
.lightbox__download:focus-visible,
.lightbox__rotate:hover,
.lightbox__rotate:focus-visible {
  background: white;
  color: var(--ink);
}

.background-upload-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  border: 1.5px dashed #aaa69e;
  border-radius: 14px;
  background: var(--paper);
  padding: 13px;
}

.background-upload-panel__icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 24px;
}

.background-upload-panel strong,
.background-upload-panel small {
  display: block;
}

.background-upload-panel strong {
  font-size: 12px;
}

.background-upload-panel small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.background-upload-panel .button {
  white-space: nowrap;
}

.background-upload-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.background-upload-status.is-warning {
  color: #9a5b1e;
  font-weight: 800;
}

.background-upload-status.is-success {
  color: #35634f;
  font-weight: 800;
}

.dialog--crop {
  width: min(1160px, calc(100vw - 32px));
  overflow: hidden;
}

.dialog--crop form {
  display: grid;
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.dialog--crop .dialog__body {
  overflow: auto;
}

.crop-editor {
  display: grid;
  gap: 20px;
}

.crop-source-info {
  border-radius: 13px;
  background: #eef1ed;
  color: #42544b;
  padding: 12px 15px;
  font-size: 11px;
  font-weight: 700;
}

.crop-source-info.is-warning {
  background: #fff1da;
  color: #8a561d;
}

.crop-editor__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  align-items: start;
  gap: 22px;
}

.crop-version {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  padding: 15px;
}

.crop-version__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crop-version__heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crop-version__heading > div > span {
  color: var(--accent-dark);
  font-size: 23px;
}

.crop-version__heading h3 {
  margin: 0;
  font-size: 15px;
}

.crop-version__heading small {
  color: var(--muted);
  font-size: 9px;
}

.crop-version canvas {
  display: block;
  width: 100%;
  border: 4px solid white;
  border-radius: 13px;
  background: #d7d2ca;
  box-shadow: 0 8px 24px rgba(42, 42, 37, 0.12);
}

#mobileCropCanvas {
  width: min(100%, 270px);
  justify-self: center;
}

.crop-controls {
  display: grid;
  gap: 9px;
}

.crop-controls label {
  display: grid;
  grid-template-columns: 105px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 800;
}

.crop-controls label > span {
  display: flex;
  justify-content: space-between;
  gap: 5px;
}

.crop-controls output {
  color: var(--accent-dark);
}

.crop-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.crop-editor__privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border-radius: 12px;
  background: #eaf0ec;
  color: #3d594b;
  padding: 11px 14px;
  font-size: 10px;
}

@media (max-width: 960px) {
  .crop-editor__grid {
    grid-template-columns: 1fr;
  }

  #mobileCropCanvas {
    width: min(100%, 360px);
  }
}

@media (max-width: 760px) {
  .album-toolbar__views {
    align-items: stretch;
    flex-direction: column;
  }

  .group-view-toggle {
    justify-content: center;
  }

  .photo-jump-nav {
    top: 104px;
    margin: 18px 17px 0;
  }

  .photo-grid--grouped {
    gap: 17px;
  }

  .photo-section {
    border-radius: 17px;
  }

  .photo-section__header {
    align-items: flex-start;
    padding: 14px;
  }

  .photo-section__icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 22px;
  }

  .photo-section__title h2 {
    font-size: 18px;
  }

  .photo-section__collapse span:last-child {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0 0 0 0);
  }

  .photo-section__collapse {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .photo-section__body {
    padding: 8px;
  }

  .photo-section__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 160px;
    gap: 7px;
  }

  .photo-section__more {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-section__more button {
    width: 100%;
  }

  .album-toolbar__actions [data-toggle-selection] {
    grid-column: 1 / -1;
  }

  .batch-download-bar {
    align-items: stretch;
    flex-direction: column;
    margin: 0 17px 20px;
  }

  .batch-download-bar__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .batch-download-bar__actions [data-download-selected] {
    grid-column: 1 / -1;
  }

  .recent-batch-download {
    margin: 18px 0 0;
  }

  .recent-batch-download .batch-download-bar__actions [data-download-selected-real] {
    grid-column: 1 / -1;
  }

  .background-upload-panel {
    grid-template-columns: auto 1fr;
  }

  .background-upload-panel .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .crop-version__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .crop-controls label {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .lightbox__download {
    right: 76px;
    padding: 8px 12px;
  }

  .lightbox__rotate {
    right: 164px;
    padding: 8px 12px;
  }
}
