/* Etudes gallery: presentation only. All original handlers and data remain in app.js. */
#app:has(> .shelves) {
  width: 100%;
  max-width: 1424px;
  margin-inline: auto;
  padding: clamp(22px, 4vw, 60px) clamp(18px, 4.5vw, 64px) 90px;
  --etudes-hairline: var(--glass-border);
  --etudes-quiet: var(--glass-control);
}
#app:has(> .shelves) > h1 {
  font-weight: 800;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.25;
  letter-spacing: -.035em;
  margin: 10px 0 12px;
}
#app:has(> .shelves) > .row.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
  margin: 28px 0 34px;
  padding: 0;
  border: 0;
}
#app:has(> .shelves) > .row.controls button {
  min-height: 48px;
  padding: 11px 22px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 750;
  transition: box-shadow .2s ease, transform .2s ease, background .2s ease;
}
#app:has(> .shelves) > .row.controls button.primary {
  background: var(--action-fill);
  border-color: var(--action-border);
  color: var(--action-ink);
  box-shadow: var(--action-shadow);
}
#app:has(> .shelves) > .row.controls button:not(.primary) {
  background: transparent;
  border: 1px solid var(--etudes-hairline);
  color: var(--ink);
}
@media (hover:hover) {
  #app:has(> .shelves) > .row.controls button:hover {
    transform: translateY(-2px);
  }
}
#app:has(> .shelves) .shelves {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  grid-template-rows: max-content;
  grid-auto-rows: 1fr;
  gap: 22px;
  align-items: stretch;
  margin-top: 16px;
}
#app:has(> .shelves) .shelves::before {
  content: 'Your Etudes';
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 3px;
}
html[lang="fa"] #app:has(> .shelves) .shelves::before {
  content: 'مجموعه اتودها';
  letter-spacing: 0;
}
#app:has(> .shelves) .shelves > section {
  display: contents;
}
#app:has(> .shelves) .shelves > section > h2 {
  display: none;
}
#app:has(> .shelves) .shelves > section > p {
  grid-column: 1 / -1;
  padding: 14px 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
#app:has(> .shelves) .etude-item {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  position: relative;
  text-align: start;
  min-height: 255px;
  margin: 0;
  padding: 174px 17px 21px;
  overflow: hidden;
  border: 1px solid var(--etudes-hairline);
  border-radius: 22px;
  background-color: var(--panel);
  background-image:
    repeating-linear-gradient(to bottom,
      transparent 0 15px,
      color-mix(in srgb, var(--ink) 19%, transparent) 15px 16px,
      transparent 16px 24px),
    var(--glass-surface);
  background-size: calc(100% - 50px) 66px, cover;
  background-repeat: no-repeat, no-repeat;
  background-position: center 64px, center;
  box-shadow: var(--glass-soft-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
#app:has(> .shelves) .etude-item::before {
  content: '𝄞  ♩  ♫';
  direction: ltr;
  position: absolute;
  left: 35px;
  top: 64px;
  width: calc(100% - 70px);
  font: 37px/1.6 Georgia,serif;
  text-align: center;
  letter-spacing: .1em;
  color: color-mix(in srgb, var(--accent) 65%, var(--ink));
  pointer-events: none;
}
#app:has(> .shelves) .etude-item::after {
  content: '';
  position: absolute;
  inset: 149px 0 0;
  border-top: 1px solid var(--etudes-hairline);
  background: var(--glass-surface);
  pointer-events: none;
}
#app:has(> .shelves) .etude-card:nth-of-type(3n+2) > .etude-item {
  background-color: color-mix(in srgb, var(--accent) 5%, var(--panel));
}
#app:has(> .shelves) .etude-item > strong,
#app:has(> .shelves) .etude-item > small {
  z-index: 1;
  width: 100%;
  text-align: start;
}
#app:has(> .shelves) .etude-item strong {
  font-weight: 760;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
#app:has(> .shelves) .etude-item small {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}
#app:has(> .shelves) .shelves section:nth-child(2) .etude-item::before {
  content: '♬  ♩  ♫';
}
#app:has(> .shelves) .shelves section:nth-child(2) .etude-item {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--etudes-hairline));
}
@media (hover:hover) {
  #app:has(> .shelves) .etude-item:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb,var(--accent) 45%,var(--line));
    box-shadow: 0 18px 36px color-mix(in srgb,var(--ink) 9%,transparent);
  }
}
@media (min-width: 720px) and (max-width:1199px) {
  #app:has(> .shelves) .shelves {grid-template-columns: repeat(3,minmax(0,1fr));gap:16px;}
}
@media (min-width: 480px) and (max-width:719px) {
  #app:has(> .shelves) .shelves {grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
}
@media (max-width:719px) {
  #app:has(> .shelves) {padding: 24px 15px 115px;}
  #app:has(> .shelves) > h1 {font-size:32px;}
  #app:has(> .shelves) > h1::after {font-size:13px;}
  #app:has(> .shelves) > .row.controls {margin:20px 0 26px;}
  #app:has(> .shelves) > .row.controls button:not(.primary) {margin-inline-end:auto;}
  #app:has(> .shelves) > .row.controls button.primary {
    position: fixed;
    z-index: 8;
    bottom: calc(80px + env(safe-area-inset-bottom));
    inset-inline-end: 16px;
    border-radius: 999px;
    box-shadow: 0 13px 30px color-mix(in srgb,var(--accent) 29%,transparent);
  }
  #app:has(> .shelves) .shelves {gap:14px;}
  #app:has(> .shelves) .etude-item {min-height:215px;padding:150px 13px 16px;border-radius:17px;}
  #app:has(> .shelves) .etude-item::after {inset-block-start:131px;}
  #app:has(> .shelves) .etude-item::before {top:51px;font-size:29px;}
  #app:has(> .shelves) .etude-item {background-position:center 52px;}
}
@media (max-width:479px) {
  #app:has(> .shelves) .shelves {grid-template-columns: 1fr;}
  #app:has(> .shelves) .etude-item {min-height:213px;}
}
@media (prefers-reduced-motion:reduce) {
  #app:has(> .shelves) .etude-item,
  #app:has(> .shelves) > .row.controls button {transition:none;}
}

