/* Shared framing for market dialogs and profile surfaces. */
:root {
  --vi-ink: #17171b;
  --vi-blue: #1837bc;
  --vi-acid: #eaff45;
  --vi-frame-shadow: 4px 5px 0 rgb(23 23 27 / 74%);
}
dialog#modal[open] {
  box-sizing: border-box;
  border: 2px solid var(--vi-ink);
  border-radius: 19px;
  box-shadow: var(--vi-frame-shadow);
}
#modal .st-thread > .st-post {
  margin: 0 0 22px;
  padding: clamp(16px, 2.3vw, 27px);
  border: 1px solid #d5dcef;
  border-radius: 16px;
  background: #f1f4fc;
}
#modal .bounty-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
#modal .bounty-detail-actions .btn {
  width: auto;
  min-height: 42px;
  white-space: nowrap;
}
#modal .bounty-detail-actions .primary {
  background: var(--vi-blue);
  color: white;
  border-color: var(--vi-blue);
}
#modal .bounty-detail-actions .bounty-return {
  background: #f5f6f9;
  color: #2a3040;
  border: 1px solid #c2c7d1;
  box-shadow: none;
}
#modal .bounty-detail-actions .bounty-return:hover { background: #e9edf5; }

.cast-profile,
.pc-page .pc-panel,
.entry[data-view="profile"] .entry-main {
  box-sizing: border-box;
  border: 2px solid var(--vi-ink);
  border-radius: 18px;
  background-color: white;
  box-shadow: var(--vi-frame-shadow);
}
.cast-profile { padding: clamp(18px, 3vw, 36px); }
.pc-page .pc-panel { padding: clamp(16px, 1.8vw, 24px); }
.entry[data-view="profile"] .entry-main { padding: clamp(20px, 3.5vw, 42px); }
.pc-page .pc-stat.green { background: var(--vi-ink); color: white; }
.pc-page .pc-stat.yellow { background: var(--vi-acid); color: var(--vi-ink); }
.pc-page .pc-ranks small { background: white; border-color: var(--vi-blue); color: var(--vi-blue); }
.pc-page .pc-stat.blue { background: var(--vi-blue); }
.office .admin-metrics > div:nth-child(4) { background: var(--vi-acid); color: var(--vi-ink); }
.pf-page { --mint: var(--vi-acid); --violet: var(--vi-blue); }
.pf-page .pf-metric.mint { --accent: var(--vi-acid); }
@media (max-width: 480px) {
  dialog#modal[open] { border-radius: 14px; }
  #modal .bounty-detail-actions { gap: 8px; }
  #modal .bounty-detail-actions .btn { padding-inline: 12px; }
}

