/* ============================================================
   HYPERTALE — Components
   ============================================================ */

/* ---------- Glass panel ---------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-lg);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--sh-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.glass-strong { background: var(--glass-bg-strong); }
.panel { padding: clamp(18px, 3vw, 28px); }

/* Sheen line along the top edge of glass cards */
.glass::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  opacity: 0.7;
  pointer-events: none;
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--bg-700);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--glass-brd-strong);
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease),
    filter var(--t-fast) var(--ease), background var(--t) var(--ease);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: var(--sh-md); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-fg: #04170a;
  background: linear-gradient(135deg, var(--green-bright), var(--green-deep));
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(var(--green-rgb), 0.32);
}
.btn-primary:hover { box-shadow: 0 12px 34px rgba(var(--green-rgb), 0.5); }

.btn-secondary {
  --btn-fg: #fff;
  background: linear-gradient(135deg, var(--purple-bright), var(--purple-deep));
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(var(--purple-rgb), 0.32);
}
.btn-secondary:hover { box-shadow: 0 12px 34px rgba(var(--purple-rgb), 0.5); }

.btn-ghost { background: rgba(255, 255, 255, 0.04); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); }

.btn-danger { --btn-fg: #fff; background: linear-gradient(135deg, var(--danger), var(--danger-deep)); border-color: transparent; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { padding: 15px 30px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; border-radius: var(--r-pill); }
.btn-icon svg { width: 19px; height: 19px; }

/* Link that looks like a button-less action */
.linklike {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--text-soft); font-weight: 600;
}
.linklike:hover { color: var(--green); }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-brd);
  color: var(--text-soft);
  white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip-green { background: rgba(var(--green-rgb), 0.14); border-color: rgba(var(--green-rgb), 0.35); color: var(--green); }
.chip-purple { background: rgba(var(--purple-rgb), 0.16); border-color: rgba(var(--purple-rgb), 0.4); color: var(--purple-bright); }
.chip-gold { background: rgba(var(--gold-rgb), 0.14); border-color: rgba(var(--gold-rgb), 0.4); color: var(--gold); }
.chip-danger { background: rgba(var(--danger-rgb), 0.14); border-color: rgba(var(--danger-rgb), 0.4); color: var(--danger); }
.chip-cyan { background: rgba(var(--cyan-rgb), 0.14); border-color: rgba(var(--cyan-rgb), 0.4); color: var(--cyan); }

.chip-dot::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 8px currentColor;
}

/* Thread tag chip — admin-defined color/icon, same chip shape as pinned/locked/hot */
.chip-tag {
  background: linear-gradient(135deg, var(--tag-from, rgba(255,255,255,0.1)), var(--tag-to, rgba(255,255,255,0.04)));
  border-color: transparent; color: #fff;
}
.chip-tag.chip-fx-glow { animation: tagGlow 2.4s ease-in-out infinite; }
.chip-tag.chip-fx-pulse { animation: rankPulse 1.8s ease-in-out infinite; }
.chip-tag.chip-fx-shimmer { position: relative; overflow: hidden; }
.chip-tag.chip-fx-shimmer::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  transform: translateX(-120%); animation: rankShimmer 2.6s linear infinite;
}
@keyframes tagGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 0 8px var(--tag-glow, rgba(255,255,255,0.3)); }
  50% { box-shadow: 0 0 0 1px rgba(255,255,255,0.22), 0 0 18px var(--tag-glow, rgba(255,255,255,0.3)); }
}