/* Library UI scaffolding. Display only for the Etudes list, never Studio editor or Practice. */
#etudes-design-controls { display: none; }
body:has(#app[data-page="studio"] > .shelves) #etudes-design-controls {
  display: block;
  width: 100%;
  max-width: 1424px;
  margin: 0 auto;
  padding: 35px clamp(18px, 4.5vw, 64px) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
html[lang="fa"] #etudes-design-controls [lang="en"],
html[lang="en"] #etudes-design-controls [lang="fa"] { display: none; }
#etudes-design-controls .etudes-design-intro {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
  min-height: 96px;
}
#etudes-design-controls .etudes-design-eyebrow {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}
html[lang="fa"] #etudes-design-controls .etudes-design-eyebrow { letter-spacing: normal; }
#etudes-design-controls h1 {
  margin: 6px 0 3px;
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 830;
  line-height: 1.3;
  letter-spacing: -.04em;
}
#etudes-design-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
#etudes-design-controls .etudes-design-art {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  width: min(34%,310px);
  flex-shrink: 0;
  height: 124px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: 48px/1 Georgia,serif;
  color: color-mix(in srgb, var(--accent) 27%, transparent);
  user-select: none;
}
#etudes-design-controls .etudes-design-art span:nth-child(1) { transform: rotate(-16deg) scale(1.25); }
#etudes-design-controls .etudes-design-art span:nth-child(2) { transform: rotate(13deg) translateY(-12px); }
#etudes-design-controls .etudes-design-art span:nth-child(3) { transform: rotate(-23deg) translateY(14px); }
#etudes-design-controls .etudes-design-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 28px 0 6px;
  padding: 13px;
  border: 1px solid color-mix(in srgb,var(--line) 42%,transparent);
  border-radius: 18px;
  background: color-mix(in srgb,var(--panel) 73%,var(--bg));
}
#etudes-design-controls .etudes-design-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 170px;
  height: 45px;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb,var(--line) 70%,transparent);
  border-radius: 12px;
  color: var(--muted);
  background: var(--glass-surface);
}
#etudes-design-controls .etudes-design-search > span {
  font-size: 25px;
  line-height: 1;
}
#etudes-design-controls .etudes-design-search input {
  min-width: 0;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  cursor: default;
  opacity: 1;
}
#etudes-design-controls .etudes-design-search input:disabled,
#etudes-design-controls select:disabled { opacity: 1; color: var(--muted); }
#etudes-design-controls .etudes-design-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px;
  max-width: 100%;
  border-radius: 13px;
  background: color-mix(in srgb,var(--soft) 62%,transparent);
}
#etudes-design-controls .etudes-design-tabs > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
#etudes-design-controls .etudes-design-tabs > label {
  cursor: pointer;
  padding: 10px 13px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 720;
  color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
#etudes-design-controls .etudes-design-tabs > input:checked + label {
  background: var(--active-fill);
  color: var(--accent);
  box-shadow: 0 1px 5px color-mix(in srgb,var(--ink) 8%,transparent);
}
body:has(#etudes-mine:checked) #app[data-page="studio"] .shelves section:nth-child(2) > .etude-card,
body:has(#etudes-mine:checked) #app[data-page="studio"] .shelves section:nth-child(2) > p,
body:has(#etudes-imported:checked) #app[data-page="studio"] .shelves section:nth-child(1) > .etude-card,
body:has(#etudes-imported:checked) #app[data-page="studio"] .shelves section:nth-child(1) > p {
  display: none;
}
#app[data-page="studio"]:has(> .shelves) > h1 { display: none; }
#app[data-page="studio"]:has(> .shelves) {
  padding-top: 0;
}
#app[data-page="studio"]:has(> .shelves) > .row.controls {
  margin-top: 14px;
}
@media (min-width: 720px) and (max-width:1199px) {
  #etudes-design-controls .etudes-design-toolbar { gap: 9px; }
  #etudes-design-controls .etudes-design-search { flex-basis: 100%; }
}
@media (max-width:719px) {
  body:has(#app[data-page="studio"] > .shelves) #etudes-design-controls {
    padding: 20px 15px 0;
  }
  #etudes-design-controls .etudes-design-intro { min-height: 95px; }
  #etudes-design-controls .etudes-design-art { display: none; }
  #etudes-design-controls h1 { font-size: 34px; }
  #etudes-design-controls .etudes-design-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    margin: 17px 0 0;
  }
  #etudes-design-controls .etudes-design-search {
    width: 100%;
    flex: none;
    min-width: 0;
  }
  #etudes-design-controls .etudes-design-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: space-between;
  }
  #etudes-design-controls .etudes-design-tabs > label {
    padding: 10px 11px;
    flex: 1;
    text-align: center;
  }
}

/* Publication filters are independent of the collection/ownership filter. */
#etudes-design-controls .etudes-design-status > label {
  min-height: 35px;
  padding: 6px 13px;
  border: 1px solid color-mix(in srgb,var(--line) 56%,transparent);
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  opacity: 1;
  cursor: pointer;
  display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;
  box-sizing:border-box;
}
#etudes-design-controls .etudes-design-status {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:12px 0 0;
}
#etudes-design-controls .etudes-design-status > input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
#etudes-design-controls .etudes-design-status > input:checked + label{background:var(--active-fill);color:var(--accent);border-color:var(--accent)}
#etudes-design-controls .etudes-design-status > input:focus-visible + label{outline:2px solid var(--accent);outline-offset:2px}


/* Etudes visual refinements: only the requested page, no JS changes. */
#app[data-page="studio"]:has(> .shelves) .shelves > section:nth-child(2) > p {
  display: none;
}
#app:has(> .shelves) .etude-item strong::after {
  content: ' · 20 Nov 2026';
  display: inline-block;
  margin-inline-start: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
}
html[lang="fa"] #app:has(> .shelves) .etude-item strong::after {
  content: ' · ۲۹ آبان ۱۴۰۵';
}
#app[data-page="studio"]:has(> .shelves) > .row.controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
#app[data-page="studio"]:has(> .shelves) > .row.controls button.primary::after {
  content: '+';
  font-size: 19px;
  font-weight: 550;
  line-height: 1;
}
#app[data-page="studio"]:has(> .shelves) > .row.controls button:not(.primary)::before {
  content: '';
  display: block;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.75%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8z%22%2F%3E%3Cpath%20d%3D%22M14%202v6h6M12%2011v7m-3-3%203%203%203-3%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.75%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8z%22%2F%3E%3Cpath%20d%3D%22M14%202v6h6M12%2011v7m-3-3%203%203%203-3%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
}
@media (min-width: 1100px) {
  body:has(#app[data-page="studio"] > .shelves) { position: relative; }
  body:has(#app[data-page="studio"] > .shelves) #app[data-page="studio"] > .row.controls {
    position: absolute;
    inset-block-start: 181px;
    inset-inline-end: max(clamp(20px, 4.5vw, 64px), calc((100vw - 1424px) / 2 + 64px));
    margin: 0;
    padding: 0;
    gap: 12px;
    z-index: 2;
  }
}

/* Match the Etudes desktop content edges to the shared header gutters. */
@media (min-width: 1100px) {
  body:has(#app[data-page="studio"] > .shelves) {
    --etudes-desktop-gutter: max(
      clamp(20px, 4vw, 64px),
      calc((100vw - 1360px) / 2 + 64px)
    );
  }

  body:has(#app[data-page="studio"] > .shelves) #etudes-design-controls,
  #app[data-page="studio"]:has(> .shelves) {
    width: calc(100% - 2 * var(--etudes-desktop-gutter));
    max-width: 1232px;
    margin-inline: auto;
    padding-inline: 0;
  }

  body:has(#app[data-page="studio"] > .shelves) #app[data-page="studio"] > .row.controls {
    inset-inline-end: var(--etudes-desktop-gutter);
  }
}

/* Keep decorative notes in the open desktop hero space, clear of action buttons. */
@media (min-width: 1100px) {
  #etudes-design-controls .etudes-design-intro {
    position: relative;
  }
  #etudes-design-controls .etudes-design-art {
    position: absolute;
    inset-inline: auto;
    left: 32%;
    top: 4px;
    width: 34%;
    max-width: 400px;
    height: 136px;
    display: block;
    pointer-events: none;
  }
  #etudes-design-controls .etudes-design-art span {
    position: absolute;
    display: block;
  }
  #etudes-design-controls .etudes-design-art span:nth-child(1) {
    left: 4%;
    top: 34px;
    transform: rotate(-16deg) scale(1.18);
  }
  #etudes-design-controls .etudes-design-art span:nth-child(2) {
    left: 47%;
    top: 4px;
    transform: rotate(13deg);
  }
  #etudes-design-controls .etudes-design-art span:nth-child(3) {
    right: 2%;
    bottom: 6px;
    transform: rotate(-23deg);
  }
}