.cast-home {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 clamp(12px, 2vw, 26px) 28px;
}
.cast-home .cast-profile { margin: 20px 0 14px; max-width: none; }
.cast-home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.cast-home .st-wall {
  padding: clamp(16px, 2.5vw, 28px);
  border: 2px solid var(--vi-ink);
  border-radius: 18px;
  box-shadow: var(--vi-frame-shadow);
  background: white;
}
.pc-page .pc-hero {
  border: 2px solid var(--vi-ink);
  box-shadow: var(--vi-frame-shadow);
  background-image: linear-gradient(122deg, #12131d, #1837bc 52%, #506ad2);
}
.pc-page .pc-holo {
  background: linear-gradient(130deg, transparent 48%, #ffffff17 54%, transparent 64%);
}
.pc-page .pc-avatar i { background: var(--vi-acid); color: var(--vi-ink); }
.pc-page :focus-visible, .pc-editor :focus-visible {
  outline: 3px solid var(--vi-blue);
  outline-offset: 2px;
}
.pc-page .pc-hero :focus-visible { outline-color: var(--vi-acid); }

/* Confirmations share their DOM order with the visual and keyboard order. */
dialog#modal[open]:is([data-task-detail], :has(form), :has(.card-back-reader)) {
  border: 2px solid var(--vi-ink);
  box-shadow: var(--vi-frame-shadow);
}
#modal :is(.vi-dialog-actions, .dialog-actions, .bounty-footer) {
  display: flex;
  flex-flow: row wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
#modal .vi-dialog-actions { margin-top: 15px; }
#modal :is(.vi-dialog-actions, .dialog-actions, .bounty-footer) > button {
  flex: 0 0 auto;
  justify-self: end;
  width: auto;
  max-width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 7px 14px;
  border-radius: 9px;
}
#modal :is(.vi-dialog-actions, .dialog-actions, .bounty-footer) > .btn:not(.primary,.danger,.bounty-secondary-cancel) {
  background: white;
  color: #252a39;
  border: 1px solid #bfc5d3;
  box-shadow: none;
}
#modal :is(.vi-dialog-actions, .dialog-actions, .bounty-footer) > .btn:not(.primary,.danger,.bounty-secondary-cancel):enabled:hover {
  background: #f0f3fa;
  border-color: #8793ad;
}
#modal :is(.vi-dialog-actions, .dialog-actions, .bounty-footer) > .bounty-secondary-cancel {
  color: #8d3743;
  border: 1px solid #dfb3ba;
  background: #fff9fa;
  box-shadow: none;
}
#modal [data-cost-note] { margin-right: auto; font-size: .86rem; color: #84313f; }
#modal [data-cost-note]:empty { display: none; }
#modal .primary, #modal .im-send, .im-compose .im-send, .office .admin-pane form .btn.primary {
  min-height: 40px;
  border-radius: 9px;
  padding: 7px 14px;
  background: var(--vi-blue);
  border: 1px solid var(--vi-blue);
  color: white;
}
#modal .btn.primary:enabled:hover, #modal .im-send:enabled:hover, .im-compose .im-send:enabled:hover, .office .admin-pane .btn.primary:enabled:hover {
  background: #102998;
  border-color: #102998;
}
#modal[open] button:is(.btn.primary, .im-send):disabled, .im-compose .im-send:disabled,
.office .admin-pane form .btn.primary:disabled {
  background: #e5e7ec;
  border: 1px solid #c4c9d4;
  color: #525c6d;
  opacity: 1;
  box-shadow: none;
  cursor: not-allowed;
}
#modal[open] :is(input:not([type=checkbox],[type=radio],[type=file]),textarea,select):focus,
.office .admin-pane :is(input:not([type=checkbox],[type=radio],[type=file]),textarea,select):focus,
.im-compose:focus-within {
  border-color: var(--vi-blue);
  outline: 2px solid var(--vi-blue);
  outline-offset: 1px;
}
#modal[open] button:focus-visible, .im-compose button:focus-visible, .office .admin-pane button:focus-visible {
  outline: 2px solid var(--vi-blue);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  html:has(#modal[open]), body:has(#modal[open]) {
    overflow: hidden;
    overscroll-behavior: none;
  }
  #app :is(input:not([type]), input[type=text], input[type=search], input[type=password], input[type=number], input[type=email], textarea, select),
  dialog#modal[open] :is(input:not([type]), input[type=text], input[type=search], input[type=number], textarea, select) {
    font-size: max(16px, 1em);
  }
  dialog#modal[open]:is(:has(form), [data-task-detail]) {
    --sheet-top: max(4px, env(safe-area-inset-top));
    --sheet-bottom: max(4px, env(safe-area-inset-bottom));
    box-sizing: border-box;
    inset: calc(var(--dialog-visible-top, 0px) + var(--sheet-top)) 0 auto;
    width: calc(100% - 12px);
    max-width: 100%;
    max-height: calc(min(100dvh, var(--dialog-visible-height, 100dvh)) - var(--sheet-top) - var(--sheet-bottom));
    margin: 0 auto;
    overscroll-behavior: contain;
    scroll-padding-block: 64px 60px;
  }
  #modal[open]:is(:has(form), [data-task-detail]) > .dialog-head {
    position: sticky;
    top: -1px;
    z-index: 4;
    background: white;
  }
  #modal[open] .close-btn { min-width: 44px; min-height: 44px; }
  #modal :is(#pc-editor, #feed-form) > button[type=submit] {
    position: sticky;
    bottom: 0;
    z-index: 2;
    min-height: 44px;
  }
  .hn-switch { flex-wrap: wrap; overflow: visible; }
  .entry .social-sticker, .entry .entry-foil::after, .entry .stage-art img,
  .entry .entry-form-column { animation: none; }
}

