.market-page {
  max-width: 1060px;
  margin: 0 auto;
}

.market-back-link {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-muted);
  text-decoration: none;
}

.market-back-link:hover {
  text-decoration: underline;
}

.market-page h1 {
  margin: 0 0 6px;
}

.shop-intro {
  margin: 0 0 14px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.4;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

@media (max-width: 980px) {
  .shop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

.shop-card {
  position: relative;
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  padding: 14px 14px 12px;
  text-align: center;
  overflow: visible;
}

@media (max-width: 768px) {
  .shop-card {
    padding: 10px 10px 10px;
    border-radius: var(--r-md);
  }
}
/* =========================================
   Shop Item Icons — Match Inventory Exactly
========================================= */

.shop-item-image {
  width: 90px;
  height: 90px;
  margin: 0 auto 10px;

  background: var(--paper-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.shop-item-image img {
  max-width: 80px;
  max-height: 80px;

  width: auto !important;
  height: auto !important;

  object-fit: contain !important;
  display: block;
}

.shop-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-main);
  margin: 4px 0 0;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .shop-item-name {
    font-size: 13px;
    margin-top: 2px;
  }
}

.shop-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-muted);
}

@media (max-width: 768px) {
  .shop-meta-row {
    font-size: 11px;
    margin-top: 6px;
  }
}

.shop-price {
  font-weight: 600;
  color: var(--ink-main);
}

.shop-stock {
  font-style: italic;
  white-space: nowrap;
}

.shop-buy-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

@media (max-width: 768px) {
  .shop-buy-row {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
  }
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  justify-content: center;
}

.qty-stepper button {
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-main);
  cursor: pointer;
}

.qty-stepper button:disabled {
  opacity: 0.45;
  cursor: default;
}

.shop-qty {
  width: 28px;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--ink-main);
  font-size: 13px;
  padding: 0;
}

.shop-button {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: var(--moss);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--r-md);
  padding: 10px 10px;
  cursor: pointer;
  width: 100%;
  box-shadow: none;
  transform: none;
}

.shop-button:hover {
  background: var(--moss-deep);
}

.shop-button:disabled,
.shop-button[disabled] {
  opacity: 0.55;
  cursor: default;
}

.shop-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: var(--paper-1);
  color: var(--ink-main);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 50;
}

.shop-card:hover .shop-tooltip {
  opacity: 1;
}

.shop-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.shop-tooltip p {
  margin: 0;
  color: var(--ink-muted);
}

.shop-tooltip .tooltip-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

/* =========================================================
   Forest Fawns — Shop Cart (Canonical Reset)
   Scope:
   - Cart content styles (shared)
   - Desktop HUD trigger
   - Desktop slide-in panel
   - Mobile fully disabled here (mobile cart handled elsewhere)
========================================================= */

/* ===============================
   CART CONTENT (SHARED)
=============================== */

.shop-cart {
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  padding: 14px;
}

.shop-cart .cart-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink-main);
}

.shop-cart .cart-items {
  display: flex;
  flex-direction: column;
  gap: 8px;

  background: var(--paper-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 8px;
}

.shop-cart .cart-empty {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
}

.shop-cart .cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;

  background: var(--paper-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: 8px 10px;
}

.shop-cart .cart-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-main);
}