/* Library UI scaffolding. Display only for the Etudes list, never Studio editor or Practice. */
#practice-design-controls { display: none; }
body:has(#app[data-page="practice"] > .shelves) #practice-design-controls {
  display: block;
  width: 100%;
  max-width: 1424px;
  margin: 0 auto;
  padding: 35px clamp(18px, 4.5vw, 64px) 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
html[lang="fa"] #practice-design-controls [lang="en"],
html[lang="en"] #practice-design-controls [lang="fa"] { display: none; }
#practice-design-controls .practice-design-intro {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: center;
  min-height: 96px;
}
#practice-design-controls .practice-design-eyebrow {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}
html[lang="fa"] #practice-design-controls .practice-design-eyebrow { letter-spacing: normal; }
#practice-design-controls h1 {
  margin: 6px 0 3px;
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 830;
  line-height: 1.3;
  letter-spacing: -.04em;
}
#practice-design-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}
#practice-design-controls .practice-design-art {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  width: min(34%,310px);
  flex-shrink: 0;
  height: 124px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: 48px/1 Georgia,serif;
  color: color-mix(in srgb, var(--accent) 27%, transparent);
  user-select: none;
}
#practice-design-controls .practice-design-art span:nth-child(1) { transform: rotate(-16deg) scale(1.25); }
#practice-design-controls .practice-design-art span:nth-child(2) { transform: rotate(13deg) translateY(-12px); }
#practice-design-controls .practice-design-art span:nth-child(3) { transform: rotate(-23deg) translateY(14px); }
#practice-design-controls .practice-design-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 28px 0 6px;
  padding: 13px;
  border: 1px solid color-mix(in srgb,var(--line) 42%,transparent);
  border-radius: 18px;
  background: color-mix(in srgb,var(--panel) 73%,var(--bg));
}
#practice-design-controls .practice-design-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 200px;
  min-width: 170px;
  height: 45px;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb,var(--line) 70%,transparent);
  border-radius: 12px;
  color: var(--muted);
  background: var(--glass-surface);
}
#practice-design-controls .practice-design-search > span {
  font-size: 25px;
  line-height: 1;
}
#practice-design-controls .practice-design-search input {
  min-width: 0;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  cursor: default;
  opacity: 1;
}
#practice-design-controls .practice-design-search input:disabled,
#practice-design-controls select:disabled { opacity: 1; color: var(--muted); }
#practice-design-controls .practice-design-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px;
  max-width: 100%;
  border-radius: 13px;
  background: color-mix(in srgb,var(--soft) 62%,transparent);
}
#practice-design-controls .practice-design-tabs > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
#practice-design-controls .practice-design-tabs > label {
  cursor: pointer;
  padding: 10px 13px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 720;
  color: var(--muted);
  transition: background .16s ease, color .16s ease;
}
#practice-design-controls .practice-design-tabs > input:checked + label {
  background: var(--active-fill);
  color: var(--accent);
  box-shadow: 0 1px 5px color-mix(in srgb,var(--ink) 8%,transparent);
}
body:has(#practice-mine:checked) #app[data-page="practice"] .shelves section:nth-child(2) > .etude-card,
body:has(#practice-mine:checked) #app[data-page="practice"] .shelves section:nth-child(2) > p,
body:has(#practice-imported:checked) #app[data-page="practice"] .shelves section:nth-child(1) > .etude-card,
body:has(#practice-imported:checked) #app[data-page="practice"] .shelves section:nth-child(1) > p {
  display: none;
}
#app[data-page="practice"]:has(> .shelves) {
  padding-top: 0;
}
#app[data-page="practice"]:has(> .shelves) > .row.controls {
  margin-top: 14px;
}
@media (min-width: 720px) and (max-width:1199px) {
  #practice-design-controls .practice-design-toolbar { gap: 9px; }
  #practice-design-controls .practice-design-search { flex-basis: 100%; }
}
@media (max-width:719px) {
  body:has(#app[data-page="practice"] > .shelves) #practice-design-controls {
    padding: 20px 15px 0;
  }
  #practice-design-controls .practice-design-intro { min-height: 95px; }
  #practice-design-controls .practice-design-art { display: none; }
  #practice-design-controls h1 { font-size: 34px; }
  #practice-design-controls .practice-design-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    margin: 17px 0 0;
  }
  #practice-design-controls .practice-design-search {
    width: 100%;
    flex: none;
    min-width: 0;
  }
  #practice-design-controls .practice-design-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: space-between;
  }
  #practice-design-controls .practice-design-tabs > label {
    padding: 10px 11px;
    flex: 1;
    text-align: center;
  }
}


