/* Components: buttons, chips, badges, inputs, product cards, dialogs, drawer, toast */

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--c-surface-2);
  --btn-fg: var(--c-text);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; max-inline-size: 100%; padding: .55rem 24px; border: 0; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; font-size: .975rem; line-height: 1.25; letter-spacing: .005em; text-decoration: none; text-align: center; text-wrap: balance;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-base) var(--ease-out), background-color var(--t-base), opacity var(--t-base);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn--primary {
  --btn-fg: #fff;
  background: linear-gradient(180deg, var(--c-btn), var(--c-btn-2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), var(--glow-pink);
}
.btn--primary:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 14px 34px -10px rgba(234, 91, 154, .8); }
.btn--ghost { --btn-bg: transparent; box-shadow: inset 0 0 0 1px rgba(249, 242, 252, .28); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1px rgba(249, 242, 252, .6); background: rgba(249,242,252,.04); }
.btn--gold {
  --btn-fg: #2a1a05;
  background: linear-gradient(180deg, var(--c-gold-2), var(--c-gold) 55%, #d4ac5f);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), var(--glow-gold);
}
.btn--gold:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 18px 44px -16px rgba(232, 199, 126, .75); }
.btn--sm { min-height: 44px; padding: .45rem 18px; font-size: .9rem; }
.btn--block { width: 100%; padding-block: 10px; }
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin 700ms linear infinite;
}
@keyframes spin { to { rotate: 1turn; } }
.btn svg { width: 18px; height: 18px; flex: none; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0;
  border-radius: 50%; background: rgba(249,242,252,.06); color: var(--c-text);
  transition: background-color var(--t-base), transform var(--t-fast) var(--ease-out);
}
.icon-btn:hover { background: rgba(249,242,252,.12); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
.count-badge {
  position: absolute; top: -2px; inset-inline-end: -2px; min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center; border-radius: var(--r-pill);
  background: var(--c-pink); color: #100a1e; font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 2px var(--c-bg);
}
.count-badge.bump { animation: bump 380ms var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.3); } }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; max-inline-size: 100%; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere;
  background: rgba(249,242,252,.08); color: var(--c-text-2);
}
.badge svg { width: 14px; height: 14px; flex: none; }
.badge--pink { background: rgba(234, 91, 154, .16); color: #ff9cc6; }
.badge--cyan { background: rgba(120, 221, 235, .14); color: var(--c-cyan); }
.badge--gold { background: rgba(232, 199, 126, .16); color: var(--c-gold); }
.badge--solid-gold { background: linear-gradient(180deg, var(--c-gold-2), var(--c-gold)); color: #2a1a05; }
.badge--warn { background: rgba(241, 174, 90, .16); color: #ffd19a; }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 8px; }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.input {
  width: 100%; min-height: 48px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--c-border);
  background: rgba(16, 10, 30, .6); color: var(--c-text);
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.input::placeholder { color: #8e7fa0; }
.input:focus { outline: none; border-color: var(--c-cyan); box-shadow: 0 0 0 3px rgba(120, 221, 235, .2); }
.input[aria-invalid="true"] { border-color: var(--c-danger); }
.field-hint { font-size: var(--fs-xs); color: var(--c-text-3); }
.field-error { font-size: var(--fs-sm); color: var(--c-danger); min-height: 1.2em; }

/* ---------- Product card: the currency shop packs (shards, tokens, wishes) live in sections.css "Currency shop" ---------- */
.price { font-weight: 800; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.price s { margin-inline-start: 6px; font-weight: 500; font-size: .875rem; color: var(--c-text-3); }

.add-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; max-inline-size: 100%; padding: 6px 14px;
  border: 0; border-radius: var(--r-pill); background: rgba(249,242,252,.08); color: var(--c-text); font-weight: 700; font-size: .875rem; line-height: 1.2; text-align: center;
  transition: background-color var(--t-base), color var(--t-base), transform var(--t-fast) var(--ease-out);
}
.add-btn:hover { background: var(--c-btn); color: #fff; }
.add-btn:active { transform: scale(.95); }
.add-btn svg { width: 18px; height: 18px; }
.add-btn.is-added { background: var(--c-success); color: #0f2a1d; }
.add-btn:disabled { opacity: .45; cursor: not-allowed; background: rgba(249,242,252,.06); color: var(--c-text-2); }

/* ---------- Dialog (native <dialog>) ---------- */
.dialog {
  width: min(680px, calc(100% - 24px)); max-height: min(92svh, 900px); padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--c-bg-2); color: var(--c-text); box-shadow: var(--shadow-3), inset 0 0 0 1px var(--c-border-soft);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: dialogIn var(--t-slow) var(--ease-out); }
.dialog::backdrop { background: rgba(8, 4, 16, .72); backdrop-filter: blur(6px); animation: fadeIn var(--t-base); }
@keyframes dialogIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fadeIn { from { opacity: 0; } }
.dialog__scroll { overflow-y: auto; overscroll-behavior: contain; }
.dialog__close { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 3; background: rgba(16,10,30,.7); backdrop-filter: blur(8px); }
.dialog__body { display: grid; gap: var(--s-5); padding: clamp(20px, 4vw, 36px); }
.dialog--wide { width: min(980px, calc(100% - 24px)); }
@media (max-width: 640px) {
  .dialog { width: 100%; max-width: 100%; max-height: 94svh; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .dialog[open] { animation: sheetIn var(--t-slow) var(--ease-out); }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
}

/* ---------- Drawer (cart / mobile menu) ---------- */
.drawer { position: fixed; inset: 0; z-index: var(--z-drawer); }
.drawer__scrim { position: absolute; inset: 0; background: rgba(8, 4, 16, .66); backdrop-filter: blur(4px); animation: fadeIn var(--t-base); }
.drawer__panel {
  position: absolute; top: 0; inset-inline-end: 0; bottom: 0; width: min(440px, 100%);
  display: flex; flex-direction: column; background: var(--c-bg-2);
  box-shadow: calc(-30px * var(--dir-x)) 0 80px rgba(5,2,12,.6), inset calc(1px * var(--dir-x)) 0 0 var(--c-border-soft);
  padding-bottom: env(safe-area-inset-bottom);
  animation: drawerIn var(--t-slow) var(--ease-out);
}
@keyframes drawerIn { from { transform: translateX(calc(100% * var(--dir-x))); } }
.drawer__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--c-border-soft); }
.drawer__title { font-family: var(--f-display); font-weight: 500; font-size: 1.25rem; }
.drawer__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; }
.drawer__foot { padding: 16px 20px 20px; border-top: 1px solid var(--c-border-soft); display: grid; gap: 12px; }

/* ---------- Toast ---------- */
.toast-region { position: fixed; z-index: var(--z-toast); left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); translate: -50% 0; display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md);
  background: rgba(48, 32, 67, .96); backdrop-filter: blur(10px); box-shadow: var(--shadow-3), inset 0 0 0 1px var(--c-border-soft);
  font-weight: 600; pointer-events: auto; animation: toastIn var(--t-slow) var(--ease-out);
}
.toast--error { box-shadow: var(--shadow-3), inset 0 0 0 1px rgba(241, 114, 134, .5); }
.toast--success { box-shadow: var(--shadow-3), inset 0 0 0 1px rgba(140, 214, 176, .45); }
.toast__icon { width: 22px; height: 22px; flex: none; }
.toast__icon--success { color: var(--c-success); }
.toast__icon--error { color: var(--c-danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Notice (honest "not available yet" states) ---------- */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sm);
  background: rgba(155, 121, 213, .1); box-shadow: inset 0 0 0 1px rgba(155, 121, 213, .28); color: var(--c-text-2); font-size: var(--fs-sm);
}
.notice svg { width: 20px; height: 20px; flex: none; color: var(--c-lavender); margin-top: 1px; }
.notice--gold { background: rgba(232, 199, 126, .08); box-shadow: inset 0 0 0 1px rgba(232, 199, 126, .28); }
.notice--gold svg { color: var(--c-gold); }
.notice b { color: var(--c-text); }

/* Sign in with the game: QR code (computers) or a game link (phones) above the player ID form */
.game-login { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); justify-items: center; text-align: center; }
.game-login__title { font-size: var(--fs-md); }
.game-login__qr {
  display: grid; place-items: center; inline-size: min(13rem, 100%); aspect-ratio: 1;
  border-radius: var(--r-sm); background: #fff; overflow: hidden;
  transition: opacity var(--t-base);
}
.game-login__qr svg { inline-size: 100%; block-size: 100%; }
.game-login__qr.is-stale { opacity: .25; }
.game-login .field-error:empty { display: none; }
.or-sep { display: flex; align-items: center; gap: var(--s-3); color: var(--c-text-3); font-size: var(--fs-sm); }
.or-sep::before, .or-sep::after { content: ""; flex: 1; border-block-start: 1px solid var(--c-border); }

/* Account: purchases made on this site */
.purchases { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.purchases__title { font-size: var(--fs-md); }
.purchases .orders__list { margin-top: 0; }
.purchases__scope { font-size: var(--fs-sm); }