/* ---------- Styled hover tooltip (ranks, badges, level chip) ---------- */
.has-tip { position: relative; }
.has-tip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translate(-50%, 4px);
  min-width: max-content; max-width: 240px;
  padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--glass-bg-strong); border: 1px solid var(--gilt, var(--glass-brd-strong));
  color: var(--text-soft); font-size: 0.76rem; font-weight: 500; letter-spacing: normal; text-transform: none;
  line-height: 1.4; text-align: center; white-space: normal;
  box-shadow: var(--sh-md);
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 30;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.has-tip::before {
  content: ''; position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent; border-top-color: var(--glass-bg-strong);
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 30;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.has-tip:hover::after, .has-tip:hover::before,
.has-tip:focus-visible::after, .has-tip:focus-visible::before {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.has-tip:hover::before, .has-tip:focus-visible::before { transform: translateX(-50%) translateY(0); }

/* ---------- Rank badge ---------- */
.rank {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px 3px 9px;
  font-family: var(--font-display);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  color: var(--rank-text, #fff);
  background: linear-gradient(135deg, var(--rank-from), var(--rank-to));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 4px 16px var(--rank-glow, transparent);
  white-space: nowrap;
}
.rank svg { width: 13px; height: 13px; }
.rank-lg { font-size: 0.82rem; padding: 6px 15px 6px 12px; }
.rank-lg svg { width: 15px; height: 15px; }

/* ---------- Verified checkmark ---------- */
.verified-badge-wrap { display: inline-flex; vertical-align: -3px; margin-left: 3px; }
.verified-badge { width: 15px; height: 15px; flex-shrink: 0; color: var(--accent); filter: drop-shadow(0 0 4px rgba(var(--accent-rgb), 0.5)); }
.verified-badge.lg { width: 21px; height: 21px; }

/* ---------- Avatars ---------- */
.avatar {
  --size: 44px;
  width: var(--size); height: var(--size);
  border-radius: 30%;
  object-fit: cover;
  background: var(--bg-700);
  border: 1px solid var(--glass-brd-strong);
  image-rendering: auto;
}
.avatar.pixel { image-rendering: pixelated; }
.avatar-ring {
  position: relative; display: inline-grid; place-items: center;
  border-radius: 34%;
  padding: 3px;
  background: linear-gradient(135deg, var(--rank-from, var(--green)), var(--rank-to, var(--purple)));
  box-shadow: 0 0 18px var(--rank-glow, rgba(var(--green-rgb), 0.4));
}
.avatar-ring .avatar { border: 2px solid var(--bg-850); }

.status-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--bg-850);
  background: var(--text-faint);
}
.status-dot.online { background: var(--leaf); box-shadow: 0 0 8px rgba(var(--leaf-rgb), 0.8); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 7px; color: var(--text-soft); }
.field { margin-bottom: 18px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=url], textarea, select {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-brd-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(var(--green-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--green-rgb), 0.16);
  background: rgba(0, 0, 0, 0.4);
}
textarea { resize: vertical; min-height: 130px; line-height: 1.6; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b909b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.help-text { font-size: 0.8rem; color: var(--text-dim); margin-top: 6px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.errors {
  background: rgba(var(--danger-rgb), 0.12);
  border: 1px solid rgba(var(--danger-rgb), 0.35);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.errors ul { margin: 0; padding-left: 20px; color: var(--danger); }

/* ---------- Flash / toast ---------- */
.flash {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  margin: 18px 0;
  font-weight: 500;
  border: 1px solid var(--glass-brd);
}
.flash svg { width: 20px; height: 20px; flex-shrink: 0; }
.flash-success { background: rgba(var(--leaf-rgb), 0.1); border-color: rgba(var(--leaf-rgb), 0.35); color: var(--leaf); }
.flash-error { background: rgba(var(--danger-rgb), 0.1); border-color: rgba(var(--danger-rgb), 0.35); color: var(--danger); }

#toasts {
  position: fixed; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: var(--z-toast);
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-brd-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  font-size: 0.9rem; font-weight: 500;
  animation: toastIn 0.4s var(--spring) both;
}
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
.toast svg { width: 18px; height: 18px; color: var(--green); flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ---------- Tabs / pills ---------- */
.tabs {
  display: inline-flex; gap: 4px; padding: 5px;
  background: var(--glass-bg); border: 1px solid var(--glass-brd);
  border-radius: var(--r-pill);
  flex-wrap: wrap;
}
.tabs a {
  padding: 8px 16px; border-radius: var(--r-pill);
  font-size: 0.86rem; font-weight: 600; color: var(--text-dim);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: #04170a; background: linear-gradient(135deg, var(--green-bright), var(--green-deep)); }

/* ---------- Reactions ---------- */
.reactions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.react {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-pill);
  font-size: 0.82rem; font-weight: 600; color: var(--text-soft);
  cursor: pointer;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.react .emoji { font-size: 1rem; line-height: 1; transition: transform var(--t-fast) var(--spring); }
.react .count { min-width: 8px; font-variant-numeric: tabular-nums; }
.react:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.09); }
.react:hover .emoji { transform: scale(1.25) rotate(-6deg); }
.react.on {
  background: rgba(var(--green-rgb), 0.14);
  border-color: rgba(var(--green-rgb), 0.5);
  color: var(--green-bright);
  box-shadow: 0 0 14px rgba(var(--green-rgb), 0.22);
}
.react.pop .emoji { animation: reactPop 0.45s var(--spring); }
@keyframes reactPop { 0% { transform: scale(1); } 40% { transform: scale(1.6) rotate(10deg); } 100% { transform: scale(1); } }

/* ---------- Progress / XP ---------- */
.xpbar {
  position: relative; height: 9px; border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.4); overflow: hidden;
  border: 1px solid var(--glass-brd);
}
.xpbar > span {
  position: absolute; inset: 0 auto 0 0;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-deep), var(--green-bright));
  box-shadow: 0 0 12px rgba(var(--green-rgb), 0.6);
  transition: width 1s var(--ease);
}
.xpbar > span::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: xpShine 2.4s linear infinite;
}
@keyframes xpShine { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

.level-ring {
  --pct: 0%;
  width: var(--ring, 76px); height: var(--ring, 76px);
  border-radius: 50%;
  /* place-items centers each child in its own row; place-content collapses the
     implicit rows so the stack sits in the middle of the ring, not stretched. */
  display: grid; place-items: center; place-content: center;
  gap: 2px; text-align: center; line-height: 1;
  background:
    radial-gradient(closest-side, var(--bg-800) 76%, transparent 77% 100%),
    conic-gradient(var(--green-bright) var(--pct, 0%), rgba(255, 255, 255, 0.08) 0);
  box-shadow: 0 0 22px rgba(var(--green-rgb), 0.28);
}
.level-ring b { font-family: var(--font-pixel); font-size: 1.35rem; line-height: 1; display: block; }
.level-ring small { font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); line-height: 1; display: block; }
.level-ring-sm b { font-size: 0.95rem; }
.level-ring-lg b { font-size: 2rem; }
.level-ring-lg small { font-size: 0.66rem; }

