/* Load after style.css, only on /store. The layout follows /cards: a parchment rail, a toolbar, and the
   game's teal window glass holding the item grid and the picked item (roBrowser Shop/Store/StoreTab.js). */

/* prontera-hero is bright on the left and .banner::before paints under the art, so the store brings its
   own shade: ::after comes after the img in the tree, so at the same z-index it paints over it. */
.banner--store::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgb(6 36 44 / 62%) 0%, rgb(6 36 44 / 36%) 34%, transparent 58%);
}

.banner--store .banner__copy { padding: 3.2rem 0 0 2.4rem; }
.banner--store h1 { font-size: 3.25rem; line-height: 1; }
.banner--store .ornament { width: 21rem; margin-top: .55rem; }

.store {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  grid-template-areas:
    'rail toolbar'
    'rail results';
  column-gap: 1.25rem;
  align-items: start;
  width: min(var(--content-width), calc(100% - 2.5rem));
  padding-block: 1.35rem 2.5rem;
}

/* --- Rail: wallet and shelves on parchment --- */

.st-rail {
  grid-area: rail;
  display: grid;
  gap: 1rem;
  padding: .85rem 1rem 1rem;
  border: 1px solid var(--gold-line);
  border-radius: 6px;
  background: #F8ECDC;
  box-shadow: inset 0 0 0 3px #FBF3E6, 0 1px 3px rgb(80 50 20 / 12%);
}

.st-wallet h2 {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--gold-line);
  font-size: 1.3125rem;
  -webkit-text-stroke-width: .04em;
}

.st-coin {
  flex: none;
  width: 1.1em;
  height: 1.1em;
}

