.shop-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

/* ===== Shop & Inventory ===== */

/* Modal sizing */
.shop-modal-inner {
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}

/* Coins bar */
.shop-coins-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.shop-coins-icon { font-size: 20px; }
.shop-coins-val { 
  color: var(--gold); 
  font-size: 17px; 
  font-weight: 700; 
}
.shop-coins-label { 
  color: var(--muted); 
  font-weight: 400; 
  font-size: 13px; 
}

/* Tabs */
.shop-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  flex-shrink: 0;
}
.shop-tab {
  flex: 1;
  padding: 12px 0;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.shop-tab:hover { color: var(--text); }
.shop-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Body */
.shop-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
}
.shop-tab-content { display: none; }
.shop-tab-content.active { display: block; }

/* Loading */
.shop-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Empty state */
.shop-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  padding: 50px 20px;
  line-height: 1.5;
}

/* Series header */
.shop-series { margin-bottom: 24px; }
.shop-series-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 10px;
  padding-left: 2px;
}

/* Tag grid */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* Tag card */
.shop-tag-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  text-align: center;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.shop-tag-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.shop-tag-card.equipped {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Disabled state */
.shop-tag-card button:disabled,
.shop-tag-card button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Icon */
.shop-tag-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border-radius: 10px;
}
.shop-tag-icon img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

/* Hover bounce */
@keyframes tag-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-6px) scale(1.08); }
  70% { transform: translateY(-2px) scale(0.97); }
}
.shop-tag-card:hover .shop-tag-icon img {
  animation: tag-bounce 0.7s ease;
}

/* Text */
.shop-tag-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-tag-price {
  font-size: 11.5px;
  color: var(--muted);
}
.shop-tag-card.equipped .shop-tag-price {
  color: var(--accent);
  font-weight: 500;
}

.shop-tag-actions {
  width: 100%;
  margin-top: 4px;
}
.shop-tag-actions button {
  font-size: 11px;
  padding: 5px 6px;
  min-width: 0;
  white-space: nowrap;
}
.shop-tag-actions > div:not(.shop-actions-row) {
  display: flex;
  gap: 4px;
  width: 100%;
}

/* Sidebar button */
.sidebar-shop-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ===== Tag badge in different places ===== */
/* The badge sits OUTSIDE the avatar circle, at its top-right corner, so the
   avatar containers must NOT clip it (overflow must be visible on the wrap,
   while the inner <img>/letter keep their own rounding). */
.room-avatar,
.chat-head-avatar,
.me-avatar-wrap,
.profile-avatar-wrap {
  position: relative;
  overflow: visible;
}
.room-tag-badge,
.chat-head-tag-badge,
.my-tag-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  z-index: 10;
  pointer-events: none;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  display: grid;
  place-items: center;
  padding: 2px;
}
.room-tag-badge img,
.chat-head-tag-badge img,
.my-tag-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ===== Tag preview full-screen ===== */
.tag-preview-full {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--preview-bg);
  z-index: 9999;
  backdrop-filter: blur(8px);
}
.tag-preview-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}
.tag-preview-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.tag-preview-avatar-wrap {
  position: relative;
  width: 148px;
  height: 148px;
}
.tag-preview-avatar {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 4px solid var(--border-strong);
}
.tag-preview-avatar-text {
  display: grid;
  place-items: center;
  font-size: 58px;
  font-weight: 700;
  color: var(--preview-muted);
}
.tag-preview-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.4));
  animation: tag-bounce 1.2s ease infinite;
}
.tag-preview-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tag-preview-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--preview-text);
}
.tag-preview-series {
  font-size: 13px;
  color: var(--preview-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ===== Daily reward card ===== */
.shop-rewards { display: flex; flex-direction: column; gap: 4px; }
.shop-daily-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  margin-bottom: 24px;
}
.shop-daily-card.claimable {
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  background: color-mix(in srgb, var(--gold) 8%, var(--surface-2));
}
.shop-daily-card.claimed { opacity: 0.75; }
.shop-daily-icon { font-size: 34px; line-height: 1; flex-shrink: 0; }
.shop-daily-body { flex: 1; min-width: 0; }
.shop-daily-title { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.shop-daily-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.shop-daily-reward { color: var(--gold); font-weight: 700; }
.shop-daily-streak { color: var(--text-soft); }
.shop-daily-hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.35; }
.shop-daily-btn { flex-shrink: 0; padding: 10px 16px; font-size: 13px; }
.shop-daily-btn:disabled { opacity: 0.55; cursor: default; }

/* ===== Transaction history ===== */
.shop-history {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.shop-history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  background: var(--surface-2);
  font-size: 13px;
}
.shop-history-row.plus .shop-history-delta { color: var(--success); }
.shop-history-row.minus .shop-history-delta { color: var(--danger); }
.shop-history-delta { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 38px; }
.shop-history-reason { color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-history-date { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ===== Mobile ===== */
@media (max-width: 760px) {
  .shop-modal-inner {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    min-height: 100vh;
  }
  .shop-grid {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
  }
  .shop-body {
    padding: 16px;
  }
  .shop-daily-card { gap: 10px; padding: 14px; }
  .shop-daily-icon { font-size: 28px; }
}

/* Focus states */
.shop-tab:focus-visible,
.shop-tag-card:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .shop-tag-card:hover .shop-tag-icon img,
  .tag-preview-badge {
    animation: none;
  }
  .shop-tag-card:hover {
    transform: none;
  }
}
/* ===== V-Coin spinning icon ===== */
@keyframes vcoin-spin {
  0% { transform: perspective(60px) rotateY(0deg); }
  50% { transform: perspective(60px) rotateY(180deg); }
  100% { transform: perspective(60px) rotateY(360deg); }
}
.shop-coins-icon,
.vcoin-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7b0 0%, #ffd700 30%, #e6a800 60%, #ffd700 100%);
  box-shadow: 0 2px 6px rgba(200,150,0,0.4), inset 0 1px 1px rgba(255,255,255,0.5);
  font-size: 13px;
  font-weight: 900;
  color: #8b6914;
  flex-shrink: 0;
  animation: vcoin-spin 2.5s ease-in-out infinite;
  -webkit-animation: vcoin-spin 2.5s ease-in-out infinite;
}
.shop-coins-icon::after,
.vcoin-icon::after {
  content: 'V';
  font-family: 'SF Pro Display', 'Inter', system-ui, sans-serif;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255,255,200,0.6);
}
/* Stop spin on hover/focus for accessibility */
.shop-coins-icon:hover,
.vcoin-icon:hover {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .shop-coins-icon,
  .vcoin-icon {
    animation: none;
  }
}