/* ---------- Editable text blocks (hero / footer / notices) ---------- */
.tb { display: block; margin: 0; }
.tb-font-body { font-family: var(--font-body); }
.tb-font-display { font-family: var(--font-display); font-weight: 700; }
.tb-font-pixel { font-family: var(--font-pixel); font-weight: 700; letter-spacing: 0.02em; }
.tb-font-mono { font-family: var(--font-mono); }
.tb-size-xs { font-size: 0.78rem; }
.tb-size-sm { font-size: 0.92rem; }
.tb-size-md { font-size: clamp(1rem, 1.6vw, 1.15rem); }
.tb-size-lg { font-size: clamp(1.05rem, 2.4vw, 1.4rem); }
.tb-size-xl { font-size: clamp(1.6rem, 4.5vw, 2.6rem); line-height: 1.1; }
.tb-size-xxl { font-size: clamp(2.6rem, 10vw, 7rem); line-height: 1; }

.tb-gradient {
  background: linear-gradient(100deg, var(--tb-from, var(--accent)), var(--tb-to, var(--accent-2)));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.tb-fx-glow { text-shadow: 0 0 26px var(--tb-from, rgba(var(--green-rgb), 0.6)), 0 0 60px var(--tb-to, rgba(var(--purple-rgb), 0.35)); }
.tb-fx-shimmer {
  background: linear-gradient(100deg, var(--tb-from, var(--text)) 30%, var(--tb-to, var(--green-bright)) 45%, var(--purple-bright) 55%, var(--tb-from, var(--text)) 70%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
.tb-fx-pulse { animation: tbPulse 2.6s ease-in-out infinite; }
@keyframes tbPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.78; transform: scale(0.985); } }
.tb-fx-sparkle { position: relative; }
.tb-fx-sparkle::after {
  content: ''; position: absolute; inset: -10%;
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.9) 0 1px, transparent 2px),
              radial-gradient(circle at 76% 62%, rgba(255,255,255,0.8) 0 1px, transparent 2px),
              radial-gradient(circle at 52% 12%, rgba(255,255,255,0.7) 0 1px, transparent 2px);
  animation: tbSparkle 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes tbSparkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.tb-fx-typewriter {
  display: inline-block; overflow: hidden; white-space: nowrap;
  border-right: 2px solid var(--accent);
  width: calc(var(--tb-chars, 20) * 1ch);
  animation: tbType 3.2s steps(var(--tb-chars, 20)) 0.3s both, tbCaret 0.8s step-end infinite;
}
@keyframes tbType { from { width: 0; } }
@keyframes tbCaret { 50% { border-color: transparent; } }