.st-coin-face { fill: #E8BD70; stroke: #A87B33; stroke-width: 1.2; }
.st-coin-ring { fill: none; stroke: #A87B33; stroke-width: 1; opacity: .7; }
.st-coin-star { fill: #FFF1CC; }

.st-wallet__worlds {
  display: grid;
  gap: .4rem;
  margin-top: .65rem;
}

.st-wallet__worlds div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}

.st-wallet__worlds dt {
  color: var(--muted);
  font-size: .875rem;
}

.st-wallet__worlds dd {
  margin: 0;
  color: var(--brown);
  font: 400 1.25rem var(--font-numeral);
}

.st-wallet__hint {
  margin-top: .65rem;
  font-size: .9375rem;
}

.st-wallet__hint a { color: var(--link); }

/* Buying Cash Points (points.js) */
.st-wallet__get { margin-top: .85rem; }

.st-shelves ul {
  display: grid;
  gap: .15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.st-shelf-group {
  margin-top: .45rem;
  padding: .55rem .6rem .15rem;
  border-top: 1px solid var(--gold-line);
  color: var(--gold-ink);
  font: 600 .75rem var(--font-body);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.st-shelf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  min-height: 2.1rem;
  padding: .25rem .6rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: none;
  font-size: .9375rem;
  text-align: left;
}

.st-shelf--nested { padding-left: 1.1rem; }

.st-shelf:hover {
  border-color: var(--gold-line);
  background: #FCF5E8;
}

.st-shelf[aria-pressed='true'] {
  border-color: var(--gold);
  background: #FCF5E8;
  box-shadow: inset 3px 0 0 var(--gold);
  font-weight: 600;
}

.st-shelf__count {
  color: var(--muted);
  font: 400 .9375rem var(--font-numeral);
}

/* --- Toolbar --- */

.st-toolbar {
  grid-area: toolbar;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.st-search { flex: 1; }

.st-toolbar :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 2.4rem;
  padding: .35rem .9rem;
  border: 1px solid #C9A46A;
  border-radius: var(--radius);
  color: var(--text);
  background-color: #FCF5E8;
  font-size: .9375rem;
}

.st-search input {
  padding-left: 3rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A4036' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") 1rem 50% / 1.15rem no-repeat,
    #FCF5E8;
}

.st-sort select {
  width: 12.5rem;
  appearance: none;
  padding-right: 2rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%233A2412' stroke-width='1.6'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") right .7rem center / .75rem no-repeat,
    #FCF5E8;
}

.st-results {
  grid-area: results;
  min-width: 0;
}

.st-results__header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-block: .85rem .95rem;
}

.st-results__header h2 {
  flex: none;
  color: var(--brown);
  font: 400 1.375rem var(--font-numeral);
  -webkit-text-stroke: .03em currentColor;
}

.st-results__header .ornament { flex: 1; }

.st-delivery {
  margin-top: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--gold-line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--parchment-raised);
  font-size: .9375rem;
}

/* --- The game's window glass. Its tokens are prefixed so the portal's own stay untouched. --- */

.st-album,
.st-dialog {
  --st-text: #FFF5DF;
  --st-muted: #C9C3B4;
  --st-line: rgb(205 170 110 / 28%);
  --st-line-strong: rgb(205 170 110 / 55%);
  --st-well: rgb(0 0 0 / 24%);
  --st-field: #0A2E35;
  --st-side: 21rem;
  color: var(--st-text);
}

.st-album :focus-visible,
.st-dialog :focus-visible { outline-color: var(--focus-on-dark); }

.st-album {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--st-side);
  align-items: start;
  border: 1px solid var(--st-line);
  border-radius: 16px;
  background:
    linear-gradient(to left, rgb(0 0 0 / 12%) var(--st-side), transparent var(--st-side)),
    radial-gradient(120% 80% at 50% -10%, rgb(240 194 115 / 8%), transparent 60%),
    linear-gradient(180deg, #0E3D45, #061E24);
  box-shadow: 0 12px 32px rgb(40 24 8 / 28%), 0 0 0 1px rgb(205 170 110 / 18%);
}

.st-album__grid {
  min-width: 0;
  min-height: 24rem;
  align-self: stretch;
  padding: 18px;
  border-right: 1px solid var(--st-line);
}

/* The item follows the reader down a long grid. */
.st-album__side {
  position: sticky;
  top: 0;
  max-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

:is(.st-album__side, .st-dialog)::-webkit-scrollbar { width: 8px; }
:is(.st-album__side, .st-dialog)::-webkit-scrollbar-thumb { border-radius: 8px; background: rgb(205 170 110 / 35%); }
:is(.st-album__side, .st-dialog)::-webkit-scrollbar-track { background: transparent; }

/* --- Tiles --- */

.st-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 18px 14px;
}

.st-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: none;
  text-align: center;
  transition: transform .12s;
}

.st-tile:hover { transform: translateY(-2px); }
.st-tile:focus-visible { outline: 0; }
.st-tile:focus-visible .st-plate { outline: 3px solid var(--focus-on-dark); outline-offset: 3px; }

.st-tile[aria-current] .st-plate {
  box-shadow: 0 0 0 2px var(--st-text), 0 0 18px rgb(240 194 115 / 45%);
}

/* kRO collection art (75x100, painted on white) on the game's parchment plate; multiply drops the white. */
.st-plate {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  padding: 6%;
  border-radius: 7px;
  background: radial-gradient(90% 80% at 50% 40%, #FBF6EA, #ECE2CB);
  box-shadow: inset 0 0 0 1px rgb(168 123 51 / 45%), 0 6px 14px rgb(0 0 0 / 40%);
}

.st-plate img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  mix-blend-mode: multiply;
}

/* Painted art (store/art, transparent WebP): smooth, standing on the plate with its own shadow. */
.st-plate img.st-painted {
  image-rendering: auto;
  mix-blend-mode: normal;
  filter: drop-shadow(0 5px 6px rgb(60 40 20 / 35%));
}

.st-no-art {
  width: 46%;
  color: #B89A66;
}

