.photo-puzzle-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding: clamp(10px, 1.5vh, 16px);
  overflow: hidden;
  color: #0f172a;
  background:
    radial-gradient(
      circle at top left,
      rgba(148, 163, 184, 0.18),
      transparent 22%
    ),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.photo-puzzle-app__hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.photo-puzzle-app__hero-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.photo-puzzle-app__hero-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-puzzle-app__back {
  width: fit-content;
  padding-inline: 0;
  color: #334155;
}

.photo-puzzle-app__exit {
  height: 32px;
  padding-inline: 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
}

.photo-puzzle-app__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-puzzle-app__hero-stats {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 12px;
}

.photo-puzzle-app__status-card,
.photo-puzzle-app__gallery-panel,
.photo-puzzle-app__selected-preview,
.photo-puzzle-app__gallery-pager {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.9);
}

.photo-puzzle-app__hero-stats div {
  display: grid;
  gap: 1px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  justify-items: end;
}

.photo-puzzle-app__hero-stat {
  min-width: 0;
  white-space: nowrap;
}

.photo-puzzle-app__hero-stat--photo {
  justify-content: center;
  text-align: center;
}

.photo-puzzle-app__hero-stat span {
  color: #64748b;
  font-size: 10px;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.photo-puzzle-app__status-card span,
.photo-puzzle-app__gallery-heading span,
.photo-puzzle-app__gallery-pager span {
  color: #64748b;
  font-size: 11px;
}

.photo-puzzle-app__hero-stats strong,
.photo-puzzle-app__status-card strong,
.photo-puzzle-app__gallery-heading strong,
.photo-puzzle-app__gallery-pager strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 600;
}

.photo-puzzle-app__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.photo-puzzle-app__body--with-gallery {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
}

.photo-puzzle-app__board-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
}

.photo-puzzle-app__board-panel--play {
  height: 100%;
}

.photo-puzzle-app__category-panel,
.photo-puzzle-app__mobile-photo-panel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.9);
}

.photo-puzzle-app__section-heading {
  display: grid;
  gap: 2px;
}

.photo-puzzle-app__section-heading span {
  color: #64748b;
  font-size: 11px;
}

.photo-puzzle-app__section-heading strong {
  color: #0f172a;
  font-size: 14px;
}