@media (prefers-reduced-motion: reduce) {
  .tb-fx-shimmer, .tb-fx-pulse, .tb-fx-sparkle::after { animation: none; }
  .tb-fx-typewriter { animation: none; width: auto; border-right: 0; }
}

/* ---------- Purchased username cosmetics ---------- */
.uname-gradient {
  background: linear-gradient(100deg, var(--uname-from, var(--accent)), var(--uname-to, var(--accent-2)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.uname-fx-glow { text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.7); }
.uname-fx-shimmer { background-size: 200% auto; animation: shimmer 5s linear infinite; }
.uname-fx-pulse { animation: tbPulse 2.4s ease-in-out infinite; }
.uname-fx-sparkle { position: relative; }
@media (prefers-reduced-motion: reduce) { .uname-fx-shimmer, .uname-fx-pulse { animation: none; } }

/* ---------- Admin: block editor ---------- */
.block-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.block-card { padding: 18px; }
.block-preview {
  border: 1px dashed var(--glass-brd-strong); border-radius: var(--r-md);
  padding: 14px; margin-bottom: 14px; background: rgba(0, 0, 0, 0.28); position: relative;
}
.block-preview-label {
  position: absolute; top: -9px; left: 12px; padding: 0 6px;
  background: var(--bg-800); font-size: 0.66rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
}
.block-preview-stage { min-height: 40px; display: grid; place-items: center; text-align: center; overflow: hidden; }
.block-preview-stage > * { max-width: 100%; }

/* ---------- Admin: footer columns ---------- */
.footer-col-card { border: 1px solid var(--glass-brd); border-radius: var(--r-md); padding: 14px; margin-bottom: 12px; }
.footer-link-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-top: 1px solid var(--hair);
}
.footer-link-row svg { width: 13px; height: 13px; color: var(--text-dim); }
.row-off { opacity: 0.45; }

/* ---------- Notification centre ---------- */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.count-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--danger); color: #fff;
  font-size: 0.66rem; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg-900);
  transition: transform var(--t) var(--spring), opacity var(--t) var(--ease);
}
.count-badge.is-empty { opacity: 0; transform: scale(0.4); pointer-events: none; }
.cart-btn { position: relative; }
.cart-btn .count-badge { background: var(--accent); }

/* Selectors are scoped under .notif-panel so they out-specify the generic
   `.dropdown a` / `.dropdown button` rules in pages.css. */