.st-tag {
  position: absolute;
  z-index: 1;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #1F1608;
  background: linear-gradient(180deg, #F4D38F, #D6A24F);
  box-shadow: 0 1px 3px rgb(0 0 0 / 40%);
  font: 700 10px var(--font-body);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.st-tile__name {
  display: -webkit-box;
  min-height: 2.5em;
  overflow: hidden;
  color: var(--st-text);
  font-size: .82rem;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.st-tile__price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--gold-bright);
  font: 400 1.0625rem var(--font-numeral);
}

.st-tile__price .st-coin { width: 15px; height: 15px; }

/* Bundles: the tags stack in the corner, the price per piece follows the price (or wraps under it). */
.st-tags {
  position: absolute;
  z-index: 1;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.st-tags .st-tag { position: static; }

.st-tag--save {
  color: #E9FFEF;
  background: linear-gradient(180deg, #3FA866, #23784A);
}

.st-tile__price { flex-wrap: wrap; column-gap: 6px; }

.st-tile__each {
  color: var(--st-muted);
  font: 600 .72rem var(--font-body);
}

/* A bundle fans out copies of the art, more for a bigger bundle, under its count. */
.st-fan {
  position: relative;
  width: 100%;
  height: 100%;
}

.st-fan__card {
  position: absolute;
  inset: 4% 16% 6%;
  transform: translateX(calc(var(--i) * 20%)) rotate(calc(var(--i) * 9deg));
  transform-origin: 50% 100%;
  filter: drop-shadow(0 3px 4px rgb(0 0 0 / 35%));
}

.st-plate .st-fan__card img { mix-blend-mode: normal; }

.st-count {
  position: absolute;
  right: 6%;
  bottom: 4%;
  padding: 1px 8px 2px;
  border: 1px solid rgb(205 170 110 / 55%);
  border-radius: 999px;
  background: rgb(6 30 36 / 88%);
  box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
  color: var(--gold-bright);
  font: 400 1rem/1.2 var(--font-numeral);
}

.st-plate--large .st-count { padding: 2px 11px 3px; font-size: 1.35rem; }

.st-deal {
  padding: 10px 12px;
  border: 1px solid rgb(63 168 102 / 45%);
  border-radius: 10px;
  background: rgb(63 168 102 / 12%);
  color: var(--st-text);
  font-size: .84rem;
  line-height: 1.5;
  text-align: center;
}

.st-deal b { color: var(--gold-bright); font-weight: 700; }

.st-empty {
  padding: 48px 12px;
  color: var(--st-muted);
  font-size: .9375rem;
  text-align: center;
}

.st-empty .st-ghost { margin-top: 14px; }

/* --- Item detail --- */

.st-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 20px 22px;
}

/* 150 px art: twice the collection art. */
.st-plate--large {
  flex: none;
  align-self: center;
  width: 176px;
  padding: 13px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgb(168 123 51 / 45%), 0 10px 24px rgb(0 0 0 / 50%);
}

.st-detail__name {
  margin-top: 4px;
  color: var(--st-text);
  font: 400 1.35rem/1.2 var(--font-heading);
  text-align: center;
  -webkit-text-stroke: 0;
}

.st-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.st-badge {
  padding: 3px 9px;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  color: var(--st-muted);
  font: 700 10px var(--font-body);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.st-badge--new {
  border-color: var(--gold);
  color: var(--st-text);
  background: rgb(199 153 75 / 28%);
}

.st-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--st-muted);
  font-size: .8125rem;
}

.st-price b {
  color: var(--gold-bright);
  font: 400 1.5rem var(--font-numeral);
}

.st-price .st-coin { width: 20px; height: 20px; }

.st-desc {
  padding: 12px 14px;
  border: 1px solid var(--st-line);
  border-radius: 10px;
  background: var(--st-well);
  font-size: .84rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.st-buy {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--st-line);
}

.st-section-title {
  margin: 0;
  color: var(--gold);
  font: 600 11px var(--font-body);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.st-buy-form,
.st-confirm {
  display: grid;
  gap: 12px;
}

.st-field {
  display: grid;
  gap: 5px;
}

.st-field label {
  color: var(--st-muted);
  font-size: .8125rem;
  font-weight: 600;
}

.st-field select,
.st-amount input {
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  padding: .35rem .7rem;
  border: 1px solid var(--st-line-strong);
  border-radius: 6px;
  color: var(--st-text);
  background-color: var(--st-field);
  font-size: .9375rem;
}

.st-field select {
  appearance: none;
  padding-right: 2rem;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23F0C273' stroke-width='1.6'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") right .7rem center / .75rem no-repeat,
    var(--st-field);
}

.st-field :is(option, optgroup) {
  color: var(--st-text);
  background: var(--st-field);
}

.st-field :is(select, input):hover { border-color: var(--gold-bright); }

.st-amount {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
  gap: 6px;
}

.st-amount input {
  font: 400 1.125rem var(--font-numeral);
  text-align: center;
  appearance: textfield;
}

.st-amount input::-webkit-inner-spin-button,
.st-amount input::-webkit-outer-spin-button { margin: 0; appearance: none; }

.st-step,
.st-ghost {
  appearance: none;
  border: 1px solid var(--st-line-strong);
  border-radius: 6px;
  color: var(--st-text);
  background: linear-gradient(180deg, rgb(240 194 115 / 16%), rgb(199 153 75 / 8%));
  transition: background .15s, border-color .15s;
}

.st-step {
  min-height: 2.5rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.st-ghost {
  min-height: 2.4rem;
  padding: 7px 14px;
  font: 600 .8125rem var(--font-body);
}

:is(.st-step, .st-ghost):hover:not(:disabled) {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgb(240 194 115 / 30%), rgb(199 153 75 / 16%));
}

.st-step:disabled { opacity: .4; }

.st-sum,
.st-receipt {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--st-line);
  border-radius: 10px;
  background: var(--st-well);
}

:is(.st-sum, .st-receipt) div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

:is(.st-sum, .st-receipt) dt {
  flex: none;
  color: var(--st-muted);
  font-size: .8125rem;
}

:is(.st-sum, .st-receipt) dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px 5px;
  margin: 0;
  color: var(--st-text);
  font: 400 1.0625rem var(--font-numeral);
  text-align: right;
}

