.room-photo-title-row,
.plan-room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.plan-room-row > strong {
  min-width: 0;
}

/* A real control, not a faint text link. The icon is CSS-owned so all language labels share one target. */
.room-photo-entry {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 44px;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid var(--line, #9cae98);
  border-radius: 999px;
  background: var(--paper, #fcfbf6);
  color: var(--green, #24483f);
  box-shadow: inset 0 0 0 1px var(--line, #9cae98);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.room-photo-entry::before {
  content: "";
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M8.4 5.5 9.7 3.7h4.6l1.3 1.8H19A3 3 0 0 1 22 8.5v8A3 3 0 0 1 19 19.5H5a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3h3.4ZM12 8a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9Zm0 2a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M8.4 5.5 9.7 3.7h4.6l1.3 1.8H19A3 3 0 0 1 22 8.5v8A3 3 0 0 1 19 19.5H5a3 3 0 0 1-3-3v-8a3 3 0 0 1 3-3h3.4ZM12 8a4.5 4.5 0 1 0 0 9 4.5 4.5 0 0 0 0-9Zm0 2a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.room-photo-entry:hover {
  border-color: var(--accent, #2e5a2c);
  background: var(--stone, #dee9d6);
  transform: translateY(-1px);
}

.room-photo-entry:active {
  transform: none;
}

.room-photo-entry:focus-visible {
  outline: 3px solid #2c7f76;
  outline-offset: 3px;
}

.room-photo-entry[aria-busy="true"] {
  opacity: .58;
  cursor: progress;
}

/* Each number and its own thumbnail-backed photo action remain one adjacent picker item. */
.room-chips .room-chip-item {
  display: inline-grid;
  grid-template-columns: 48px minmax(82px, auto);
  align-items: stretch;
  gap: 5px;
  min-width: 0;
}

.room-chips .room-chip-item > button[data-room-choice] {
  width: 48px;
  min-width: 48px;
}

.room-chips .room-chip-photo {
  width: auto;
  min-width: 82px;
  min-height: 48px;
  padding: 5px 8px 5px 5px;
  border-radius: 12px;
  gap: 6px;
  font-size: 11px;
  line-height: 1.15;
  box-shadow: none;
}

.room-chips .room-chip-photo::before {
  display: none;
}

.room-chip-photo img {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--stone, #dee9d6);
}

.room-chip-photo [data-room-photo-label] {
  min-width: 0;
}

/* C09 10-02 (Owner 10-02 after preview 85, via C00: 「直接拉伸铺平到右边…现在没贴住右边，为啥挤在左边，右边留着那么多空白呀」):
   the pairs fill the tab line's width in every language and on every screen. Columns come from the width (a pair is never narrower
   than before: 135 px desktop, 125 px phone); each pair stretches; inside a pair the number and the photo chip keep the old ratio. */
#room-chips.room-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  justify-content: stretch;
}

#room-chips.room-chips .room-chip-item {
  display: grid;
  grid-template-columns: 48fr 82fr;
  width: auto;
}

#room-chips.room-chips .room-chip-item > button[data-room-choice],
#room-chips.room-chips .room-chip-photo {
  width: auto;
  min-width: 0;
  max-width: none;
}

.pswp__room-caption {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(92vw, 760px);
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font: 500 14px/1.45 'Source Sans 3', 'WF Sans SC', 'Plus Jakarta Sans', sans-serif;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
  pointer-events: none;
}

@media (max-width: 760px) {
  .room-photo-title-row,
  .plan-room-row {
    gap: 12px;
  }

  .room-photo-entry {
    min-width: 44px;
    min-height: 44px;
    padding: 9px 12px;
  }

  .room-chips .room-chip-item {
    grid-template-columns: 44px minmax(76px, auto);
  }

  .room-chips .room-chip-item > button[data-room-choice] {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .room-chips .room-chip-photo {
    min-width: 76px;
    min-height: 44px;
    padding: 4px 7px 4px 4px;
  }

  /* C09 10-02 (Owner 10-01 via C00: 「中文版一行三组…英文版照中文的排法，一行三组，标签用短词」; 10-02: 中文靠着边，其它语言没贴住):
     every other language uses exactly the Chinese chip width, so rows break where Chinese breaks; Chinese itself is untouched. */
  html:not(:lang(zh)) .room-chips .room-chip-photo {
    width: 76px;
    max-width: 76px;
    padding: 3px;
    gap: 4px;
  }

  html:not(:lang(zh)) .room-chips .room-chip-photo [data-room-photo-label] {
    font-size: 12px; /* Owner 10-02: 「Photo和实拍的字有点小，看不清」: 10 -> 12 px */ /* the label slot is 34 px (76 - border 2 - padding 8 - thumb 28 - gap 4); "Photos" is 34.7 px at 11 px, 31.5 px at 10 px (C09 10-02, measured) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* C09 10-02: phone pairs fill the row too (see the rule above); old phone ratio 44:76, never narrower than 125 px. */
  #room-chips.room-chips {
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  }

  #room-chips.room-chips .room-chip-item {
    grid-template-columns: 44fr 76fr;
  }

  #room-chips.room-chips .room-chip-item > button[data-room-choice],
  #room-chips.room-chips .room-chip-photo,
  html:not(:lang(zh)) #room-chips.room-chips .room-chip-photo {
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .room-chip-photo img {
    width: 24px;
    height: 24px;
    flex: 0 0 24px; /* the base rule's flex basis is 28 px */
  }

  .room-chips .room-chip-photo [data-room-photo-label] {
    font-size: 13px; /* Chinese 11 -> 13 px; the non-Chinese rule above sets 12 px */
    line-height: 1.15;
  }

  .pswp__room-caption {
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
    padding: 9px 12px;
    font-size: 13px;
  }
}

/* Desktop only: the "Real photos" button under the 3D room model reads a size larger (Owner 10-03: 「主要就是3d房间模型下面的 Real photos / 实拍 看着一点小」).
   The room-number "Photos" chips, the booking-step button and phones stay as they are. */
@media (min-width: 761px) {
  #selected-room-photos {
    min-height: 52px;
    padding: 12px 20px;
    gap: 10px;
    font-size: 16px;
  }
  #selected-room-photos::before {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
  }
}
