/* Playmat cosmetics — shop hub tiles, deck picker, custom board mats. */

:root{
  --my-playmat-brightness:1;
  --opp-playmat-brightness:1;
}

/* Custom mats: rounded frame corners only (default board geometry unchanged). */
.playmat-frame.has-custom-playmat{
  border-radius:14px;
  overflow:hidden;
}
.playmat-frame.has-custom-playmat .playmat-img{
  border-radius:inherit;
}

/*
 * Portrait shell hides .playmat-img (display:none). Paint equipped mats on a
 * ::before layer using the CSS vars set by playmats.js applySeatPlaymat.
 * Keep filter on the layer only so cards/zones are not dimmed.
 */
html.tcg-portrait-play.has-my-playmat #screen-game .my-mat.playmat-frame::before,
html.tcg-portrait-play #screen-game.has-my-playmat .my-mat.playmat-frame::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  border-radius:inherit;
  background-image:var(--my-playmat-image);
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  filter:brightness(var(--my-playmat-brightness, 1));
}
html.tcg-portrait-play.has-opp-playmat #screen-game .opp-mat.playmat-frame::before,
html.tcg-portrait-play #screen-game.has-opp-playmat .opp-mat.playmat-frame::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  border-radius:inherit;
  background-image:var(--opp-playmat-image);
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  filter:brightness(var(--opp-playmat-brightness, 1));
}
html.tcg-portrait-play #screen-game .playmat-frame > .playmat-overlay,
html.tcg-portrait-play #screen-game .playmat-frame > .mat-owner-label{
  z-index:1;
}

/* Shop hub — thin sleeve tile + wide playmat tile (match art aspect) */
.shop-hub-grid{
  display:grid;
  grid-template-columns:minmax(132px,180px) minmax(0,1fr);
  gap:18px;
  margin-top:18px;
  max-width:820px;
  align-items:stretch;
}
.shop-hub-tile{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:10px;
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(8,14,28,.55);
  cursor:pointer;
  color:inherit;
  text-align:left;
  min-height:0;
  transition:border-color .15s ease, transform .15s ease, background .15s ease;
}
.shop-hub-tile:hover,
.shop-hub-tile:focus-visible{
  border-color:rgba(255,180,210,.55);
  background:rgba(18,24,42,.72);
  outline:none;
  transform:translateY(-1px);
}
.shop-hub-tile__art{
  width:100%;
  border-radius:12px;
  background:#111 center/cover no-repeat;
  box-shadow:0 8px 22px rgba(0,0,0,.4);
}
.shop-hub-tile--sleeve{
  align-items:center;
  text-align:center;
}
.shop-hub-tile--sleeve .shop-hub-tile__art{
  width:100%;
  max-width:148px;
  aspect-ratio:63 / 88;
  margin-inline:auto;
}
.shop-hub-tile--playmat .shop-hub-tile__art,
.shop-hub-tile__art.is-playmat{
  aspect-ratio:1024 / 563;
  width:100%;
  background-size:cover;
}
.shop-hub-tile__label{
  font-size:16px;
  font-weight:800;
  letter-spacing:.02em;
}
.shop-hub-tile__sub{
  font-size:12px;
  opacity:.72;
  line-height:1.35;
}
@media (max-width:640px){
  .shop-hub-grid{
    grid-template-columns:1fr;
    max-width:420px;
    margin-inline:auto;
  }
  .shop-hub-tile--sleeve .shop-hub-tile__art{
    max-width:160px;
  }
}

/* Reuse sleeve-shop layout classes with playmat aspect tweaks */
#playmat-shop-grid.sleeve-shop-grid,
#playmat-shop-grid{
  grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
  gap:16px;
}
.playmat-shop-tile__art,
.sleeve-shop-tile__art.is-playmat{
  aspect-ratio:1024 / 563 !important;
  max-width:100% !important;
  width:100%;
  border-radius:8px;
  cursor:zoom-in;
}
#screen-playmat-shop .sleeve-shop-hover-panel{
  flex-basis:min(360px,38vw);
  width:min(360px,38vw);
  max-width:420px;
}
.sleeve-shop-hover-panel .hc-img.is-playmat{
  aspect-ratio:1024 / 563;
  max-width:100%;
  width:100%;
  object-fit:cover;
  cursor:zoom-in;
}
@media (max-width:980px){
  #screen-playmat-shop .sleeve-shop-hover-panel{
    flex-basis:280px;width:280px;
  }
}
@media (max-width:640px){
  #playmat-shop-grid.sleeve-shop-grid,
  #playmat-shop-grid{
    grid-template-columns:repeat(auto-fill,minmax(168px,1fr));
    gap:12px;
  }
}