.notif-panel {
  width: min(380px, calc(100vw - 32px));
  padding: 0; overflow: hidden;
}
.notif-panel .notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--hair);
}
.notif-panel .notif-head b { font-size: 0.92rem; }
.notif-panel .notif-head button { width: auto; padding: 4px 10px; }
.notif-panel .notif-list { max-height: 380px; overflow-y: auto; }
.notif-panel .notif-empty { padding: 26px 16px; text-align: center; color: var(--text-dim); font-size: 0.88rem; }
.notif-panel .notif-item {
  display: flex; align-items: flex-start; gap: 10px; border-radius: 0;
  padding: 12px 14px; border-bottom: 1px solid var(--hair);
  color: var(--text-soft); transition: background var(--t-fast) var(--ease);
}
.notif-panel .notif-item:hover { background: rgba(var(--accent-rgb), 0.07); }
.notif-panel .notif-item .notif-ic {
  position: relative; width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(var(--accent-rgb), 0.14); color: var(--accent);
}
.notif-panel .notif-item .notif-ic svg { width: 15px; height: 15px; }
.notif-panel .notif-item .notif-ic[data-type="xp"], .notif-panel .notif-item .notif-ic[data-type="quest"] { background: rgba(var(--gold-rgb), 0.16); color: var(--gold); }
.notif-panel .notif-item .notif-ic[data-type="shop"], .notif-panel .notif-item .notif-ic[data-type="order"] { background: rgba(var(--gold-rgb), 0.16); color: var(--gold); }
.notif-panel .notif-item .notif-ic[data-type="moderation"] { background: rgba(var(--danger-rgb), 0.16); color: var(--danger); }
.notif-panel .notif-item .notif-ic[data-type="announcement"], .notif-panel .notif-item .notif-ic[data-type="system"] { background: rgba(var(--purple-rgb), 0.16); color: var(--purple-bright, var(--purple)); }
.notif-panel .notif-item .notif-ic .notif-dot {
  position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%;
  background: transparent; border: 2px solid var(--bg-850);
}
.notif-panel .notif-item.unread { background: rgba(var(--accent-rgb), 0.06); }
.notif-panel .notif-item.unread .notif-dot { background: var(--accent); box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8); }
.notif-panel .notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-panel .notif-body b { color: var(--text); font-size: 0.9rem; }
.notif-panel .notif-text { font-size: 0.82rem; color: var(--text-dim); overflow-wrap: anywhere; }
.notif-panel .notif-time { font-size: 0.72rem; color: var(--text-faint); }
.notif-panel .notif-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 0;
  padding: 11px; font-size: 0.85rem; font-weight: 600; color: var(--accent);
  border-top: 1px solid var(--hair);
}
.notif-panel .notif-foot svg { width: 14px; height: 14px; color: var(--accent); }

/* Full page list */
.notif-page-item {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px;
  border-radius: var(--r-md); border: 1px solid var(--glass-brd);
  background: var(--glass-bg); margin-bottom: 10px;
}
.notif-page-item.unread { border-color: rgba(var(--accent-rgb), 0.4); background: rgba(var(--accent-rgb), 0.07); }
.notif-page-ic {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(var(--green-rgb), 0.18), rgba(var(--purple-rgb), 0.18));
  color: var(--accent);
}

/* ---------- Admin: inline connection-test result ---------- */
.test-result { font-size: 0.84rem; color: var(--text-dim); }
.test-result.ok { color: var(--leaf); }
.test-result.bad { color: var(--danger); }

/* ---------- Site notice ribbon (store / leaderboards / checkout) ---------- */
.site-notice {
  display: flex; align-items: center; gap: 14px; justify-content: center;
  text-align: center; margin-bottom: 26px;
}
.site-notice .site-notice-ic {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(var(--green-rgb), 0.2), rgba(var(--purple-rgb), 0.2));
  color: var(--accent);
}
.site-notice.warn .site-notice-ic { background: rgba(var(--gold-rgb), 0.16); color: var(--gold); }
.site-notice.ok .site-notice-ic { background: rgba(var(--leaf-rgb), 0.16); color: var(--leaf); }

/* ---------- Skeletons ---------- */
.skel {
  background: linear-gradient(100deg, var(--bg-750) 30%, var(--bg-700) 50%, var(--bg-750) 70%);
  background-size: 200% 100%;
  animation: skel 1.3s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  padding: 18px 20px; border-radius: var(--r-md);
  background: var(--glass-bg); border: 1px solid var(--glass-brd);
  transition: transform var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.stat:hover { transform: translateY(-3px); border-color: rgba(var(--green-rgb), 0.3); box-shadow: var(--sh-md); }
.stat .num { font-family: var(--font-pixel); font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 700; line-height: 1; }
.stat .num.g { color: var(--green); } .stat .num.p { color: var(--purple-bright); } .stat .num.gold { color: var(--gold); }
.stat .lbl { margin-top: 8px; font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- Table (admin) ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--hair); vertical-align: middle; font-size: 0.9rem; }
table.data th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); font-weight: 600; }
table.data tbody tr { transition: background var(--t-fast) var(--ease); }
table.data tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin: 32px 0 8px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); font-weight: 600; font-size: 0.9rem;
  background: var(--glass-bg); border: 1px solid var(--glass-brd); color: var(--text-soft);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.pagination a:hover { transform: translateY(-2px); border-color: rgba(var(--green-rgb), 0.4); }