#store-entry-status {
  position: fixed;
  z-index: 10001;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  color: white;
  background: #101425;
}
#store-entry-status button {
  padding: 10px 18px;
  min-height: 44px;
  color: inherit;
  background: transparent;
  border: 1px solid #9099ad;
  border-radius: 10px;
}

@media (max-width: 700px) {
  dialog#modal[open]:has([data-action=confirm-refresh]) {
    box-sizing: border-box;
    inset: calc(var(--dialog-visible-top, 0px) + 6px) auto auto calc(var(--dialog-visible-left, 0px) + 6px);
    margin: 0;
    width: calc(var(--dialog-visible-width, 100%) - 12px);
    max-height: calc(var(--dialog-visible-height, 100dvh) - 12px);
    overflow: auto;
    padding: 16px;
  }
  #modal:has([data-action=confirm-refresh]) .dialog-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(118px, 100%), 1fr));
  }
  #modal:has([data-action=confirm-refresh]) .dialog-actions > button {
    width: 100%;
    min-height: 44px;
    white-space: normal;
  }
}

.catalog-art { display: contents; }
.catalog-art:not(.ready)::before {
  content: "";
  position: absolute;
  inset: 15% 18% 8%;
  border-radius: 45% 45% 32% 32%;
  background: linear-gradient(110deg,#efeff4,#fafafa,#dedfe9);
}
.wall-frost .catalog-silhouette {
  width: min(96%, 145px);
  aspect-ratio: 1;
  margin: auto;
  align-self: center;
  justify-self: center;
  mask: none;
  background: url('/card-previews/locked.webp?rev=9acb1cb03b40ad8f') var(--sprite-position) / 1000% 1000% no-repeat;
}
@media (max-width: 700px) {
  html, body, #app { max-width: 100%; overflow-x: clip; }
  .shell, .workspace, .content, .square, .g-board, .pc-page, .toy-wall,
  #modal form, #modal fieldset, #modal .field { min-width: 0; max-width: 100%; }
  #app :is(input,textarea,select), dialog#modal :is(input,textarea,select) { font-size: 16px !important; }
  #modal::backdrop { background: rgba(16,22,36,.83); backdrop-filter: none; }
  dialog#modal[open]:is(:has(form),[data-task-detail]) {
    width: calc(var(--dialog-visible-width,100vw) - 12px);
    left: calc(var(--dialog-visible-left,0px) + 6px);
    right: auto;
    margin-inline: 0;
    background-color: white;
    overflow-x: clip;
  }
  #modal .bounty-field-feedback { color: #9e2034; font-weight: 650; }
  #modal .bounty-body { scroll-padding-block: 16px 24px; }
  .manual-reveal-row { scroll-snap-type: x proximity; }
  .pack-room:has(.manual-reveal-row), .m3-arena {
    margin-bottom: calc(72px + env(safe-area-inset-bottom,0px));
    scroll-margin-bottom: calc(72px + env(safe-area-inset-bottom,0px));
  }
  .pack-room .pop-keep-area, .m3-arena { padding-bottom: max(12px, env(safe-area-inset-bottom,0px)); }
}

.market-initial {min-height:100vh;color:#17213b;background:#faf9f5}
.market-initial header {display:flex;align-items:center;gap:12px;padding:14px 20px;border-bottom:1px solid #e4e4e1;background:white}
.market-initial main {max-width:840px;margin:auto;padding:28px 20px}
.market-initial .entry-skeleton {margin:16px 0;width:min(100%,32rem)}

@media (max-width: 700px) {
  .catalog-filter-bar {grid-template-rows:auto}
  .catalog-filter-track {flex-wrap:wrap;overflow:visible}
  .catalog-filter-track > i,
  .catalog-filter-track > [aria-pressed="false"]:not([data-key="reset"],[data-key="family"]) {display:none}
  .catalog-filter-track > button {max-width:100%;white-space:normal;overflow-wrap:anywhere}
  html:has(.m3-arena), html:has(.pop-keep-area) {scroll-padding-bottom:calc(74px + env(safe-area-inset-bottom,0px))}
}