.photo-puzzle-app__mobile-selection-bar {
  display: grid;
  grid-template-columns: auto 44px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.photo-puzzle-app__mobile-back {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  color: #334155;
}

.photo-puzzle-app__mobile-selection-thumb {
  width: 44px;
  height: 56px;
  display: block;
  object-fit: cover;
  object-position: center top;
  background: #e2e8f0;
}

.photo-puzzle-app__mobile-selection-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.photo-puzzle-app__mobile-selection-actions {
  justify-content: stretch;
  align-items: center;
}

.photo-puzzle-app__mobile-selection-actions .ant-btn,
.photo-puzzle-app__gallery-pager-actions .ant-btn {
  height: 30px;
  padding-inline: 10px;
  border-radius: 999px;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  font-size: 12px;
  font-weight: 500;
  box-shadow: none;
}

.photo-puzzle-app__gallery-pager-count {
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-puzzle-app__control-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.photo-puzzle-app__level-group,
.photo-puzzle-app__category-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.photo-puzzle-app__chip {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.78);
  color: #334155;
  min-height: 34px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.photo-puzzle-app__chip--small {
  min-height: 30px;
  padding-inline: 10px;
  font-size: 11px;
}

.photo-puzzle-app__chip--active {
  border-color: #1d4ed8;
  background: #dbeafe;
  color: #1d4ed8;
}

.photo-puzzle-app__toolbar-actions {
  display: flex;
  gap: 6px;
}

.photo-puzzle-app__toolbar-actions .ant-btn {
  white-space: nowrap;
}

.photo-puzzle-app__status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo-puzzle-app__status-row--mobile {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-puzzle-app__status-card {
  display: grid;
  gap: 6px;
  min-height: 0;
  padding: 10px 12px;
}

.photo-puzzle-app__mobile-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 2px 0 0;
}

.photo-puzzle-app__mobile-progress-copy {
  display: grid;
  gap: 1px;
}

.photo-puzzle-app__mobile-progress-copy span {
  color: #64748b;
  font-size: 10px;
  line-height: 1.1;
}

.photo-puzzle-app__mobile-progress-copy strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.photo-puzzle-app__board-stage {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 0;
  overflow: hidden;
}

.photo-puzzle-app__board-frame {
  width: min(100%, calc(100dvh * var(--photo-puzzle-board-scale, 0.9)));
  max-width: min(100%, 740px);
  max-height: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}

.photo-puzzle-app__board {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  gap: 1px;
  padding: 1px;
  background: #cbd5e1;
  min-height: 0;
}

.photo-puzzle-app__tile {
  position: relative;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background-color: #e2e8f0;
  background-repeat: no-repeat;
  cursor: pointer;
  transition:
    filter 120ms ease,
    transform 120ms ease;
}

.photo-puzzle-app__tile:hover {
  filter: brightness(1.05);
  transform: translateZ(0);
}

.photo-puzzle-app__tile--blank {
  background:
    linear-gradient(135deg, rgba(203, 213, 225, 0.9), rgba(226, 232, 240, 0.7)),
    #e2e8f0;
  cursor: default;
}

.photo-puzzle-app__tile--blank:hover {
  filter: none;
}

.photo-puzzle-app__success {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  background: rgba(248, 250, 252, 0.94);
  color: #0f172a;
}

.photo-puzzle-app__success .anticon {
  font-size: 40px;
  color: #1d4ed8;
}

.photo-puzzle-app__gallery-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

.photo-puzzle-app__gallery-top,
.photo-puzzle-app__gallery-heading,
.photo-puzzle-app__selected-preview-copy,
.photo-puzzle-app__thumb-meta,
.photo-puzzle-app__gallery-pager div:first-child {
  display: grid;
  gap: 6px;
}

.photo-puzzle-app__selected-preview {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.photo-puzzle-app__selected-preview--mobile {
  grid-template-columns: minmax(0, 1fr);
}

.photo-puzzle-app__selected-preview img,
.photo-puzzle-app__thumb img {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  background: #e2e8f0;
}

.photo-puzzle-app__selected-preview--mobile img {
  max-height: min(44dvh, 360px);
}

.photo-puzzle-app__selected-preview-copy {
  align-content: center;
  min-width: 0;
  padding: 10px 10px 10px 0;
}

.photo-puzzle-app__selected-preview--mobile
  .photo-puzzle-app__selected-preview-copy {
  padding: 0 10px 10px;
}

.photo-puzzle-app__selected-preview-copy strong {
  font-size: 14px;
  line-height: 1.4;
}

.photo-puzzle-app__selected-preview-copy span {
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.photo-puzzle-app__mobile-play-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.photo-puzzle-app__level-group--mobile {
  justify-content: space-between;
}

.photo-puzzle-app__gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.photo-puzzle-app__thumb {
  display: grid;
  grid-template-rows: auto minmax(34px, auto);
  gap: 6px;
  align-content: start;
  min-height: 0;
  height: 100%;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.photo-puzzle-app__thumb--active {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.photo-puzzle-app__thumb-meta {
  align-content: start;
  min-height: 34px;
}

.photo-puzzle-app__thumb-meta strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: #0f172a;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.photo-puzzle-app__gallery-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 0;
  padding: 8px 10px;
}

.photo-puzzle-app__gallery-pager-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 1200px) {
  .photo-puzzle-app__body--with-gallery {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .photo-puzzle-app__toolbar-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .photo-puzzle-app__hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .photo-puzzle-app__hero-stats,
  .photo-puzzle-app__status-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .photo-puzzle-app__body {
    grid-template-columns: 1fr;
  }

  .photo-puzzle-app__gallery-panel {
    grid-template-rows: auto auto auto auto auto;
  }

  .photo-puzzle-app__selected-preview {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .photo-puzzle-app__gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .photo-puzzle-app__thumb-meta strong {
    -webkit-line-clamp: 1;
  }
}

@media (max-width: 720px) {
  .photo-puzzle-app {
    padding: 8px;
    gap: 8px;
  }

  .photo-puzzle-app__board-panel--play {
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  }

  .photo-puzzle-app__hero {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px;
    align-items: start;
  }

  .photo-puzzle-app__hero-copy {
    display: grid;
    justify-items: start;
    align-content: start;
    gap: 2px;
  }

  .photo-puzzle-app__eyebrow {
    display: none;
  }

  .photo-puzzle-app__back {
    min-width: 30px;
    min-height: 30px;
    font-size: 12px;
  }

  .photo-puzzle-app__back span {
    display: none;
  }

  .photo-puzzle-app__control-strip,
  .photo-puzzle-app__gallery-pager {
    grid-template-columns: 1fr;
    display: grid;
  }

  .photo-puzzle-app__toolbar-actions,
  .photo-puzzle-app__gallery-pager-actions {
    width: 100%;
  }

  .photo-puzzle-app__selected-preview--mobile img {
    max-height: min(42dvh, 320px);
  }

  .photo-puzzle-app__toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-puzzle-app__toolbar-actions .ant-btn,
  .photo-puzzle-app__gallery-pager-actions .ant-btn {
    flex: 1 1 0;
  }

  .photo-puzzle-app__hero-stats {
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .photo-puzzle-app__hero-stat--level {
    order: 1;
  }

  .photo-puzzle-app__hero-stat--photo {
    order: 2;
  }

  .photo-puzzle-app__hero-stat--moves {
    order: 3;
  }

  .photo-puzzle-app__status-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .photo-puzzle-app__hero-stats div {
    min-width: 0;
    flex: 0 1 auto;
    gap: 1px;
    padding: 4px 0;
    justify-items: end;
  }

  .photo-puzzle-app__hero-stats strong {
    font-size: 13px;
    font-weight: 500;
  }

  .photo-puzzle-app__hero-stat span {
    font-size: 9px;
  }

  .photo-puzzle-app__status-card .ant-progress {
    display: none;
  }

  .photo-puzzle-app__mobile-progress {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  .photo-puzzle-app__board-frame {
    width: min(100%, calc(100dvh * var(--photo-puzzle-board-scale, 0.78)));
    max-width: 100%;
  }

  .photo-puzzle-app__gallery-panel {
    gap: 8px;
    padding: 8px;
  }

  .photo-puzzle-app__gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .photo-puzzle-app__category-panel,
  .photo-puzzle-app__mobile-photo-panel {
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .photo-puzzle-app__mobile-photo-panel .photo-puzzle-app__gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .photo-puzzle-app__thumb {
    padding: 2px;
    gap: 0;
    grid-template-rows: auto;
  }

  .photo-puzzle-app__thumb-meta .ant-tag {
    display: none;
  }

  .photo-puzzle-app__thumb-meta strong {
    display: none;
  }

  .photo-puzzle-app__mobile-selection-bar {
    grid-template-columns: auto 40px minmax(0, 1fr);
    align-items: center;
  }

  .photo-puzzle-app__mobile-back {
    width: 30px;
    min-width: 30px;
    height: 30px;
  }

  .photo-puzzle-app__mobile-selection-thumb {
    width: 40px;
    height: 52px;
  }

  .photo-puzzle-app__mobile-selection-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    gap: 4px;
  }

  .photo-puzzle-app__mobile-selection-actions .ant-btn,
  .photo-puzzle-app__gallery-pager-actions .ant-btn {
    width: 100%;
    padding-inline: 0;
    font-size: 10px;
  }

  .photo-puzzle-app__gallery-pager-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    display: grid;
  }

  .photo-puzzle-app__gallery-pager {
    padding: 2px 0 0;
    border: 0;
    background: transparent;
  }

  .photo-puzzle-app__gallery-pager div:first-child {
    gap: 0;
  }

  .photo-puzzle-app__gallery-pager strong {
    font-size: 12px;
    font-weight: 500;
  }

  .photo-puzzle-app__mobile-progress {
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 6px;
    padding-top: 0;
  }

  .photo-puzzle-app__mobile-progress-copy {
    grid-auto-flow: column;
    justify-content: space-between;
    align-items: end;
  }

  .photo-puzzle-app__mobile-progress .ant-tag {
    justify-self: start;
  }

  .photo-puzzle-app__level-group--mobile {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-top: -2px;
  }

  .photo-puzzle-app__level-group--mobile .photo-puzzle-app__chip {
    min-height: 28px;
    padding-inline: 0;
    font-size: 10px;
  }
}