/* The localized static title replaces the duplicated default page h1 on this list only. */
#app[data-page="practice"]:has(> .shelves) > h1 {
  display: none;
}
/* Etudes visual refinements: only the requested page, no JS changes. */
#app[data-page="practice"]:has(> .shelves) > .row.controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
#app[data-page="practice"]:has(> .shelves) > .row.controls button.primary::after {
  content: '+';
  font-size: 19px;
  font-weight: 550;
  line-height: 1;
}
#app[data-page="practice"]:has(> .shelves) > .row.controls button:not(.primary)::before {
  content: '';
  display: block;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  background-color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.75%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8z%22%2F%3E%3Cpath%20d%3D%22M14%202v6h6M12%2011v7m-3-3%203%203%203-3%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.75%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M14%202H6a2%202%200%200%200-2%202v16a2%202%200%200%200%202%202h12a2%202%200%200%200%202-2V8z%22%2F%3E%3Cpath%20d%3D%22M14%202v6h6M12%2011v7m-3-3%203%203%203-3%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
}

/* Shared desktop gutter; static intro and live practice list line up with the navbar. */
@media (min-width: 1100px) {
  body:has(#app[data-page="practice"] > .shelves) {
    position: relative;
    --practice-desktop-gutter: max(
      clamp(20px, 4vw, 64px),
      calc((100vw - 1360px) / 2 + 64px)
    );
  }
  body:has(#app[data-page="practice"] > .shelves) #practice-design-controls,
  #app[data-page="practice"]:has(> .shelves) {
    width: calc(100% - 2 * var(--practice-desktop-gutter));
    max-width: 1232px;
    margin-inline: auto;
    padding-inline: 0;
  }
  body:has(#app[data-page="practice"] > .shelves) #app[data-page="practice"] > .row.controls {
    position: absolute;
    inset-block-start: 181px;
    inset-inline-end: var(--practice-desktop-gutter);
    margin: 0;
    padding: 0;
    gap: 12px;
    z-index: 2;
  }
}

/* Practice shows the same combined library instead of two separate shelves. */
#app[data-page="practice"]:has(> .shelves) .shelves > section:nth-child(2) > p {
  display: none;
}
/* Keep decorative notes in the open desktop hero space, clear of action buttons. */
@media (min-width: 1100px) {
  #practice-design-controls .practice-design-intro {
    position: relative;
  }
  #practice-design-controls .practice-design-art {
    position: absolute;
    inset-inline: auto;
    left: 32%;
    top: 4px;
    width: 34%;
    max-width: 400px;
    height: 136px;
    display: block;
    pointer-events: none;
  }
  #practice-design-controls .practice-design-art span {
    position: absolute;
    display: block;
  }
  #practice-design-controls .practice-design-art span:nth-child(1) {
    left: 4%;
    top: 34px;
    transform: rotate(-16deg) scale(1.18);
  }
  #practice-design-controls .practice-design-art span:nth-child(2) {
    left: 47%;
    top: 4px;
    transform: rotate(13deg);
  }
  #practice-design-controls .practice-design-art span:nth-child(3) {
    right: 2%;
    bottom: 6px;
    transform: rotate(-23deg);
  }
}

/* Etude deletion: independent bottom-right action; keep the card-opening button intact. */
#app[data-page="studio"] .etude-card,
#app[data-page="practice"] .etude-card {
  position: relative;
  min-width: 0;
}
/* Stretch all Studio cards to the tallest card, without moving the delete button. */
#app:has(> .shelves) .etude-card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  height: 100%;
}
#app:has(> .shelves) .etude-card > .etude-item {
  flex: 1 1 auto;
}
#app[data-page="studio"] .etude-card > .etude-item,
#app[data-page="practice"] .etude-card > .etude-item {
  padding-right: 70px;
}
#app[data-page="studio"] .etude-card > .etude-delete,
#app[data-page="practice"] .etude-card > .etude-delete {
  position: absolute;
  right: 12px;
  bottom: 11px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--glass-surface);
  color: var(--muted);
}
.etude-delete svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover:hover) {
  .etude-delete:hover {
    color: var(--danger);
    border-color: currentColor;
  }
}

/* Custom etude-delete dialog: consistent with Goosh light/dark themes. */
.etude-delete-dialog {
  width: min(430px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: clamp(20px, 5vw, 28px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--glass-surface);
  color: var(--ink);
  box-shadow: var(--glass-shadow);
  text-align: start;
}
.etude-delete-dialog::backdrop {
  background: rgb(4 15 25 / 65%);
  backdrop-filter: blur(5px);
}
.etude-delete-dialog h2 {
  margin: 0 0 16px;
  font-size: clamp(21px, 4vw, 25px);
  font-weight: 750;
  line-height: 1.4;
}
.etude-delete-name {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.etude-delete-dialog p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.etude-delete-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.etude-delete-actions button {
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}
.etude-delete-cancel {
  background: var(--glass-surface);
  border: 1px solid var(--line);
  color: var(--ink);
}
.etude-delete-confirm {
  background: var(--danger);
  border: 1px solid var(--danger);
  color: white;
}
@media (hover:hover) {
  .etude-delete-confirm:hover { background: var(--danger); border-color: var(--danger); }
  .etude-delete-cancel:hover { background: var(--soft); }
}
@media (max-width: 420px) {
  .etude-delete-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .etude-delete-actions button { padding-inline: 8px; }
}


/* Mobile Etudes & Practices: SAME compact card component and header actions.
   Desktop card grid, header, and all callbacks remain unchanged. */
.library-mobile-action-label {display: none;}
@media screen and (max-width: 719px) {
  body:has(#app[data-page="studio"] > .shelves) #etudes-design-controls,
  body:has(#app[data-page="practice"] > .shelves) #practice-design-controls {
    padding-top: 12px;
  }
  #etudes-design-controls .etudes-design-intro,
  #practice-design-controls .practice-design-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    min-height: 64px;
  }
  #etudes-design-controls .etudes-design-intro-text,
  #practice-design-controls .practice-design-intro > h1 {
    min-width: 0;
    flex: 0 1 auto;
  }
  #etudes-design-controls h1,
  #practice-design-controls h1 {
    margin: 0;
    font-size: clamp(24px, 7vw, 31px);
    white-space: nowrap;
    line-height: 1.25;
  }
  #etudes-design-controls .mobile-library-actions,
  #practice-design-controls .mobile-library-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
    width: auto;
    margin: 0;
    padding: 0;
  }
  .mobile-library-actions .library-desktop-action-label {display: none;}
  .mobile-library-actions .library-mobile-action-label {display: inline;}
  #etudes-design-controls .mobile-library-actions > button,
  #practice-design-controls .mobile-library-actions > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: none;
  }
  #etudes-design-controls .mobile-library-actions > button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--panel);
  }
  .mobile-library-actions > button.primary::before {
    content: '+';
    font-size: 19px;
    line-height: 1;
  }
  /* Both galleries use the same source renderer; a single mobile rule
     produces full-width, low-height rows for Studio AND Practice. */
  #app:has(> .shelves) .shelves {
    grid-template-columns: minmax(0,1fr);
    grid-auto-rows: auto;
    gap: 10px;
    margin-top: 13px;
  }
  #app:has(> .shelves) .etude-card {
    width: 100%;
    min-width: 0;
    height: auto;
  }
  #app:has(> .shelves) .etude-card > .etude-item {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    width: 100%;
    min-height: 100px;
    margin: 0;
    padding: 14px;
    padding-inline-start: 78px;
    padding-inline-end: 68px;
    border-radius: 15px;
    border-color: color-mix(in srgb,var(--line) 72%,var(--accent));
    background-color: var(--panel);
    background-image:
      radial-gradient(ellipse at 50% 50%,
        color-mix(in srgb,var(--accent) 6%,transparent),transparent 84%);
    background-size: 100% 100%;
    background-position: center;
    box-shadow: var(--glass-soft-shadow);
  }
  #app:has(> .shelves) .shelves > section .etude-item::before {
    content: '♫' !important;
    display: grid;
    place-items: center;
    position: absolute;
    left: auto;
    right: auto;
    inset-inline-end: auto;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    padding: 4px;
    border-radius: 12px;
    background:
      repeating-linear-gradient(
        to bottom,
        transparent 0 9px,
        color-mix(in srgb,var(--accent) 12%,transparent) 9px 10px,
        transparent 10px 13px
      ),
      color-mix(in srgb,var(--accent) 9%,var(--panel));
    border: 1px solid color-mix(in srgb,var(--accent) 11%,var(--line));
    color: var(--accent);
    font: 30px/1 Georgia,serif;
    text-align: center;
    letter-spacing: 0;
  }
  #app:has(> .shelves) .shelves > section .etude-item::after {
    display: none;
  }
  #app:has(> .shelves) .etude-item > strong {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  #app:has(> .shelves) .etude-item > strong::after {
    content: none;
  }
  #app:has(> .shelves) .etude-item > small {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.45;
  }
  #app[data-page="studio"] .etude-card > .etude-delete,
  #app[data-page="practice"] .etude-card > .etude-delete {
    top: 50%;
    bottom: auto;
    left: auto;
    right: auto;
    inset-inline-start: auto;
    inset-inline-end: 12px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 10px;
    border-radius: 12px;
    border-color: color-mix(in srgb,var(--line) 77%,transparent);
    background: var(--glass-surface);
    color: var(--muted);
    box-shadow: none;
  }
  /* With the buttons beside the heading there is no floating Create action. */
  #app:has(> .shelves) > .row.controls button.primary {
    position: static;
  }
  #app:has(> .shelves) {
    padding-top: 0;
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }
}
@media screen and (max-width: 359px) {
  #etudes-design-controls .mobile-library-actions > button,
  #practice-design-controls .mobile-library-actions > button {
    padding-inline: 7px;
    font-size: 11px;
  }
  #etudes-design-controls h1,
  #practice-design-controls h1 {font-size: 24px;}
}