/* Full-size playmat preview (click thumbnail → tap/click to close) */
.playmat-shop-lightbox{
  display:none;
  position:fixed;
  inset:0;
  z-index:9900;
  align-items:center;
  justify-content:center;
  padding:max(16px,env(safe-area-inset-top,0px)) 16px max(16px,env(safe-area-inset-bottom,0px));
  box-sizing:border-box;
  background:rgba(4,10,24,.92);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  cursor:zoom-out;
  -webkit-tap-highlight-color:transparent;
}
.playmat-shop-lightbox.open{display:flex}
.playmat-shop-lightbox__frame{
  width:min(1100px,96vw);
  max-height:min(88vh,620px);
  aspect-ratio:1024 / 563;
  border-radius:14px;
  background:#111 center/contain no-repeat;
  box-shadow:0 18px 48px rgba(0,0,0,.55),0 0 0 1px rgba(255,255,255,.16);
  pointer-events:none;
}
body.playmat-shop-lightbox-open{overflow:hidden}

/* Deck builder playmat picker (beside sleeve) */
.deck-builder-meta__cosmetics{
  display:flex;
  flex-direction:column;
  flex-wrap:nowrap;
  gap:10px;
  align-items:flex-start;
}
.deck-builder-meta__sleeve,
.deck-builder-meta__playmat{
  min-width:0;
  flex:0 0 auto;
  width:auto;
}
.deck-builder-meta__playmat .deck-builder-hint--compact{
  display:none;
}
#screen-deck .deck-builder-meta__playmat #deck-playmat-empty-hint:not([hidden]){
  display:block;
}
.deck-playmat-picker{display:block}
.deck-playmat-current{
  display:inline-flex;align-items:center;justify-content:center;
  width:auto;max-width:100%;padding:6px;border-radius:10px;
  border:1px solid rgba(255,255,255,.28);background:rgba(0,0,0,.22);
  color:inherit;cursor:pointer;
}
.deck-playmat-current:hover{border-color:rgba(255,200,220,.45);background:rgba(0,0,0,.3)}
.deck-playmat-current__art{
  width:96px;height:auto;aspect-ratio:1024/563;border-radius:6px;flex:0 0 auto;
  background:#111 center/cover no-repeat;box-shadow:0 2px 8px rgba(0,0,0,.35);
}
.deck-playmat-current__art--none{opacity:.85}
.deck-playmat-current__meta,
.deck-playmat-current__name,
.deck-playmat-current__hint{display:none}

.deck-playmat-overlay .deck-sleeve-overlay__shell,
.deck-playmat-overlay__shell{
  width:min(720px,94vw);
  max-height:min(88vh,820px);
  display:flex;flex-direction:column;gap:10px;
  padding:14px 16px 16px;border-radius:16px;
  background:rgba(10,16,30,.96);border:1px solid rgba(255,255,255,.14);
  box-shadow:0 18px 48px rgba(0,0,0,.5);
}
.deck-playmat-overlay__preview{
  width:100%;aspect-ratio:1024/563;border-radius:10px;
  background:#111 center/cover no-repeat;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);
}
.deck-playmat-overlay__brightness{
  display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;
  font-size:13px;
}
.deck-playmat-overlay__brightness input[type="range"]{
  flex:1 1 180px;min-width:140px;
}
.deck-playmat-overlay__actions{
  display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;
}
.deck-playmat-overlay__grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));
  gap:10px;overflow:auto;max-height:min(42vh,360px);padding:2px;
}
.deck-playmat-tile{
  display:flex;flex-direction:column;gap:6px;padding:8px;border-radius:10px;
  border:1px solid rgba(255,255,255,.12);background:rgba(0,0,0,.2);
  color:inherit;cursor:pointer;text-align:left;
}
.deck-playmat-tile.is-selected{
  border-color:rgba(255,180,210,.65);
  box-shadow:0 0 0 1px rgba(255,180,210,.35);
}
.deck-playmat-tile__art{
  width:100%;aspect-ratio:1024/563;border-radius:6px;
  background:#111 center/cover no-repeat;
}
.deck-playmat-tile__label{
  font-size:11px;font-weight:700;line-height:1.25;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
}
