/* Biblioteca, búsqueda y ciudad. El carrusel y sus portadas comparten el motor existente. */
.header .brand-group {
  grid-column: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}
.header .brand-group .brand { flex: 0 1 154px; min-width: 0; }
.city-control { position: relative; flex: none; }
#cityToggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 9px;
  color: #e7e7e9;
  background: transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}
#cityToggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
#cityToggle:hover, #cityToggle[aria-expanded="true"] { background: #ffffff12; }
#cityToggle .city-chevron { width: 12px; }
.city-panel {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 125;
  width: min(206px, calc(100vw - 28px));
  padding: 13px;
  border: 1px solid #3b3b42;
  border-radius: 10px;
  background: #202125;
  color: #f3f3f5;
  box-shadow: 0 12px 40px #0009;
}
.city-panel p { margin: 0 0 7px; color: #ceced5; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.city-panel label { display: flex; align-items: center; min-height: 44px; gap: 9px; font-size: 14px; }
.city-panel input { width: 17px; height: 17px; accent-color: #e74b5a; }
.city-panel small { color: #bdbdc7; font-size: 12px; }
.header .search-wrap.open {
  position: fixed;
  top: calc(var(--header) + env(safe-area-inset-top, 0px) + 8px);
  left: auto;
  right: max(14px, env(safe-area-inset-right, 0px));
  z-index: 126;
  width: min(550px, calc(100vw - 28px));
  height: 46px;
  padding: 0 5px 0 13px;
  background: #1b1c20;
  border: 1px solid #54545e;
  border-radius: 9px 9px 0 0;
  box-shadow: 0 12px 40px #0008;
  transition: none;
  transform: none;
}
.header .search-wrap input { height: 44px; font-size: 16px; }
.header .search-wrap .icon-button { height: 44px; width: 44px; flex-basis: 44px; }
.universal-results {
  position: fixed;
  right: max(14px, env(safe-area-inset-right, 0px));
  top: calc(var(--header) + env(safe-area-inset-top, 0px) + 54px);
  z-index: 125;
  width: min(550px, calc(100vw - 28px));
  max-height: min(470px, calc(var(--visual-height, 100dvh) - var(--header) - 72px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px 9px 10px;
  border: 1px solid #54545e;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: #1b1c20;
  box-shadow: 0 18px 46px #000a;
}
.universal-results h2 { margin: 8px 8px 4px; color: #bfc0ca; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.universal-results ul { list-style: none; padding: 0; margin: 0 0 9px; }
.universal-result { display: flex; align-items: stretch; gap: 4px; }
.universal-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  min-height: 53px;
  padding: 7px 9px;
  color: #f4f3f6;
  background: none;
  border-radius: 7px;
  text-align: left;
}
.universal-main:hover,.universal-main:focus-visible,.universal-copy:hover { background: #ffffff11; }
.universal-main strong { grid-row: 1; font-size: 14px; overflow-wrap: anywhere; }
.universal-main small { grid-row: 2; color: #c2c2cb; font-size: 11px; }
.universal-action { grid-column: 2; grid-row: 1 / 3; font-size: 11px; color: #d0d0d9; }
.universal-copy { width: 44px; min-height: 44px; flex: none; background: none; color: #e6e5ea; border-radius: 6px; font-size: 21px; }
.universal-empty { margin: 11px 8px; color: #dedee6; font-size: 13px; }

.row-actions { position: relative; height: 25px; z-index: 93; }
.row-actions summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 34px;
  margin-top: -4px;
  border-radius: 7px;
  color: #c4c4cc;
  font-size: 20px;
  list-style: none;
  cursor: pointer;
}
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions summary:hover,.row-actions[open] summary { background: #ffffff12; color: white; }
.row-actions > div {
  position: absolute;
  top: 31px;
  right: 0;
  min-width: 177px;
  max-width: min(230px,calc(100vw - 24px));
  padding: 5px;
  border: 1px solid #3e3e46;
  border-radius: 9px;
  background: #212226;
  box-shadow: 0 12px 25px #0009;
}
.row-actions button { display: block; width: 100%; min-height: 44px; text-align: left; color: #eee; background: transparent; padding: 8px 10px; border-radius: 5px; }
.row-actions button:hover { background: #ffffff14; }
.row-title-button { color: inherit; background: none; padding: 0; font: inherit; text-align: left; }
.row-empty { margin: 24px var(--gutter); padding: clamp(20px, 5vw, 44px); border: 1px solid #303035; border-radius: 12px; background: #1a1a1d; }
.row-empty h2 { margin: 0 0 8px; font-size: 23px; }
.row-empty p { margin: 0 0 15px; color: #c4c4cc; }
.row-empty button { min-height: 44px; margin: 0 8px 8px 0; }
.menu-library { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.menu-library button { min-height: 44px; }
[data-copy-source][data-copied="true"] { color: #99e4b4 !important; }
.card-copy svg { fill: none; }

#dialog.library-dialog {
  position: fixed;
  width: min(960px, calc(100vw - 24px));
  max-height: calc(var(--visual-height, 100dvh) - var(--header) - 22px);
  top: calc(var(--header) + env(safe-area-inset-top, 0px) + 9px);
  bottom: auto;
  margin: 0 auto;
  transform: none;
  overflow: auto;
  overscroll-behavior: contain;
  background: #18191c;
}
#dialog.library-dialog::backdrop { background: linear-gradient(transparent var(--header), #000b var(--header)); backdrop-filter: none; }
.library-intro { margin: 8px 0 17px; color: #d0d0d8; font-size: 14px; line-height: 1.45; }
.library-intro span { display: block; margin-top: 5px; font-size: 12px; color: #b9b9c4; }
.library-status {
  position: sticky;
  top: 0;
  z-index: 9;
  background: #22372b;
  color: #ecfff3;
  margin: 0 0 9px;
  padding: 8px 12px;
  border: 1px solid #52765e;
  border-radius: 7px;
  font-size: 13px;
}
.library-status:empty { display: none; }
.library-status button { min-height: 36px; padding: 3px 7px; color: white; background: #ffffff16; border-radius: 6px; text-decoration: underline; }
.collection-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.collection-toolbar button { min-height: 44px; }
.manage-group h3 { margin: 18px 0 6px; font-size: 15px; }
.manage-group ul { list-style: none; margin: 0; padding: 0; }
.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid #34343b; }
.manage-row strong { display: block; font-size: 14px; }
.manage-row small { color: #c0c0c9; font-size: 12px; }
.manage-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.manage-actions button { min-height: 44px; font-size: 12px; padding: 6px 8px; }
.manage-actions button[data-manage-move] { width: 44px; }
.preferences-backup { margin-top: 20px; }
.preferences-backup summary { cursor: pointer; padding: 10px 0; }
.preferences-backup div { display: flex; flex-wrap: wrap; gap: 9px; }
.preferences-backup input { display: block; max-width: 100%; color: inherit; }
:where(.city-control,.row-actions,.library-dialog,.universal-results) :focus-visible { outline: 2px solid #f0a4ae; outline-offset: 2px; }
@media(max-width:760px) {
  .header .brand-group { gap: 3px; }
  .header .brand-group .brand { flex-basis: auto; }
  #cityToggle { padding-inline: 5px; gap: 3px; font-size: 11px; }
  #cityToggle svg { width: 13px; }
  #cityToggle .city-chevron { display: none; }
  .header-actions .header-search { flex-basis: 44px; width: 44px; }
  .header .header-actions #categoriesButton,.header .header-actions #favoritesButton { flex-basis: 44px; width: 44px; }
  .shelf-heading { gap: 5px; }
  .row-actions summary { height: 44px; margin-top: -10px; }
  .manage-row { align-items: flex-start; flex-direction: column; }
  .manage-actions { justify-content: flex-start; }
  .universal-action { grid-column: 1; grid-row: 3; }
  .universal-main { grid-template-columns: minmax(0,1fr); }
}

.personal-card--catalog-art.personal-card--with-image .personal-title { display: none; }
.personal-card--catalog-art.personal-card--with-image .personal-link::after { content: none; }

body:has(#dialog.library-dialog[open]) { overflow: hidden; }