/* Mobile Persian gallery repair (2026-11-21).
   The previous absolute RTL overrides did NOT fix the user's layout.
   A small intrinsic grid reserves three clear areas for score art, title and
   the existing delete control. English and Desktop styles stay untouched. */
@media screen and (max-width: 719px) {
  html[lang="fa"][dir="rtl"] #app:has(> .shelves) .etude-card > .etude-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 44px;
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center;
    justify-items: stretch;
    column-gap: 12px;
    row-gap: 4px;
    direction: rtl;
    text-align: right;
    min-height: 100px;
    padding: 12px;
  }

  /* Use a normal grid item instead of combining old physical and logical
     offsets for an absolutely positioned pseudo-element. */
  html[lang="fa"][dir="rtl"] #app:has(> .shelves) .shelves > section .etude-item::before {
    position: static;
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
    justify-self: center;
    inset: auto;
    inset-inline: auto;
    margin: 0;
    transform: none;
  }
  html[lang="fa"][dir="rtl"] #app:has(> .shelves) .etude-item > strong {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    max-width: 100%;
    text-align: right;
    direction: rtl;
  }
  html[lang="fa"][dir="rtl"] #app:has(> .shelves) .etude-item > small {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    max-width: 100%;
    margin-top: 0;
    text-align: right;
    direction: rtl;
  }

  /* ROOT CAUSE: html[lang="fa"] gives this hard-coded fake date selector
     higher specificity than the earlier mobile strong::after {content:none}.
     That date remained in Persian and overflowed compact list cards. */
  html[lang="fa"][dir="rtl"] #app:has(> .shelves) .etude-item strong::after {
    content: none;
    display: none;
  }

  /* The delete button stays a separate sibling with its original handler.
     Physical positioning is set once, after neutralizing legacy insets. */
  html[lang="fa"][dir="rtl"] #app[data-page="studio"] .etude-card > .etude-delete,
  html[lang="fa"][dir="rtl"] #app[data-page="practice"] .etude-card > .etude-delete {
    inset: auto;
    inset-inline: auto;
    top: 50%;
    bottom: auto;
    right: auto;
    left: 12px;
    transform: translateY(-50%);
  }
}

/* Practice is a read/play entrypoint. No delete control is rendered there,
   so its cards must not reserve the Etudes-only delete button's space. */
#app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item {
  padding-right:17px;
}
@media screen and (max-width:719px) {
  #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item {
    padding-inline-end:14px;
  }
  html[lang="fa"][dir="rtl"] #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item {
    grid-template-columns:48px minmax(0,1fr);
  }
}

/* Etudes and Practice desktop cards: move only the title and its inline date into
   the unused header space. Keep the musical artwork and footer as-is. */
@media screen and (min-width: 720px) {
  #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item > strong,
  #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item > strong {
    position: absolute;
    top: 16px;
    inset-inline-start: 17px;
    width: calc(100% - 34px);
    text-align: start;
    padding-left: 29px;
  }
  #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item > strong::before,
  #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item > strong::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1px;
    width: 22px;
    height: 22px;
    background-color: var(--accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4.5%203.5h11a2%202%200%200%201%202%202v14a2%202%200%200%201-2%202h-11a2%202%200%200%201-2-2v-14a2%202%200%200%201%202-2Z%22%2F%3E%3Cpath%20d%3D%22M6%203.5v18M8.5%209.5h6M8.5%2012h6M8.5%2014.5h4%22%2F%3E%3Cpath%20d%3D%22m13%2018%206.8-8.8%202%201.6-6.8%208.8-3.1%201.2Z%22%2F%3E%3Cpath%20d%3D%22m18.9%2010.3%201.3-1.7a1.4%201.4%200%200%201%202.2%201.7l-.9%201.2%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22black%22%20stroke-width%3D%221.6%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M4.5%203.5h11a2%202%200%200%201%202%202v14a2%202%200%200%201-2%202h-11a2%202%200%200%201-2-2v-14a2%202%200%200%201%202-2Z%22%2F%3E%3Cpath%20d%3D%22M6%203.5v18M8.5%209.5h6M8.5%2012h6M8.5%2014.5h4%22%2F%3E%3Cpath%20d%3D%22m13%2018%206.8-8.8%202%201.6-6.8%208.8-3.1%201.2Z%22%2F%3E%3Cpath%20d%3D%22m18.9%2010.3%201.3-1.7a1.4%201.4%200%200%201%202.2%201.7l-.9%201.2%22%2F%3E%3C%2Fsvg%3E") center / contain no-repeat;
  }
}

