/* 토큰 가게 🏪 — 버터 모닝 스킨, 자판기/상점 무드 */
/* 실물 코너는 "자판기 배출구" 연출: 사면 코드 모달이 툭 떨어짐 */
@import url('style.css');

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 내 지갑 -------------------------------------------------------------------*/
.ts-wallet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, var(--olive-bg), var(--cream));
  border: 2px solid var(--bm-line);
  border-radius: var(--r-card);
  padding: 16px 20px;
  box-shadow: var(--sh-strong);
}

.ts-wallet-label {
  font-size: 0.85rem;
  color: var(--text-sec);
  font-weight: 700;
}

.ts-wallet-balance {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--color-text);
}

.ts-wallet-bank {
  text-align: center;
  text-decoration: none;
  background: var(--color-surface);
  border: 2px solid var(--bm-line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--color-text);
  transition: transform var(--transition), box-shadow var(--transition);
}
.ts-wallet-bank span {
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-sec);
}
.ts-wallet-bank:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px var(--color-shadow);
}

/* 비로그인 ------------------------------------------------------------------*/
.ts-login-needed {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--r-card);
  padding: 24px;
  text-align: center;
  font-weight: 700;
}
.ts-login-sub { color: var(--text-sec); font-weight: 500; font-size: 0.9rem; margin: 6px 0 12px; }
.ts-home-btn {
  display: inline-block;
  background: var(--olive);
  color: #fff;
  text-decoration: none;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

/* 섹션 ----------------------------------------------------------------------*/
.ts-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0 0 4px;
}
.ts-month {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--purple);
  background: var(--purple-bg);
  border-radius: 999px;
  padding: 2px 10px;
  vertical-align: middle;
}
.ts-section-desc {
  font-size: 0.85rem;
  color: var(--text-sec);
  margin: 0 0 12px;
}

.ts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.ts-loading, .ts-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  padding: 18px 0;
}

/* 상품 카드 -----------------------------------------------------------------*/
.ts-card {
  background: var(--color-surface);
  border: 2px solid var(--bm-line);
  border-radius: var(--r-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}
.ts-card:not(.ts-card-soldout):hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px var(--color-shadow-heavy);
}

.ts-card-emoji { font-size: 2rem; line-height: 1; }
.ts-card-name { font-weight: 800; color: var(--color-text); }
.ts-card-desc { font-size: 0.82rem; color: var(--text-sec); flex: 1; }
.ts-card-meta { font-size: 0.75rem; color: var(--muted); font-weight: 600; }

.ts-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.ts-card-price { font-weight: 800; color: var(--olive-d); }
[data-theme="dark"] .ts-card-price { color: var(--olive-l); }

.ts-buy-btn {
  border: none;
  background: var(--olive);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background var(--transition);
}
.ts-buy-btn:hover { background: var(--olive-d); transform: scale(1.05); }
.ts-buy-btn:disabled { background: var(--muted); cursor: not-allowed; transform: none; }

.ts-equip-btn {
  border: 2px solid var(--purple);
  background: transparent;
  color: var(--purple);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.ts-equip-btn.equipped {
  background: var(--purple);
  color: #fff;
}

/* 품절/판매완료 */
.ts-card-soldout { opacity: 0.75; }
.ts-card-soldout .ts-card-emoji { filter: grayscale(0.7); }
.ts-sold-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  transform: rotate(6deg);
}
.ts-sold-owner {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--purple);
}

/* 보유 뱃지 (아이템/칭호) */
.ts-owned-badge {
  display: inline-block;
  background: var(--olive-bg);
  color: var(--olive-d);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
[data-theme="dark"] .ts-owned-badge { background: rgba(163, 173, 122, 0.2); color: var(--olive-l); }

/* 내 코드함 -----------------------------------------------------------------*/
.ts-codebox {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ts-code-item {
  background: var(--color-surface);
  border: 2px dashed var(--olive-l);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ts-code-item-name { font-weight: 800; flex: 1; min-width: 120px; }
.ts-code-item-date { font-size: 0.75rem; color: var(--muted); }
.ts-code-value {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--yellow-l);
  border-radius: 8px;
  padding: 6px 10px;
  user-select: all;
  word-break: break-all;
}
[data-theme="dark"] .ts-code-value { background: rgba(243, 227, 162, 0.15); }

/* 모달 ----------------------------------------------------------------------*/
.ts-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(40, 32, 12, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.ts-modal {
  background: var(--color-surface);
  border: 2px solid var(--bm-line);
  border-radius: var(--r-card);
  padding: 26px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.25);
  animation: tsModalPop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes tsModalPop {
  from { transform: translateY(14px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.ts-modal-emoji { font-size: 2.6rem; }
.ts-modal-title { margin: 8px 0 4px; font-size: 1.15rem; font-weight: 800; color: var(--color-text); }
.ts-modal-desc { font-size: 0.88rem; color: var(--text-sec); margin: 0 0 6px; }
.ts-modal-price { font-weight: 800; color: var(--olive-d); margin: 0 0 14px; }
[data-theme="dark"] .ts-modal-price { color: var(--olive-l); }

.ts-modal-actions { display: flex; gap: 10px; justify-content: center; }
.ts-btn {
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
}
.ts-btn-primary { background: var(--olive); color: #fff; }
.ts-btn-primary:hover { background: var(--olive-d); }
.ts-btn-primary:disabled { background: var(--muted); cursor: wait; }
.ts-btn-ghost {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--text-sec);
}
.ts-modal-error { color: var(--red); font-weight: 700; font-size: 0.85rem; margin: 12px 0 0; }

/* 코드 공개 모달 — 자판기 배출구 */
.ts-code-display {
  font-family: 'Courier New', monospace;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--yellow-l);
  border: 2px dashed var(--olive);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 12px 0 16px;
  user-select: all;
  word-break: break-all;
  animation: tsCodeDrop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) 0.15s backwards;
}
[data-theme="dark"] .ts-code-display { background: rgba(243, 227, 162, 0.12); }
@keyframes tsCodeDrop {
  from { transform: translateY(-18px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 480px) {
  .ts-grid { grid-template-columns: 1fr 1fr; }
}