.pagination .current { background: linear-gradient(135deg, var(--green-bright), var(--green-deep)); color: #04170a; border-color: transparent; }

/* ---------- Divider ---------- */
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--hair), transparent); margin: 24px 0; }

/* ============================================================
   ARCANE MANUSCRIPT — panels, badges, admin UI
   ============================================================ */

/* Faint parchment fibre + top vignette on every glass surface */
.glass::before {
  content: '';
  position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0.6; z-index: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 236, 194, 0.014) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0 3px, transparent 3px 7px),
    radial-gradient(130% 90% at 50% -10%, rgba(232, 184, 75, 0.05), transparent 55%);
}
.glass > * { position: relative; z-index: 1; }

/* Manuscript panel: gilt inner border + scrollable body */
.scroll-panel {
  border-color: var(--gilt);
  box-shadow: var(--sh-md), inset 0 0 0 1px rgba(232, 184, 75, 0.1);
  max-height: 80vh; overflow-y: auto;
}
.scroll-panel::-webkit-scrollbar { width: 10px; }
.scroll-panel::-webkit-scrollbar-thumb { background: rgba(232, 184, 75, 0.28); border-radius: 8px; }

/* ---------- Brand logo ---------- */
.brand-logo { height: 40px; width: auto; display: block; filter: drop-shadow(0 3px 10px rgba(232, 184, 75, 0.4)); }
.brand-word {
  font-family: var(--font-display); font-weight: 700; font-size: 1.18rem; letter-spacing: 0.02em;
  background: linear-gradient(120deg, var(--gold), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Chip small + rank fonts / effects ---------- */
.chip-sm { padding: 2px 8px; font-size: 0.66rem; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text-soft); cursor: pointer; margin: 0; }
.check input { width: auto; }

.rank-font-display span { font-family: var(--font-display); }
.rank-font-pixel span { font-family: var(--font-pixel); }
.rank-font-mono span { font-family: var(--font-mono); }
.rank-fx-glow { animation: rankGlow 2.6s ease-in-out infinite; }
.rank-fx-pulse { animation: rankPulse 1.9s ease-in-out infinite; }
.rank-fx-shimmer { position: relative; overflow: hidden; }
.rank-fx-shimmer::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  transform: translateX(-120%); animation: rankShimmer 2.8s linear infinite;
}
@keyframes rankGlow { 0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 0 8px var(--rank-glow); } 50% { box-shadow: 0 0 0 1px rgba(255,255,255,0.22), 0 0 20px var(--rank-glow); } }
@keyframes rankPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes rankShimmer { to { transform: translateX(120%); } }

