/* Atelier cases and enamel switches. The sheets keep their original size,
   scrolling, safe-area padding and focus flow. Never paint over an art plane. */
body[data-theme] :is(#shopDialog, #rareVitrineDialog, #loupe, #albumDetail, #clientMacro, #benchMoreDialog),
body[data-theme] #bench:not([hidden]) .mineral-bench #benchMoreDialog,
body[data-theme] #bench:not([hidden]) .mineral-bench #mineralEnd[data-result=loss] {
  --case-shell: linear-gradient(90deg, var(--arc-gold), color-mix(in srgb, var(--arc-main) 72%, transparent) 50%, var(--arc-gold)) top / 100% 4px no-repeat,
    var(--arc-room) top / 100% 4px no-repeat,
    linear-gradient(136deg, transparent 66%, var(--arc-gold) 67% 75%, var(--arc-main) 76%) right top / 24px 24px no-repeat,
    linear-gradient(145deg, var(--arc-paper) 30%, var(--arc-pale));
  color: var(--arc-ink) !important;
  background: var(--case-shell) !important;
  border-color: var(--arc-edge) !important;
  border-radius: 18px;
  box-shadow: inset 0 2px #fff7, inset 0 -3px #23173526, 0 9px 24px #24152e54;
}
body[data-theme] #bench #benchMoreDialog,
body[data-theme] #rareVitrineDialog.rv-dialog { border-radius: 18px 18px 0 0; }
body[data-theme] :is(#shopDialog, #loupe, #albumDetail, #clientMacro, #rareVitrineDialog)::backdrop,
body[data-theme] #bench #benchMoreDialog::backdrop {
  background: #211a398f;
  background: color-mix(in srgb, #211a39 64%, transparent);
}

/* The frame is shared; optics, the loupe specimen button and the rare-cut
   canvases keep their distinct display beds and independent illumination. */
body[data-theme] :is(#shopDialog, #loupe, #albumDetail, #clientMacro, #benchMoreDialog) :is(h2, h3, .eyebrow, small, p, .opt-hint),
body[data-theme] #bench #mineralEnd[data-result=loss] :is(strong, p) {
  color: var(--arc-ink) !important;
}
body[data-theme] :is(#shopDialog, #loupe, #albumDetail, #clientMacro, #benchMoreDialog, #rareVitrineDialog) button:not(.crystal-photo),
body[data-theme] #bench:not([hidden]) .mineral-bench #benchMoreDialog button:not(.mb-wallet),
body[data-theme] #bench:not([hidden]) .mineral-bench #mineralEnd[data-result=loss] button {
  --button-face: linear-gradient(170deg, var(--arc-paper), var(--arc-pale));
  --button-ink: var(--arc-ink);
  color: var(--button-ink) !important;
  background: var(--button-face) !important;
  border-color: var(--arc-edge) !important;
  border-radius: 13px;
  box-shadow: inset 0 2px #fff6, inset 0 -2px #23173525, 0 1px 2px #24132e26;
}
body[data-theme] :is(#shopDialog, #loupe, #albumDetail, #clientMacro, #benchMoreDialog, #rareVitrineDialog)
  :is(button[aria-pressed=true]:not(.crystal-photo), #shopClose, #closeLoupe, #closeDetail, #clientMacroClose, #benchMoreClose, #rareVitrineClose),
body[data-theme] #bench:not([hidden]) .mineral-bench #benchMoreDialog :is(#benchMoreClose, button[aria-pressed=true]),
body[data-theme] #bench:not([hidden]) .mineral-bench #mineralEnd[data-result=loss] #benchRetry {
  --button-face: linear-gradient(170deg, color-mix(in srgb, var(--arc-main) 22%, var(--arc-deep)), var(--arc-deep));
  --button-ink: #fff;
  color: var(--button-ink) !important; background: var(--button-face) !important;
}
body[data-theme] :is(#shopDialog, #loupe, #albumDetail, #clientMacro, #benchMoreDialog) button:disabled {
  box-shadow: none;
  opacity: .62;
}
body[data-theme] :is(#shopDialog, #loupe, #albumDetail, #clientMacro, #benchMoreDialog, #rareVitrineDialog) :is(button, summary):focus-visible,
body[data-theme] #bench #mineralEnd[data-result=loss] button:focus-visible {
  outline: 3px double var(--arc-ink); outline-offset: 1px;
}
#loupe .crystal-orbit-label { color: #382a34; }
#loupe #cutIndex { color: var(--arc-ink); }
#albumDetail #detailGrades li, #shopDialog .shop-head,
#bench #benchMoreDialog details { border-color: var(--arc-edge); }
#albumDetail #detailGrades li::marker { color: var(--arc-ink); }
#bench #benchMoreDialog details {
  border-radius: 10px; background: var(--arc-paper); color: var(--arc-ink);
  box-shadow: inset 3px 0 var(--arc-gold);
}

/* Coin tags, trays and inventory. No reset of StoreKit status or purchase
   affordances: disabled / owned items still read differently from live ones. */
body[data-theme] :is(#deskWalletBtn, #benchWalletBtn),
#shopDialog :is(.shop-balance, .st-sym), #rareVitrineDialog .rv-count {
  color: #342238 !important;
  background: linear-gradient(150deg, #fff3cb, var(--arc-gold)) !important;
  border-color: var(--arc-edge) !important;
  border-radius: 999px;
  box-shadow: inset 0 2px #fff9, inset 0 -2px #66402126;
}
#shopDialog .st-sym { border-radius: 10px; }
body[data-theme] #shopDialog :is(.shop-tool, .shop-pack, .shop-status) {
  background: var(--arc-paper);
  color: var(--arc-ink); border-color: var(--arc-edge); border-radius: 13px;
  box-shadow: inset 3px 0 var(--arc-main), 0 2px 3px #1f183218;
}
body[data-theme] #shopDialog .shop-status { background: var(--arc-pale); }
body[data-theme] #shopDialog .shop-pack { box-shadow: inset 3px 0 var(--arc-gold); }
body[data-theme] #shopDialog .shop-pack button,
body[data-theme] #bench:not([hidden]) .mineral-bench #mineralEnd[data-result=loss] #benchContinueExtra {
  --button-face: linear-gradient(160deg, #fff2c0, var(--arc-gold)); --button-ink: #342238;
}

/* Bright cabinet surround, dark textile in each pocket. Only the actual
   mastery badge gets gold; its dim counterpart remains clearly labelled. */
body[data-theme] #rareVitrineDialog :is(.rv-head small, .rv-head h3, .rv-note) { color: var(--arc-ink); }
body[data-theme] #rareVitrineDialog .rv-cell {
  border-color: var(--arc-edge); border-radius: 14px;
  background: linear-gradient(180deg, #21163329, #211633a8), var(--arc-velvet) center / cover, #241832;
  box-shadow: inset 0 1px #fff5, inset 0 -3px #190f2666;
}
body[data-theme] #rareVitrineDialog .rv-cell.rv-mastered { border-color: var(--arc-gold); box-shadow: inset 0 0 0 1px var(--arc-gold); }
#rareVitrineDialog .rv-cell :is(strong, small) { color: #fff7ef; }
#rareVitrineDialog .rv-badge { background: #301f39; color: #ffefe4; border-color: #b9a8bb; }
#rareVitrineDialog .rv-cell.rv-mastered .rv-badge { background: var(--arc-gold); color: #342238; border-color: #fff3c8; }

/* Apprentice receipt only: the worn portrait and its graded mount, including
   the touchless first-look state, retain their own exact presentation. */
body[data-theme] #room.first-clip-look #firstClipStudy figcaption {
  background: var(--arc-paper); color: var(--arc-ink); border-radius: 12px;
  box-shadow: inset 0 2px var(--arc-gold), inset 0 -2px var(--arc-edge), 0 2px 5px #21183245;
}
body[data-theme] #room.first-clip-look #firstClipStudy figcaption small { color: var(--arc-ink); }