/* Shared library share icon; placement remains specific to each card. */
#app:has(> .shelves) .etude-card > .etude-share {
  position: absolute;
  z-index: 2;
  right: 62px;
  bottom: 11px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--glass-surface);
  color: var(--muted);
}
#app:has(> .shelves) .etude-card > .etude-share svg {
  width: 20px;
  height: 20px;
}
@media (hover:hover) {
  #app:has(> .shelves) .etude-card > .etude-share:hover {
    color: var(--accent);
    border-color: currentColor;
  }
}
@media screen and (max-width:719px) {
  #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-share {
    width: 44px;
    height: 44px;
    min-height: 44px;
    bottom: auto;
    top: 50%;
    right: 64px;
    transform: translateY(-50%);
  }
  html[lang="fa"][dir="rtl"] #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-share {
    right: auto;
    left: 64px;
  }
}

/* Remove decorative notation from both library cards. Titles and real actions
   remain; no artificial artwork or blank art region. */
#app:has(> .shelves) .etude-item::before,
#app:has(> .shelves) .etude-item::after,
#app:has(> .shelves) .shelves section:nth-child(2) .etude-item::before,
#app:has(> .shelves) .shelves > section .etude-item::before{
  content:none!important;display:none!important;
}
#app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item,
#app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item{
  display:flex;flex-direction:column;align-items:flex-start;justify-content:center;
  min-height:124px;padding:18px 17px;background-image:none;
}
#app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item{padding-inline-end:112px}
#app:has(> .shelves) .etude-card > .etude-item > strong{
  position:static;width:100%;padding:0;text-align:start;
}
#app:has(> .shelves) .etude-card > .etude-item > strong::before{content:none;display:none}
#app:has(> .shelves) .etude-card > .etude-item > small{margin-top:6px}
#app[data-page="studio"]:has(> .shelves) .etude-card > .etude-delete{
  inset-inline-start:auto;inset-inline-end:12px;top:50%;bottom:auto;transform:translateY(-50%);
}
#app[data-page="studio"]:has(> .shelves) .etude-card > .etude-share{
  inset-inline-start:auto;inset-inline-end:62px;top:50%;bottom:auto;transform:translateY(-50%);
}
@media(max-width:719px){
  html[lang="fa"][dir="rtl"] #app:has(> .shelves) .etude-card > .etude-item{
    display:flex;flex-direction:column;align-items:flex-start;justify-content:center;
    min-height:94px;padding:14px;
  }
  html[lang="fa"][dir="rtl"] #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item,
  #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item{padding-inline-end:114px;min-height:94px}
  html[lang="fa"][dir="rtl"] #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item,
  #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item{padding:14px;min-height:94px}
  #app:has(> .shelves) .etude-item>strong,#app:has(> .shelves) .etude-item>small{width:100%}
}
@media(min-width:720px){
  #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item > strong,
  #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item > strong{position:static;width:100%;padding:0}
  #app[data-page="studio"]:has(> .shelves) .etude-card > .etude-item > strong::before,
  #app[data-page="practice"]:has(> .shelves) .etude-card > .etude-item > strong::before{content:none;display:none}
}

/* Live library search: keep focus and existing card actions intact. */
#etudes-design-controls .etudes-design-search,
#practice-design-controls .practice-design-search{cursor:text}
#etudes-design-controls .etudes-design-search input,
#practice-design-controls .practice-design-search input{cursor:text;color:var(--ink)}

#app:has(> .shelves) .shelves > section.library-search-empty,
#app:has(> .shelves) .shelves > section > .etude-card[hidden],
#app:has(> .shelves) .shelves > .library-search-status[hidden]{display:none!important}
#app:has(> .shelves) .shelves > .library-search-status{
  grid-column:1/-1;margin:8px 0;padding:16px 0;color:var(--muted);
}

/* Both libraries already have a page heading; omit redundant shelf titles. */
html body #app[data-page="studio"] > .shelves::before,
html body #app[data-page="practice"] > .shelves::before {display:none;content:none}
.library-import-etude {display:inline-flex;align-items:center;justify-content:center;gap:6px}
.library-import-etude svg {display:block;width:17px;height:17px;flex:none}
#app[data-page="studio"]:has(> .shelves) > .row.controls button.library-import-etude::before {display:none;content:none}
@media(max-width:719px) {
  #etudes-design-controls .mobile-library-actions > .library-import-etude {gap:4px;padding-inline:7px;white-space:nowrap}
  #etudes-design-controls .mobile-library-actions > .library-import-etude svg {width:15px;height:15px}
}

/* New etude: the shared creation-method dialog, in both themes and viewports. */
.etude-creation-dialog { width:min(460px,calc(100vw - 32px)); }
.etude-creation-header {display:flex;align-items:center;justify-content:space-between;gap:12px;}
.etude-creation-header h2 {margin:0;min-width:0;}
.etude-creation-close {display:grid;place-items:center;flex:0 0 38px;width:38px;height:38px;padding:0;border:1px solid var(--line);border-radius:10px;background:var(--glass-control);color:var(--ink);font-size:26px;line-height:1;}
.etude-creation-dialog .etude-creation-description {margin:12px 0 18px;}
.etude-creation-choices {display:grid;gap:10px;}
.etude-creation-option {display:flex;align-items:center;gap:12px;width:100%;min-height:80px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--glass-control);color:var(--ink);text-align:start;white-space:normal;}
.etude-creation-icon {display:grid;place-items:center;flex:0 0 42px;width:42px;height:42px;border-radius:10px;background:var(--soft);color:var(--accent);}
.etude-creation-icon svg {width:24px;height:24px;}
.etude-creation-copy {display:grid;gap:4px;flex:1;min-width:0;}
.etude-creation-copy strong {font-size:15px;font-weight:750;}
.etude-creation-copy small {font-size:13px;line-height:1.65;color:var(--muted);}

@media (hover:hover) {
  .etude-creation-option:hover,.etude-creation-close:hover {border-color:var(--accent);background:var(--soft);}
}
@media (max-width:420px) {
  .etude-creation-option {gap:10px;padding:11px;}
  .etude-creation-icon {flex-basis:36px;width:36px;height:36px;}
}