/* ---------- Badge chips (Discord-style) ---------- */
.badge-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; vertical-align: middle;
  background: linear-gradient(140deg, var(--b-from, #38e1ff), var(--b-to, #7d5fff));
  color: #1a1206; box-shadow: 0 0 0 1px rgba(255,255,255,0.18), 0 4px 14px var(--b-glow, transparent);
}
.badge-chip svg { width: 17px; height: 17px; }
.badge-chip-sm { width: 22px; height: 22px; border-radius: 7px; }
.badge-chip-sm svg { width: 13px; height: 13px; }
.badge-common { filter: saturate(0.7); }
.badge-epic { box-shadow: 0 0 0 1px rgba(255,255,255,0.24), 0 4px 18px var(--b-glow); }
.badge-legendary { box-shadow: 0 0 0 1px rgba(255,255,255,0.32), 0 0 18px var(--b-glow); }
.badge-fx-glow { animation: rankGlow 2.4s ease-in-out infinite; }
.badge-fx-pulse { animation: rankPulse 1.8s ease-in-out infinite; }
.badge-fx-shimmer { position: relative; overflow: hidden; }
.badge-fx-shimmer::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  transform: translateX(-120%); animation: rankShimmer 2.6s linear infinite;
}
.badge-shelf { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.badge-owned { position: relative; display: inline-flex; }

/* ---------- Store item name styling (gradient text + magic effects) ---------- */
.store-name-gradient {
  background: linear-gradient(120deg, var(--name-from), var(--name-to));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.store-name-font-display { font-family: var(--font-display); }
.store-name-font-pixel { font-family: var(--font-pixel); }
.store-name-font-mono { font-family: var(--font-mono); }
.store-name-fx-glow { display: inline-block; animation: storeNameGlow 2.6s ease-in-out infinite; }
.store-name-fx-pulse { display: inline-block; animation: rankPulse 1.9s ease-in-out infinite; }
.store-name-fx-shimmer { background-size: 200% auto; animation: storeNameShimmer 2.6s linear infinite; }
.store-name-fx-sparkle { position: relative; display: inline-block; }
.store-name-fx-sparkle::before, .store-name-fx-sparkle::after {
  content: '\2726'; position: absolute; font-size: 0.55em; color: #fff;
  text-shadow: 0 0 6px currentColor; opacity: 0; animation: storeNameSparkle 2.4s ease-in-out infinite;
}
.store-name-fx-sparkle::before { top: -8px; left: -12px; animation-delay: 0s; }
.store-name-fx-sparkle::after { bottom: -6px; right: -14px; animation-delay: 1.1s; }
.store-name-fx-lightning { display: inline-block; animation: storeNameLightning 3s linear infinite; }
@keyframes storeNameGlow { 0%, 100% { filter: drop-shadow(0 0 4px var(--item-color)); } 50% { filter: drop-shadow(0 0 12px var(--item-color)); } }
@keyframes storeNameShimmer { from { background-position: 0 0; } to { background-position: -200% 0; } }
@keyframes storeNameSparkle { 0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(20deg); } }
@keyframes storeNameLightning {
  0%, 19%, 21%, 23%, 55%, 57%, 100% { filter: drop-shadow(0 0 6px var(--item-color)) drop-shadow(0 0 14px var(--item-color)); }
  20%, 22%, 56% { filter: none; opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .store-name-fx-glow, .store-name-fx-pulse, .store-name-fx-shimmer, .store-name-fx-sparkle, .store-name-fx-lightning { animation: none; }
}
.badge-x {
  position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%;
  border: none; background: var(--danger); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: none;
}
.badge-owned:hover .badge-x { display: block; }
.badge-catalog { display: flex; flex-direction: column; gap: 10px; }
.badge-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--hair); border-radius: var(--r-sm); }
.badge-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.badge-rarity-common { color: var(--text-dim); }
.badge-rarity-rare { color: var(--cyan); }
.badge-rarity-epic { color: var(--purple-bright); }
.badge-rarity-legendary { color: var(--gold); }

/* ---------- Announcement banner ---------- */
.announce {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; margin: 14px 0;
  border-radius: var(--r-md); border: 1px solid var(--glass-brd); background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.announce-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(var(--gold-rgb), 0.15); color: var(--gold); flex-shrink: 0; }
.announce-ic svg { width: 18px; height: 18px; }
.announce-body { display: flex; flex-direction: column; gap: 2px; }
.announce-body p { margin: 0; }
.announce-info .announce-ic { background: rgba(var(--accent-rgb), 0.15); color: var(--accent); }
.announce-success .announce-ic { background: rgba(var(--leaf-rgb), 0.15); color: var(--leaf); }
.announce-warning .announce-ic { background: rgba(var(--gold-rgb), 0.18); color: var(--gold); }
.announce-danger { border-color: rgba(var(--danger-rgb), 0.4); }
.announce-danger .announce-ic { background: rgba(var(--danger-rgb), 0.15); color: var(--danger); }