.shop-cart .cart-item-qty {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.shop-cart .cart-controls {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.shop-cart .cart-controls button {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
}

.shop-cart .cart-controls button:hover {
  color: var(--ink-main);
  text-decoration: underline;
}

.shop-cart .cart-summary {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.shop-cart .cart-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-main);
}

.shop-cart .cart-checkout {
  width: 100%;
  background: var(--moss);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.shop-cart .cart-checkout:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ===============================
   DESKTOP CART HUD (TRIGGER)
=============================== */

@media (min-width: 901px) {

  .shop-cart-hud-wrap {
    position: sticky;
    top: 12px;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
  }

  .shop-cart-hud {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;

    border-radius: 999px;
    border: 1px solid rgba(47,58,47,.16);
    background: linear-gradient(
      180deg,
      rgba(246,242,231,.92),
      rgba(235,228,212,.72)
    );

    box-shadow: 0 10px 18px rgba(0,0,0,.10);
    cursor: pointer;
    user-select: none;
  }

  .shop-cart-hud:active {
    transform: translateY(1px);
  }

  .shop-cart-hud-count {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;

    border: 1px solid rgba(47,58,47,.16);
    background: rgba(90,111,72,.12);
    color: #3f4a32;

    font-weight: 800;
    font-size: 12px;
    flex: none;
  }

  .shop-cart-hud-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    text-align: left;
  }

  .shop-cart-hud-label {
    font-size: 11px;
    color: #5a655a;
    letter-spacing: .2px;
  }

  .shop-cart-hud-total {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shop-cart-hud-chev {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;

    border-radius: 8px;
    border: 1px solid rgba(47,58,47,.16);
    background: rgba(47,58,47,.04);
    flex: none;
  }
}

/* ===============================
   DESKTOP SLIDE-IN PANEL
=============================== */

@media (min-width: 901px) {

  /* Forest Fawns header height */
  :root {
    --ff-header-height: 96px;
  }

  .desktop-cart-panel {
    position: fixed;
    top: var(--ff-header-height);
    right: 0;

    width: 360px;
    max-width: 90vw;
    height: calc(100vh - var(--ff-header-height));

    background: var(--panel-bg);
    border-left: 1px solid var(--panel-border);

    transform: translateX(100%);
    transition: transform 0.25s ease;

    z-index: 30;

    display: flex;
    flex-direction: column;
  }

  .desktop-cart-panel.is-open {
    transform: translateX(0);
  }

  .desktop-cart-inner {
    padding: 20px;
    overflow-y: auto;
    height: 100%;
  }

  .desktop-cart-backdrop {
    position: fixed;
    inset: 0;
    top: var(--ff-header-height);

    background: rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;

    z-index: 25;
  }

  .desktop-cart-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ===============================
   HARD MOBILE CUTOFF
=============================== */

@media (max-width: 900px) {
  .shop-cart-hud-wrap,
  .desktop-cart-panel,
  .desktop-cart-backdrop {
    display: none !important;
  }
}
@media (min-width: 901px) {
  .desktop-cart-panel {
    top: 0;
    height: 100vh;
  }

  .desktop-cart-backdrop {
    top: 0;
    height: 100vh;
  }
}
/* ==================================================
   Shop Buy Row — Desktop Polish
================================================== */
@media (min-width: 901px) {

  .shop-buy-row {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .qty-stepper {
    display: inline-flex;
    align-items: center;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 2px;
  }

  .qty-stepper button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 16px;
    line-height: 1;
    color: var(--ink-muted);
    cursor: pointer;
    border-radius: 999px;
  }

  .qty-stepper button:hover {
    background: var(--paper-3);
    color: var(--ink-main);
  }

  .qty-stepper input.shop-qty {
    width: 28px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-main);
    pointer-events: none;
  }
}
/* ==================================================
   Shop Buy Row — Desktop FINAL OVERRIDE
================================================== */
@media (min-width: 901px) {

  .market-page .shop-card .shop-buy-row {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  /* STEP PER */
  .market-page .shop-card .qty-stepper {
    display: inline-flex;
    align-items: center;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 2px 6px;
    flex: none;
  }

  .market-page .shop-card .qty-stepper button {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--ink-muted);
    cursor: pointer;
    border-radius: 999px;
  }

  .market-page .shop-card .qty-stepper button:hover {
    background: var(--paper-3);
    color: var(--ink-main);
  }

  .market-page .shop-card .qty-stepper input.shop-qty {
    width: 26px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-main);
    pointer-events: none;
  }

  /* ADD TO CART */
  .market-page .shop-card .shop-button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--r-md);
    background: var(--moss);
    color: #fff;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex: none;
  }

  .market-page .shop-card .shop-button:hover {
    background: #5f7446;
  }

  .market-page .shop-card .shop-button:active {
    transform: translateY(1px);
  }
}
/* ==================================================
   Shop Buy Row — Desktop Stack Fix
================================================== */
@media (min-width: 901px) {

  .market-page .shop-card .shop-buy-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  /* Qty stepper centered */
  .market-page .shop-card .qty-stepper {
    justify-content: center;
    margin: 0 auto;
  }

  /* Button fills card safely */
  .market-page .shop-card .shop-button {
    width: 100%;
    padding: 9px 0;
    text-align: center;
  }
}
/* ==================================================
   Shop Cards — Desktop Tightening Pass
================================================== */

@media (min-width: 901px) {

  .shop-card {
    padding: 14px 14px 12px;
  }

  /* Item name */
  .shop-item-name {
    font-size: 14px;
    margin-bottom: 4px;
  }

  /* Price / stock row */
  .shop-meta-row {
    margin-bottom: 6px;
    font-size: 12px;
  }

  /* Buy row */
  .shop-buy-row {
    gap: 8px;
  }

  /* Quantity stepper */
  .qty-stepper {
    height: 32px;
  }

  .qty-stepper button {
    width: 28px;
    height: 28px;
  }

  /* Add to cart button */
  .shop-button {
    height: 34px;
    font-size: 13px;
    padding: 0 14px;
  }
}
/* ==================================================
   Desktop Shop Cart HUD — Token Style (FINAL)
================================================== */

@media (min-width: 901px) {

  .shop-cart-hud {
    background: var(--moss);
    color: #fff;
    border: none;
    box-shadow: 0 10px 20px rgba(47, 58, 47, 0.35);
    padding: 10px 14px;
    gap: 10px;
  }

  .shop-cart-hud:hover {
    background: #5a6f48;
  }

  .shop-cart-hud:active {
    transform: translateY(1px);
  }

  /* Count bubble */
  .shop-cart-hud-count {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-weight: 700;
  }

  /* Label: primary action */
  .shop-cart-hud-label {
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
  }

  /* Total: secondary info */
  .shop-cart-hud-total {
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
    line-height: 1.1;
  }

  /* Icon */
  .shop-cart-hud-icon {
    font-size: 16px;
    line-height: 1;
    margin-left: 4px;
    opacity: 0.95;
  }
}
/* ==================================================
   Desktop Shop Cart HUD — Subtext (white + smaller)
   (keeps "Shopping Basket" unchanged)
================================================== */

@media (min-width: 901px) {

  /* if your subtext is .shop-cart-hud-sub */
  .shop-cart-hud-sub {
    color: rgba(255,255,255,0.88);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.1;
    margin-top: 2px;
    white-space: nowrap;
  }

  /* If your subtext is the second line inside .shop-cart-hud-meta,
     this keeps it white + small without changing the label */
  .shop-cart-hud-meta .shop-cart-hud-total {
    color: rgba(255,255,255,0.92);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.1;
  }

  /* Optional: keep the total + subtext from stretching the pill */
  .shop-cart-hud-meta {
    min-width: 0;
  }

  .shop-cart-hud-meta span {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.shop-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.shop-header-left {
  max-width: 620px;
}

.shop-header-right {
  flex-shrink: 0;
}