/* Practice-only art and exercise tags. The same card and share action remain
   independent keyboard-accessible buttons. No changes to the Etudes layout. */
#app[data-page="practice"]:has(> .shelves) .practice-library-card > .etude-item {
  display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;
  padding:0;min-height:110px;gap:0;overflow:hidden;background-image:none;
}
#app[data-page="practice"]:has(> .shelves) .practice-library-card .etude-item:hover {transform:none;}
#app[data-page="practice"]:has(> .shelves) .practice-card-art {
  display:grid;place-items:center;position:absolute;inset-block-start:1px;inset-inline-start:9px;
  width:112px;height:54px;overflow:hidden;color:var(--accent);opacity:.24;
  pointer-events:none;user-select:none;
}
#app[data-page="practice"] .practice-card-art svg {display:block;width:100%;height:100%;}
#app[data-page="practice"] .practice-art-staff {opacity:.20;}
#app[data-page="practice"] .practice-art-disc {fill:var(--panel);stroke:currentColor;stroke-opacity:.35;}
#app[data-page="practice"] .practice-art-orbit {opacity:.38;}
#app[data-page="practice"] .practice-art-symbol {color:var(--accent);}
#app[data-page="practice"] .practice-art-detail {opacity:.42;}
#app[data-page="practice"] .practice-card-art[data-art="interval"] .practice-art-orbit {stroke-dasharray:12 4;}
#app[data-page="practice"] .practice-card-content {display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:13px 14px;min-width:0;flex:1;position:relative;z-index:1;}
#app[data-page="practice"]:has(> .shelves) .practice-card-title {display:block;width:100%;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere;text-align:start;}
#app[data-page="practice"] .practice-library-card:has(> .practice-card-share) .practice-card-title {padding-inline-end:48px;}
#app[data-page="practice"]:has(> .shelves) .practice-card-title::after {content:none!important;display:none!important;}
#app[data-page="practice"] .practice-card-meta {color:var(--muted);font-size:12px;line-height:1.4;}
#app:is([data-page="studio"],[data-page="practice"]) .practice-card-goals {display:flex;flex-wrap:wrap;align-items:center;gap:5px;width:100%;margin-top:6px;}
#app:is([data-page="studio"],[data-page="practice"]) .practice-card-goal {display:inline-flex;align-items:center;gap:4px;max-width:100%;padding:4px 7px;border-radius:8px;border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line));background:color-mix(in srgb,var(--accent) 8%,var(--panel));color:var(--ink);font-size:11px;line-height:1.45;white-space:normal;text-align:start;overflow-wrap:anywhere;}
#app:is([data-page="studio"],[data-page="practice"]) .practice-card-goal svg {width:14px;height:14px;flex:none;color:var(--accent);}
#app[data-page="practice"] .practice-card-no-goals {color:var(--muted);font-size:11px;}
#app[data-page="practice"]:has(> .shelves) .practice-library-card > .practice-card-share {inset-inline-start:auto;inset-inline-end:9px;top:9px;bottom:auto;transform:none;}
@media(max-width:719px){
  #app[data-page="practice"]:has(> .shelves) .practice-library-card > .etude-item,
  html[lang="fa"][dir="rtl"] #app[data-page="practice"]:has(> .shelves) .practice-library-card > .etude-item {display:flex;flex-direction:column;align-items:stretch;min-height:100px;padding:0;gap:0;}
  #app[data-page="practice"]:has(> .shelves) .practice-card-art {width:96px;height:48px;}
  #app[data-page="practice"] .practice-card-content {padding:11px 12px;}
  #app[data-page="practice"] .practice-library-card:has(> .practice-card-share) .practice-card-title {padding-inline-end:44px;}
  #app[data-page="practice"]:has(> .shelves) .practice-library-card > .practice-card-share {width:40px;height:40px;min-height:40px;top:8px;inset-inline-end:8px;}
}