/* ---------- Admin navigation ---------- */
.admin-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .admin-split { grid-template-columns: 1fr; } }

/* ---------- Icon picker ---------- */
.icon-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px;
  max-height: 190px; overflow-y: auto; padding: 8px; border: 1px solid var(--glass-brd);
  border-radius: var(--r-sm); background: rgba(0,0,0,0.2);
}
.icon-opt { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid transparent; border-radius: 8px; background: rgba(255,255,255,0.03); color: var(--text-soft); cursor: pointer; }
.icon-opt svg { width: 18px; height: 18px; }
.icon-opt:hover { background: rgba(255,255,255,0.08); }
.icon-opt.sel { border-color: var(--gilt); background: rgba(var(--gold-rgb), 0.16); color: var(--gold); }

/* ---------- Permission grid ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 8px 0 4px; }
.perm-group { border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 12px; background: rgba(0,0,0,0.15); }
.perm-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.82rem; }
.perm-group-head svg { width: 15px; height: 15px; color: var(--gold); }
.perm-group-head b { flex: 1; }
.perm-all { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 2px 9px; border-radius: var(--r-pill); border: 1px solid var(--glass-brd); background: none; color: var(--text-dim); cursor: pointer; }
.perm-all:hover { color: var(--gold); border-color: var(--gilt); }
.perm-check { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; padding: 3px 0; color: var(--text-soft); }
.perm-check input { width: auto; }

/* ---------- Misc admin bits ---------- */
.rank-preview { display: flex; align-items: center; padding: 16px; border-radius: var(--r-md); background: radial-gradient(120% 120% at 50% 0%, rgba(232,184,75,0.06), transparent); border: 1px solid var(--hair); }
.banner-thumb { display: inline-block; width: 90px; height: 40px; border-radius: 8px; background-size: cover; background-position: center; border: 1px solid var(--glass-brd); }
.swatch-card { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--hair); }
input[type=color] { width: 46px; height: 34px; padding: 2px; border-radius: 8px; background: rgba(0,0,0,0.28); border: 1px solid var(--glass-brd-strong); cursor: pointer; flex-shrink: 0; }
input[type=color]:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Rank-perk fields (profile edit) ---------- */
.perk-section { margin-top: 10px; padding-top: 22px; border-top: 1px dashed var(--glass-brd-strong); }
.perk-section-head { margin-bottom: 16px; }
.perk-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-weight: 700; font-size: 0.9rem;
  color: var(--gold);
}
.perk-badge svg { width: 16px; height: 16px; }

.field-perk {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid rgba(var(--gold-rgb), 0.3);
  background: rgba(var(--gold-rgb), 0.055);
}
.field-perk > label { color: var(--gold); }
.field-perk.locked { border: 1px dashed var(--glass-brd-strong); background: rgba(255, 255, 255, 0.015); }
.field-perk.locked > label { color: var(--text-dim); }

.sublabel {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-dim); margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.name-style-preview {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid rgba(var(--gold-rgb), 0.18);
}
.name-style-preview #nameStylePreview { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }

.skin-bg-preview { width: 100%; height: 60px; border-radius: 10px; border: 1px solid var(--glass-brd); background-size: cover; background-position: center; margin-top: 12px; }

input[type=file] {
  width: 100%;
  padding: 10px 12px;
  color: var(--text-dim);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-brd-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
input[type=file]:hover { border-color: var(--glass-brd-strong); background: rgba(0, 0, 0, 0.36); }
input[type=file]:focus {
  outline: none;
  border-color: rgba(var(--green-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--green-rgb), 0.16);
}
input[type=file]::file-selector-button,
input[type=file]::-webkit-file-upload-button {
  margin-right: 12px;
  padding: 7px 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-brd-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
input[type=file]:hover::file-selector-button,
input[type=file]:hover::-webkit-file-upload-button {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(var(--green-rgb), 0.4);
}
.cover-ornament { position: absolute; top: 10px; left: 10px; color: var(--gilt); opacity: 0.75; pointer-events: none; }
.cover-ornament svg { width: 36px; height: 36px; }