.st-sum dt span { color: var(--st-text); }
.st-sum .st-coin,
.st-receipt .st-coin { width: 15px; height: 15px; }

.st-receipt__sub {
  flex-basis: 100%;
  color: var(--st-muted);
  font: .75rem var(--font-body);
}

.st-why {
  color: #FFB8AD;
  font-size: .875rem;
  font-weight: 600;
}

.st-note {
  color: var(--st-muted);
  font-size: .8125rem;
  line-height: 1.45;
}

.st-note a { color: var(--gold-hover); }

.st-buy .button {
  min-height: 2.5rem;
  font-size: 1.125rem;
}

.st-buy .button:disabled,
.st-buy .button[aria-disabled='true'] {
  opacity: .5;
  filter: grayscale(.5);
  cursor: not-allowed;
}

.st-confirm__title {
  color: var(--st-text);
  font: 400 1.125rem var(--font-heading);
}

.st-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.st-actions .button { padding-inline: 1rem; }

.st-outcome {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid;
  border-left-width: 4px;
  border-radius: 8px;
  font-size: .875rem;
  line-height: 1.45;
}

.st-outcome__title {
  color: var(--st-text);
  font: 400 1.0625rem var(--font-heading);
}

.st-outcome--ok { border-color: #7CA88C; background: rgb(124 168 140 / 16%); }
.st-outcome--wait { border-color: var(--gold); background: rgb(199 153 75 / 14%); }
.st-outcome--error { border-color: #C46C76; background: rgb(196 108 118 / 18%); }
.st-outcome__action { justify-self: start; }

/* --- Phone dialog: the same detail, full screen --- */

.st-dialog {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, rgb(240 194 115 / 8%), transparent 60%),
    linear-gradient(180deg, #0E3D45, #061E24);
}

.st-dialog::backdrop { background: rgb(6 30 36 / 78%); }

.st-dialog__close {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  justify-content: flex-end;
  height: 0;
  margin: 0;
}

.st-dialog__close button {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: .5rem;
  padding: 0;
  border: 1px solid var(--st-line-strong);
  border-radius: 50%;
  color: var(--st-text);
  background: rgb(6 30 36 / 80%);
}

.st-dialog__close svg { width: 1rem; height: 1rem; }
.st-dialog__close button:hover { background: #0E3D45; }
.st-dialog .st-detail { padding-top: 24px; }

/* Tablet: the rail lies across the top, shelves in a row. */
@media (max-width: 60rem) {
  .store {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'rail'
      'toolbar'
      'results';
    row-gap: 1rem;
  }

  .st-rail {
    grid-template-columns: minmax(12rem, auto) minmax(0, 1fr);
    align-items: center;
    gap: .75rem 1.5rem;
  }

  .st-wallet h2 { padding-bottom: .35rem; font-size: 1.125rem; }
  .st-wallet__worlds { margin-top: .45rem; }

  .st-shelves ul {
    display: flex;
    align-items: center;
    gap: .4rem;
    overflow-x: auto;
    padding: 2px 2px 4px;
  }

  .st-shelf-group {
    flex: none;
    margin: 0;
    padding: 0 .1rem 0 .5rem;
    border-top: 0;
    border-left: 1px solid var(--gold-line);
  }

  .st-shelf,
  .st-shelf--nested {
    width: auto;
    min-height: 2.5rem;
    padding: .25rem .75rem;
    border-color: var(--gold-line);
    background: #FCF5E8;
    white-space: nowrap;
  }

  .st-shelf[aria-pressed='true'] { box-shadow: inset 0 -3px 0 var(--gold); }
}

/* Phone: the grid alone; the item opens in the dialog. */
@media (max-width: 47.9375rem) {
  .banner--store::after { background: rgb(6 36 44 / 55%); }
  .banner--store h1 { font-size: 2.25rem; }
  .banner--store .banner__copy { padding: 2.25rem 0; }
  .banner--store .ornament { width: min(16rem, 100%); }

  .store { width: calc(100% - 2 * var(--gutter)); }
  .st-rail { grid-template-columns: minmax(0, 1fr); }
  .st-wallet__worlds { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); column-gap: 1.25rem; }
  .st-toolbar { flex-wrap: wrap; gap: .75rem; }
  .st-search,
  .st-sort,
  .st-sort select { flex: 1 1 100%; width: 100%; }
  .st-toolbar :is(input, select) { min-height: 2.75rem; }

  .st-album {
    grid-template-columns: minmax(0, 1fr);
    background:
      radial-gradient(120% 80% at 50% -10%, rgb(240 194 115 / 8%), transparent 60%),
      linear-gradient(180deg, #0E3D45, #061E24);
  }

  .st-album__grid { padding: 14px 12px; border-right: 0; }
  .st-album__side { display: none; }
  .st-tiles { grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr)); gap: 14px 10px; }
  .st-dialog .st-desc { font-size: .9375rem; }
  .st-step,
  .st-ghost,
  .st-field :is(select, input) { min-height: 2.75rem; }
}

@media (forced-colors: active) {
  .st-plate,
  .st-dialog { border: 1px solid CanvasText; }
  .st-tile[aria-current] .st-plate { outline: 2px solid Highlight; }
  .st-shelf[aria-pressed='true'] { outline: 2px solid Highlight; }
}