/* Compact publication labels on Etude cards only. */
#app[data-page="studio"]:has(> .shelves) .library-etude-title-row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;width:100%}
html body #app[data-page="studio"]:has(> .shelves) .library-etude-title-row > strong{flex:1 1 auto;width:auto;min-width:0}
#app[data-page="studio"]:has(> .shelves) .library-etude-title-row > .library-publication-badge{flex:none;align-self:center;white-space:nowrap;margin-inline-start:auto}
@media(max-width:719px){#app[data-page="studio"]:has(> .shelves) .library-etude-title-row{justify-content:flex-start;gap:6px}html body #app[data-page="studio"]:has(> .shelves) .library-etude-title-row > strong{flex:0 1 auto;font-size:15px}#app[data-page="studio"]:has(> .shelves) .library-etude-title-row > .library-publication-badge{margin-inline-start:0}}
#app[data-page="studio"]:has(> .shelves) .library-publication-badge{display:inline-flex;align-items:center;gap:5px;align-self:flex-start;width:auto;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:700;line-height:1.4;color:var(--warning,#e9b65c);background:color-mix(in srgb,var(--warning,#e9b65c) 12%,transparent)}
#app[data-page="studio"]:has(> .shelves) .library-publication-badge[data-status="published"]{color:var(--success,#83cbb0);background:color-mix(in srgb,var(--success,#83cbb0) 12%,transparent)}
#app[data-page="studio"]:has(> .shelves) .library-publication-badge::before{content:'';width:6px;height:6px;border-radius:50%;background:currentColor}
#app[data-page="studio"]:has(> .shelves) .library-publication-pending{font-size:10px;color:var(--warning,#e9b65c);line-height:1.5}
@media(max-width:719px){#etudes-design-controls .etudes-design-status{gap:5px;margin-block-start:8px}#etudes-design-controls .etudes-design-status > label{min-height:30px;font-size:11px;padding:5px 9px}#app[data-page="studio"]:has(> .shelves) .library-publication-badge{font-size:10px;padding:2px 6px}}

/* Exercise-mode marks are separate from draft/published status. */
#app:is([data-page="studio"],[data-page="practice"]):has(> .shelves) .library-practice-modes{display:flex;align-items:center;flex-wrap:wrap;gap:5px;margin:2px 0;min-width:0}
#app:is([data-page="studio"],[data-page="practice"]):has(> .shelves) .library-practice-mode{display:inline-flex;align-items:center;gap:4px;border:1px solid color-mix(in srgb,var(--card-tone,var(--accent)) 34%,transparent);border-radius:999px;padding:2px 7px;color:var(--card-tone,var(--accent));background:color-mix(in srgb,var(--card-tone,var(--accent)) 8%,transparent);font-size:11px;font-weight:650;line-height:1.5;white-space:nowrap}
#app:is([data-page="studio"],[data-page="practice"]):has(> .shelves) .library-practice-mode svg{display:block;flex:none;width:13px;height:13px}
@media(max-width:719px){#app:is([data-page="studio"],[data-page="practice"]):has(> .shelves) .library-practice-modes{gap:4px}#app:is([data-page="studio"],[data-page="practice"]):has(> .shelves) .library-practice-mode{font-size:10px;padding:2px 5px}#app:is([data-page="studio"],[data-page="practice"]):has(> .shelves) .library-practice-mode svg{width:12px;height:12px}}

/* Built-in practices are their own shelf, not personal or imported etudes. */
#app[data-page="practice"]:has(> .shelves) .shelves > section[data-origin="ready"] > h2{display:block;grid-column:1/-1;margin:16px 0 4px;font-size:18px;font-weight:700;color:var(--ink)}

/* Ready practice catalog controls: shared desktop/mobile layout. */
#app[data-page="practice"] .shelves > section[data-origin="ready"] > .ready-shelf-heading{display:flex;grid-column:1/-1;align-items:center;justify-content:space-between;gap:8px;margin:16px 0 4px}
#app[data-page="practice"] .ready-shelf-heading h2{font-size:18px;font-weight:700;margin:0;color:var(--ink)}
#app[data-page="practice"] .ready-tuning-button{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;min-height:38px;padding:6px 10px}
.ready-tuning-button svg{width:17px;height:17px;flex:none}
#app[data-page="practice"] .ready-filters{grid-column:1/-1;padding:12px 14px;border:1px solid var(--line);border-radius:14px;color:var(--ink);background:var(--glass-control)}
.ready-filters summary{display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;list-style:none;font-weight:650;font-size:13px}
.ready-filters summary::-webkit-details-marker{display:none}
.ready-filters summary::after{content:'';flex:none;width:8px;height:8px;border-inline-end:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(45deg);margin-inline-end:2px;margin-top:-4px}
.ready-filters[open] summary::after{transform:rotate(225deg);margin-top:4px}
.ready-filter-summary-title{display:flex;align-items:center;gap:7px;flex:1;min-width:0}
.ready-filter-summary-title svg{width:17px;height:17px;flex:none}
.ready-filter-count{display:inline-grid;place-items:center;min-width:19px;height:19px;padding-inline:4px;border-radius:999px;background:var(--glass-selected);color:var(--accent);font-size:11px}
.ready-filter-result{font-size:12px;font-weight:500;color:var(--muted);white-space:nowrap}
.ready-filter-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 20px;margin-block:14px 10px;border-top:1px solid var(--line);padding-top:12px}
.ready-filter-group{min-width:0;min-inline-size:0;padding:0;margin:0;border:0}
.ready-filter-group legend{font-size:12px;font-weight:650;color:var(--muted);padding:0;margin-bottom:7px}
.ready-filter-options{display:flex;flex-wrap:wrap;gap:6px}
.ready-filter-option{display:inline-flex;align-items:center;gap:7px;min-width:0;min-height:36px;max-width:100%;padding:6px 10px;border:1px solid var(--line);border-radius:9px;background:var(--glass-control);color:var(--ink);font-size:12px;font-weight:550;cursor:pointer;user-select:none;box-sizing:border-box;line-height:1.45}
.ready-filter-option input[type="checkbox"]{appearance:auto;accent-color:var(--accent);width:15px;height:15px;min-width:15px;min-height:15px;flex:0 0 15px;margin:0;padding:0;box-shadow:none;cursor:pointer}
.ready-filter-option:has(input:checked){border-color:var(--accent);background:var(--glass-selected);color:var(--ink)}
.ready-filter-option:has(input:focus-visible){outline:2px solid var(--accent);outline-offset:2px}
.ready-filter-option span{min-width:0;overflow-wrap:anywhere}
.ready-filter-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-top:9px;border-top:1px solid var(--line)}
.ready-filter-footer > span{color:var(--muted);font-size:11px;line-height:1.5}
.ready-filter-clear{min-height:34px;padding:5px 10px;font-size:12px;white-space:nowrap}
.ready-filter-clear:disabled{opacity:.45}
.ready-tuning-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-block:10px}
.ready-tuning-dialog .ready-tuning-hint,.ready-tuning-dialog .ready-tuning-message{font-size:12px;line-height:1.65;margin:4px 0;color:var(--ink)}
.ready-tuning-dialog .ready-tuning-actions{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-block-start:8px}
.ready-tuning-dialog .ready-tuning-actions button{min-height:40px}
@media(max-width:719px){#app[data-page="practice"] .ready-shelf-heading h2{font-size:15px}#app[data-page="practice"] .ready-tuning-button{font-size:12px}.ready-filter-grid{grid-template-columns:minmax(0,1fr);gap:12px}.ready-filter-option{min-height:40px}.ready-filter-result{font-size:11px}}

/* Only the ready-tuning-specific slots; the modal and tuner themselves use
   the shared signature dialog styles in style.css. */
.ready-tuning-dialog .ready-tuning-fields > .practice-field{display:grid;grid-template-columns:minmax(0,1fr);gap:5px;min-width:0;margin:0;position:relative;align-items:start}
.ready-tuning-dialog .ready-tuning-fields > .practice-field > label{font-size:12px;color:var(--muted);margin:0;text-align:start}
.ready-tuning-dialog .ready-tuning-fields .goosh-styled-select-trigger{width:100%;min-height:40px}
.ready-tuning-dialog .ready-tuning-message:empty{display:none}
.ready-tuning-dialog .ready-tuning-actions{margin-top:12px}
.ready-tuning-dialog .ready-tuning-actions button{flex:1 1 auto;font-size:12px}

/* Shared metadata window: spacers never participate in equal-height card rows. */
#app:has(> .shelves) .shelves[data-paged] {position:relative;overflow-anchor:none;}
#app:has(> .shelves) .shelves[data-windowed="true"]::before {display:none;}
.library-page-edge {position:absolute;inset-inline:0;height:1px;pointer-events:none;}
.library-page-head {top:0;}
.library-page-tail {bottom:0;}

/* Practice paging progress: non-blocking, theme tokens and reduced motion. */
#app[data-page="practice"] .library-page-progress{grid-column:1/-1;display:flex;justify-content:center;align-items:center;min-height:48px;padding-block:8px;color:var(--secondary-ink)}
.library-page-loading{display:flex;align-items:center;gap:10px;font-size:13px}
.library-page-pulse{width:18px;height:18px;border-radius:50%;border:2px solid var(--line);border-block-start-color:var(--accent);animation:library-page-spin .8s linear infinite}
@keyframes library-page-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.library-page-pulse{animation:none}}
