/* ============================================================
   Quiz Reward Platform — style.css
   Mobile-first (base 360px). Sections:
   1. Design tokens & reset          9. Badges / flash / misc
   2. Base & typography             10. Quiz game
   3. App layout (header/main/foot) 11. Modals
   4. Bottom navigation             12. Keyframes & motion
   5. Buttons                       13. Page-specific styles
   6. Cards & stats                 14. Admin
   7. Forms                         15. Utilities
   8. Tables                        16. Reduced motion, safe area, breakpoints
   ============================================================ */

/* ---------- 1. Design tokens & reset ---------- */
:root {
  --bg: #f5f4fa;
  --card: #ffffff;
  --text: #191730;
  --muted: #6f6d85;
  --border: #e7e5f2;
  --primary: #6c3df4;
  --primary2: #a78bfa;
  --primary-ink: #ffffff;
  --success: #16a34a;
  --danger: #e5484d;
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(23, 18, 60, .08);
  --shadow-lg: 0 16px 40px rgba(23, 18, 60, .16);
  --header-h: 60px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f0d1a;
  --card: #1a1729;
  --text: #f4f2fb;
  --muted: #a7a3c0;
  --border: #2e2a45;
  --primary: #8b5cf6;
  --primary2: #c4b5fd;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:active {
  opacity: .8;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0 0 .5em;
}

p {
  margin: 0 0 .75em;
}

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em;
}

/* ---------- 2. Base & typography ---------- */
.page-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -.01em;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 .75rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 .75rem;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.greeting {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 .75rem;
}

/* ---------- 3. App layout ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .5rem 1rem;
  max-width: 720px;
  margin: 0 auto;
}

.brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

.bell .badge {
  position: absolute;
  top: -6px;
  right: -6px;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: var(--primary-ink);
  font-weight: 700;
  font-size: .85rem;
  white-space: nowrap;
  min-height: 44px;
}

.balance-pill .bp-pts {
  opacity: .85;
  font-weight: 600;
  font-size: .75rem;
}

.app-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem calc(var(--nav-h) + 1.5rem);
  min-height: calc(100dvh - var(--header-h));
}

.page > * + * {
  margin-top: 1rem;
}

.app-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem calc(var(--nav-h) + 1rem);
  text-align: center;
}

/* ---------- 4. Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: .6rem .25rem .55rem;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  min-height: var(--nav-h);
}

.nav-tab svg {
  width: 24px;
  height: 24px;
}

.nav-tab.active {
  color: var(--primary);
}

.nav-tab.active svg {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--primary) 55%, transparent));
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 48px;
  padding: .8rem 1.4rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(.97);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: var(--primary-ink);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent);
}

.btn-ghost {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-warning {
  background: var(--warning, #d97706);
  color: #fff;
}

.suspend-notice {
  border: 1px solid var(--warning, #d97706);
  border-radius: 12px;
  padding: .7rem .9rem;
  margin-bottom: .6rem;
  background: color-mix(in srgb, var(--warning, #d97706) 8%, transparent);
}
.suspend-notice:last-child { margin-bottom: 0; }

.btn-sm {
  min-height: 40px;
  padding: .5rem .9rem;
  font-size: .85rem;
  border-radius: 10px;
}

.btn-lg {
  min-height: 56px;
  font-size: 1.1rem;
}

.btn-block {
  width: 100%;
}
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.btn.is-disabled, a.btn.is-disabled {
  opacity: .55; pointer-events: none; cursor: not-allowed;
}

.row {
  display: flex;
  align-items: center;
}

.row.gap {
  gap: .75rem;
  flex-wrap: wrap;
}

.row.gap > * {
  flex: 1 1 0;
  min-width: 140px;
}

/* ---------- 6. Cards & stats ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.center {
  text-align: center;
}

.balance-card {
  background: linear-gradient(150deg, var(--primary) 0%, var(--primary2) 130%);
  color: var(--primary-ink);
  border: 0;
  position: relative;
  overflow: hidden;
}

.balance-card .label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .85;
}

.balance-card .big-points {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: .25rem 0 0;
}

.balance-card .big-points small {
  font-size: 1rem;
  font-weight: 600;
  opacity: .85;
}

.balance-card .money-value {
  font-size: 1.05rem;
  font-weight: 600;
  opacity: .92;
  margin-bottom: .75rem;
}

.balance-card .muted {
  color: inherit;
  opacity: .85;
}

.balance-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.rank-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  background: rgba(255, 255, 255, .16);
  border-radius: 14px;
  padding: .55rem .9rem;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

.rank-badge .rank-num {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.rank-badge .rank-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .85;
}

.balance-card .btn-ghost {
  background: rgba(255, 255, 255, .16);
  border-color: transparent;
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem .5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  text-align: center;
}

.stat .v {
  font-weight: 800;
  font-size: 1.05rem;
}

.stat .k {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .6rem;
}

.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem .4rem;
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  min-height: 76px;
  justify-content: center;
}

.quick-icon {
  font-size: 1.5rem;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-ink);
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  margin-bottom: .5rem;
}
.avatar-img { object-fit: cover; padding: 0; }
.avatar-form { display: flex; gap: .5rem; justify-content: center; align-items: center; margin: .4rem 0 .2rem; }
.avatar-pick { cursor: pointer; }

.profile-name {
  margin: 0;
  font-size: 1.2rem;
}

/* ---------- 7. Forms ---------- */
.form .field,
.field {
  display: block;
  margin-bottom: 1rem;
}

.field > span {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="date"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: .9rem 1rem;
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.field textarea {
  min-height: 0;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.field input[readonly] {
  opacity: .8;
}

.field input[type="color"] {
  width: 100%;
  height: 52px;
  padding: .25rem;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.field.checkbox > span {
  margin: 0;
}

.field.checkbox input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

fieldset.card {
  border: 1px solid var(--border);
}

fieldset.card legend {
  padding: 0 .5rem;
  font-weight: 700;
}

.form-errors {
  background: color-mix(in srgb, var(--danger) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.error {
  color: var(--danger);
  font-size: .9rem;
  font-weight: 600;
}

.inline-form {
  display: inline;
}

.filter-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

.filter-bar input,
.filter-bar select {
  padding: .6rem .8rem;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  flex: 1 1 140px;
}

.filter-bar label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 600;
}

/* ---------- 8. Tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 560px;
}

.table thead th {
  text-align: left;
  padding: .7rem .8rem;
  background: color-mix(in srgb, var(--border) 45%, var(--card));
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  white-space: nowrap;
}

.table tbody td {
  padding: .7rem .8rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:active {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .truncate {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table .nowrap {
  white-space: nowrap;
}

/* ---------- 9. Badges / flash / misc ---------- */
.badge {
  display: inline-block;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  color: var(--muted);
  white-space: nowrap;
}

.badge-success {
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: var(--success);
}

.badge-danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.badge-warning {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: #b45309;
}

.badge-info {
  background: color-mix(in srgb, #0ea5e9 16%, transparent);
  color: #0284c7;
}

.badge-muted {
  background: color-mix(in srgb, var(--muted) 16%, transparent);
  color: var(--muted);
}

.flash {
  max-width: 720px;
  margin: .75rem auto 0;
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  font-weight: 600;
  animation: pop .25s ease;
}

.flash-success {
  background: color-mix(in srgb, var(--success) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--success) 45%, transparent);
  color: var(--success);
}

.flash-error {
  background: color-mix(in srgb, var(--danger) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}

.flash-info {
  background: color-mix(in srgb, var(--info, #0ea5e9) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--info, #0ea5e9) 45%, transparent);
  color: var(--text);
  font-weight: 400;
}

.flash-list {
  margin: .25rem 0 0;
  padding-left: 1.1rem;
}

.impersonate-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem 1rem;
  background: #7c2d12;
  color: #fff;
  font-size: .85rem;
  font-weight: 600;
}

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.code-block {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem;
  overflow-x: auto;
  white-space: pre;
  margin: .5rem 0;
}

.copy-row {
  display: flex;
  gap: .5rem;
}

.copy-row input {
  flex: 1;
  min-width: 0;
  padding: .9rem 1rem;
  min-height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
}

.dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .35rem .9rem;
  margin: 0 0 1rem;
  font-size: .92rem;
}

.dl dt {
  color: var(--muted);
  font-weight: 600;
}

.dl dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dl .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.detail-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
}

/* ---------- 10. Quiz game ---------- */
.quiz-page {
  max-width: 560px;
  margin: 0 auto;
}

.quiz-hero {
  font-size: 3rem;
  margin-bottom: .25rem;
}

.cat-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  justify-content: center;
  margin: .9rem 0 1.1rem;
  max-height: 11rem;
  overflow-y: auto;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}

.cat-chip:active { transform: scale(.96); }

.cat-chip.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 16%, var(--card));
  box-shadow: 0 0 0 1px var(--primary);
}

.cat-count {
  font-size: .68rem;
  font-weight: 700;
  padding: .05rem .4rem;
  border-radius: 999px;
  background: var(--border);
  opacity: .85;
}

.cat-chip.active .cat-count { background: var(--primary); color: #fff; opacity: 1; }

.cat-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
  margin-bottom: .6rem;
}

.q-topbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .75rem;
}

.q-counter {
  font-weight: 800;
  font-size: .9rem;
  white-space: nowrap;
}

.progress {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  transition: width .35s ease;
}

.q-score {
  font-weight: 800;
  font-size: .9rem;
  color: var(--primary);
  white-space: nowrap;
}

.q-lives {
  font-size: 1rem;
  letter-spacing: .1em;
  white-space: nowrap;
}

.q-card {
  position: relative;
  overflow: hidden;
}

.q-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.q-image {
  border-radius: var(--radius-sm);
  margin: 0 auto 1rem;
  max-height: 220px;
  object-fit: cover;
  width: 100%;
}

.opts {
  display: grid;
  gap: .65rem;
}

.opt-btn {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  min-height: 60px;
  padding: .8rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.opt-btn:active {
  transform: scale(.98);
}

.opt-btn:disabled {
  cursor: default;
}

.opt-key {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--primary);
  font-weight: 800;
}

.opt-btn.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.opt-btn.correct {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, var(--card));
  box-shadow: 0 0 18px color-mix(in srgb, var(--success) 45%, transparent);
  animation: glowPulse .6s ease;
}

.opt-btn.correct .opt-key {
  background: var(--success);
  color: #fff;
}

.opt-btn.wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--card));
  animation: shake .4s ease;
}

.opt-btn.wrong .opt-key {
  background: var(--danger);
  color: #fff;
}

.q-feedback {
  margin-top: 1rem;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-align: center;
  animation: pop .25s ease;
}

.q-feedback.good {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.q-feedback.bad {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.explain {
  margin-top: .75rem;
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--primary) 40%, transparent);
  font-size: .9rem;
}

/* Event-themed question card: animated gradient from inline --eg1/--eg2/--glow */
.q-card.event-on {
  background: linear-gradient(135deg, var(--eg1, #6c3df4), var(--eg2, #0ea5e9), var(--eg1, #6c3df4));
  background-size: 220% 220%;
  animation: eventShift 6s ease infinite, glowPulse 2.4s ease-in-out infinite;
  border: 0;
  color: #fff;
  box-shadow: 0 0 28px var(--glow, rgba(167, 139, 250, .55));
}

.q-card.event-on .q-text {
  text-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.q-card.event-on .opt-btn {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
  backdrop-filter: blur(4px);
}

.q-card.event-on .opt-key {
  background: rgba(255, 255, 255, .25);
  color: #fff;
}

.q-card.event-on .explain {
  background: rgba(0, 0, 0, .22);
  border-color: rgba(255, 255, 255, .4);
  color: #fff;
}

.event-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-bottom: .6rem;
  padding: .4rem .9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
  animation: pop .3s ease;
}

/* ---------- 11. Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(10, 8, 24, .62);
  backdrop-filter: blur(4px);
  animation: pop .2s ease;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow-lg);
  max-height: 90dvh;
  overflow-y: auto;
}

.modal-card > * + * {
  margin-top: .9rem;
}

/* Admin notice popups */
.notice-card {
  border-top: 5px solid var(--notice-accent, #0ea5e9);
}

.notice-icon {
  font-size: 2.6rem;
  line-height: 1;
}

.notice-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.notice-card p {
  margin: 0;
  white-space: pre-line;
}

.notice-type-info { --notice-accent: #0ea5e9; }
.notice-type-warning { --notice-accent: #f59e0b; }
.notice-type-important { --notice-accent: #ef4444; }

.notice-type-important {
  animation: notice-pulse 1.6s ease-in-out infinite;
}

@keyframes notice-pulse {
  0%, 100% { box-shadow: var(--shadow-lg); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, .35), var(--shadow-lg); }
}

@media (prefers-reduced-motion: reduce) {
  .notice-type-important { animation: none; }
}

.reward-slot {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

/* ---------- 12. Keyframes & motion ---------- */
@keyframes pop {
  0% { transform: scale(.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(5px); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px color-mix(in srgb, var(--success) 35%, transparent); }
  50% { box-shadow: 0 0 26px color-mix(in srgb, var(--success) 70%, transparent); }
}

@keyframes eventShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes confettiFall {
  0% { transform: translateY(-5dvh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105dvh) rotate(720deg); opacity: .4; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.count-up {
  animation: countUp .5s ease;
}

.confetti {
  position: fixed;
  top: -16px;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  z-index: 200;
  pointer-events: none;
  animation: confettiFall 3.6s ease-in forwards;
}

/* ---------- 13. Page-specific ---------- */
/* Auth */
.auth-page {
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 .25rem;
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: .9rem;
  display: flex;
  gap: .5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Tasks */
.task-list {
  display: grid;
  gap: .8rem;
}

.task-card {
  padding: 1rem;
}

.task-head {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  margin-bottom: .8rem;
}

.task-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.task-meta {
  flex: 1;
  min-width: 0;
}

.task-title {
  margin: 0 0 .15rem;
  font-size: 1rem;
}

.task-meta p {
  margin: 0;
}

.task-reward {
  font-weight: 800;
  color: var(--success);
  white-space: nowrap;
}

.task-timer {
  margin: 0 0 .75rem;
  font-size: .95rem;
}

/* Withdraw */
.method-list {
  display: grid;
  gap: .6rem;
}

.method-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .15s ease;
  min-height: 64px;
}

.method-card.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.method-card input[type="radio"] {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.method-name {
  font-weight: 700;
  display: block;
}

.fee-preview {
  margin-top: 1rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: .9rem;
}

.fee-preview p {
  margin: 0;
}

.fee-row {
  display: flex;
  justify-content: space-between;
  padding: .2rem 0;
}

.fee-row.total {
  font-weight: 800;
  border-top: 1px solid var(--border);
  margin-top: .4rem;
  padding-top: .5rem;
}

/* Notifications */
.notif-list {
  display: grid;
  gap: .6rem;
}

.notif {
  display: flex;
  gap: .75rem;
  padding: .9rem 1rem;
  align-items: flex-start;
}

.notif.unread {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--card));
}

.notif-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  margin-top: .45rem;
  flex-shrink: 0;
}

.notif.unread .notif-dot {
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.notif-title {
  margin: 0 0 .15rem;
  font-size: .95rem;
}

.notif-text {
  margin: 0 0 .3rem;
  font-size: .88rem;
}

.notif-body p:last-child {
  margin: 0;
}

.static-content {
  font-size: .95rem;
}

.static-content h1,
.static-content h2,
.static-content h3 {
  margin-top: 1em;
}

/* ---------- 14. Admin ---------- */
.admin-body {
  /* Theme-aware: follows the user's light/dark choice like the player
     site does. Never hard-code light surfaces here, or dark mode breaks. */
  background: var(--bg);
  color: var(--text);
  color-scheme: light;
}
[data-theme="dark"] .admin-body {
  color-scheme: dark;
}

.admin-hamburger {
  display: none;
  position: fixed;
  top: .7rem;
  left: .7rem;
  z-index: 120;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid #2e2a45;
  background: #1e1b2e;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.admin-hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  background: #f4f2fb;
}

.admin-shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #1e1b2e;
  color: #cfcbe8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 110;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid #2e2a45;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6c3df4, #a78bfa);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.brand-name {
  font-weight: 700;
  color: #f4f2fb;
  line-height: 1.2;
}

.brand-name small {
  display: block;
  color: #a7a3c0;
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .75rem .8rem;
}

.nav-group {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #8b88a8;
  margin: 1rem .4rem .35rem;
  font-weight: 700;
}

.nav-item {
  display: block;
  padding: .6rem .8rem;
  border-radius: 10px;
  color: #cfcbe8;
  font-size: .92rem;
  font-weight: 500;
}

.nav-item:hover {
  background: #2a2740;
  color: #fff;
}

.nav-item.active {
  background: #6c3df4;
  color: #fff;
  font-weight: 700;
}

.sidebar-foot {
  padding: .8rem;
  border-top: 1px solid #2e2a45;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .8rem 1.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.admin-user {
  font-weight: 600;
  font-size: .9rem;
}

.admin-content {
  padding: 1.25rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.admin-content .flash {
  margin: 0 0 1rem;
  max-width: none;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .8rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(23, 18, 60, .05);
}

.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.02em;
}

.stat-card .stat-label {
  font-size: .8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

.chart-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
}

.pagination {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: .5rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
}

.page-link.current {
  background: #6c3df4;
  border-color: #6c3df4;
  color: #fff;
}

.settings-tabs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.settings-tabs .tab {
  padding: .6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: .88rem;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.settings-tabs .tab.active {
  background: #6c3df4;
  border-color: #6c3df4;
  color: #fff;
}

.perm-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem;
  margin-bottom: .9rem;
}

.perm-group legend {
  font-weight: 700;
  padding: 0 .4rem;
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .2rem .8rem;
}

.placement-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: 1fr;
}

.theme-swatch {
  display: inline-block;
  width: 44px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, .12);
  vertical-align: middle;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 .8rem;
}

.opt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 .8rem;
}

.sidebar-scrim {
  display: none;
}

/* ---------- 15. Utilities ---------- */
.hidden { display: none !important; }

/* ---------- 16. Reduced motion, safe area, breakpoints ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 560px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .placement-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (min-width: 900px) {
  .chart-grid {
    grid-template-columns: 1fr 1fr;
  }

  .chart-grid .card:first-child {
    grid-column: 1 / -1;
  }

  .stat-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .placement-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1023px) {
  .admin-hamburger {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgba(0, 0, 0, .4);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(10, 8, 24, .5);
  }

  .topbar {
    padding-left: 4.2rem;
  }
}

@media (min-width: 1024px) {
  .stat-cards {
    grid-template-columns: repeat(6, 1fr);
  }

  .admin-content {
    padding: 1.75rem 2rem;
  }
}

/* ---------- 17. Phone shell (desktop) ---------- */
/* On larger screens the user app renders as a centered phone-width column,
   while the admin panel keeps its full-width desktop layout. */
@media (min-width: 480px) {
  body {
    background: color-mix(in srgb, var(--bg) 80%, #000 20%);
  }

  .phone-shell {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    position: relative;
  }

  .bottom-nav {
    left: 50%;
    right: auto;
    width: 100%;
    max-width: 430px;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  /* Keep app grids in their phone layout inside the shell */
  .phone-shell .detail-grid {
    grid-template-columns: 1fr;
  }

  .phone-shell .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .phone-shell .placement-grid {
    grid-template-columns: 1fr;
  }

  .phone-shell .chart-grid {
    grid-template-columns: 1fr;
  }

  .phone-shell .chart-grid .card:first-child {
    grid-column: auto;
  }
}

/* ---------- Social login (Google + Telegram) ---------- */
.social-login { margin-top: 14px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; color: var(--muted, #6b7280); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border, #e5e7eb); }
.btn-social { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f2937; border: 1px solid var(--border, #e5e7eb); }
.btn-social:hover { background: #f9fafb; }
.telegram-login { display: flex; justify-content: center; margin-top: 10px; min-height: 40px; }

/* ---------- Leaderboard ---------- */
.tabs { display: flex; gap: 8px; margin: 0 0 12px; }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 12px; background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb); color: inherit; text-decoration: none; font-weight: 600; font-size: 14px; }
.tab.active { background: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); color: #fff; }
.my-rank { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.my-rank-badge { background: var(--primary, #4f46e5); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: flex; align-items: center; gap: 10px; background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb); border-radius: 14px; padding: 10px 12px; position: relative; overflow: hidden; }
.rank-row.top3 { border-color: #f59e0b; }
.rank-row.is-me { border-color: var(--primary, #4f46e5); border-width: 2px; background: color-mix(in srgb, var(--primary, #4f46e5) 6%, var(--card, #fff)); }
/* ---------- Top 5 VFX + glow ---------- */
.rank-row.top5 { border-width: 1.5px; }
.rank-row.top5::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 48%, transparent 62%); transform: translateX(-120%); animation: rank-shine 3.2s ease-in-out infinite; }
.rank-row.rank-1 { border-color: #fbbf24; background: linear-gradient(135deg, color-mix(in srgb, #fbbf24 14%, var(--card, #fff)), var(--card, #fff)); box-shadow: 0 0 18px rgba(251,191,36,.45), 0 0 42px rgba(251,191,36,.18); animation: rank-glow-gold 2.6s ease-in-out infinite; }
.rank-row.rank-2 { border-color: #c0c7d1; background: linear-gradient(135deg, color-mix(in srgb, #c0c7d1 16%, var(--card, #fff)), var(--card, #fff)); box-shadow: 0 0 16px rgba(192,199,209,.5), 0 0 36px rgba(148,163,184,.2); animation: rank-glow-silver 2.8s ease-in-out infinite; }
.rank-row.rank-3 { border-color: #d08a4e; background: linear-gradient(135deg, color-mix(in srgb, #d08a4e 15%, var(--card, #fff)), var(--card, #fff)); box-shadow: 0 0 16px rgba(208,138,78,.45), 0 0 34px rgba(180,120,60,.18); animation: rank-glow-bronze 3s ease-in-out infinite; }
.rank-row.rank-4 { border-color: #38bdf8; background: linear-gradient(135deg, color-mix(in srgb, #38bdf8 12%, var(--card, #fff)), var(--card, #fff)); box-shadow: 0 0 14px rgba(56,189,248,.4), 0 0 30px rgba(56,189,248,.15); }
.rank-row.rank-5 { border-color: #a78bfa; background: linear-gradient(135deg, color-mix(in srgb, #a78bfa 13%, var(--card, #fff)), var(--card, #fff)); box-shadow: 0 0 14px rgba(167,139,250,.4), 0 0 30px rgba(167,139,250,.16); }
.rank-pos { min-width: 34px; text-align: center; font-weight: 700; font-size: 18px; }
.rank-pos-1, .rank-pos-2, .rank-pos-3 { animation: rank-pop 2.4s ease-in-out infinite; display: inline-block; }
.rank-pos-1 { filter: drop-shadow(0 0 6px rgba(251,191,36,.9)); }
.rank-pos-2 { filter: drop-shadow(0 0 6px rgba(192,199,209,.9)); }
.rank-pos-3 { filter: drop-shadow(0 0 6px rgba(208,138,78,.9)); }
.rank-pos-4 { color: #0284c7; filter: drop-shadow(0 0 5px rgba(56,189,248,.7)); }
.rank-pos-5 { color: #7c3aed; filter: drop-shadow(0 0 5px rgba(167,139,250,.7)); }
@keyframes rank-shine { 0% { transform: translateX(-120%); } 55%, 100% { transform: translateX(120%); } }
@keyframes rank-glow-gold { 0%, 100% { box-shadow: 0 0 14px rgba(251,191,36,.35), 0 0 32px rgba(251,191,36,.12); } 50% { box-shadow: 0 0 22px rgba(251,191,36,.6), 0 0 52px rgba(251,191,36,.25); } }
@keyframes rank-glow-silver { 0%, 100% { box-shadow: 0 0 12px rgba(192,199,209,.4), 0 0 28px rgba(148,163,184,.14); } 50% { box-shadow: 0 0 20px rgba(192,199,209,.62), 0 0 44px rgba(148,163,184,.24); } }
@keyframes rank-glow-bronze { 0%, 100% { box-shadow: 0 0 12px rgba(208,138,78,.35), 0 0 28px rgba(180,120,60,.12); } 50% { box-shadow: 0 0 20px rgba(208,138,78,.58), 0 0 42px rgba(180,120,60,.22); } }
@keyframes rank-pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .rank-row.top5::after, .rank-row.rank-1, .rank-row.rank-2, .rank-row.rank-3, .rank-pos-1, .rank-pos-2, .rank-pos-3 { animation: none; } }
.rank-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary, #4f46e5); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex: none; }
.rank-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.you-tag { font-style: normal; font-size: 11px; font-weight: 700; background: var(--primary, #4f46e5); color: #fff; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.rank-points { font-weight: 700; white-space: nowrap; }
.rank-points small { font-weight: 400; color: var(--muted, #6b7280); }

/* ---------- Email OTP login ---------- */
.auth-alt { margin-top: 12px; }
.otp-input { text-align: center; font-size: 24px; font-weight: 700; letter-spacing: 6px; }

/* ---------- Admin mail templates ---------- */
.mail-preview { border: 1px solid var(--border, #e5e7eb); border-radius: 12px; padding: 8px; background: #fff; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- Admin withdrawals: filters, quick actions, bulk ---------- */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; }
.filter-grid .btn, .filter-grid button { white-space: nowrap; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; padding: 8px 12px; border: 1px solid var(--border, #e5e7eb); border-radius: 10px; background: var(--card, #fff); }
.bulk-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.copy-btn { background: none; border: 1px solid var(--border, #e5e7eb); border-radius: 6px; cursor: pointer; padding: 1px 6px; font-size: 12px; color: var(--muted, #6b7280); }
.copy-btn:hover { color: var(--primary, #4f46e5); border-color: var(--primary, #4f46e5); }
.quick-actions { white-space: nowrap; }
.inline-form { display: inline-block; margin: 1px 2px; }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: 7px; }
.btn-danger-ghost { background: transparent; border: 1px solid var(--danger, #dc2626); color: var(--danger, #dc2626); }
.btn-danger-ghost:hover { background: var(--danger, #dc2626); color: #fff; }

/* ============ PvP Arena ============ */
.pvp-page .field-label { font-weight: 700; font-size: .85rem; margin: .9rem 0 .4rem; color: var(--text); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* Rating card with tier glow */
.pvp-rating-card { position: relative; overflow: hidden; text-align: center; }
.pvp-tier-badge { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.pvp-rating-main { margin: .4rem 0 .8rem; }
.pvp-tier-name { display: block; font-weight: 800; font-size: 1.05rem; letter-spacing: .06em; text-transform: uppercase; }
.pvp-rating-num { font-size: 1.9rem; font-weight: 800; }
.pvp-record { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.pvp-record div { background: color-mix(in srgb, var(--card) 60%, transparent); border: 1px solid var(--border); border-radius: 10px; padding: .45rem .2rem; }
.pvp-record strong { display: block; font-size: 1.05rem; }
.pvp-record span { font-size: .72rem; color: var(--muted); }

/* Unique tier effects */
.tier-bronze .pvp-tier-name { color: #cd7f32; }
.tier-bronze { box-shadow: inset 0 0 24px rgba(205,127,50,.18); }
.tier-silver .pvp-tier-name { color: #9aa5b1; }
.tier-silver { box-shadow: inset 0 0 24px rgba(154,165,177,.22); }
.tier-gold .pvp-tier-name { color: #d4a017; }
.tier-gold { box-shadow: inset 0 0 28px rgba(212,160,23,.28); }
.tier-gold .pvp-tier-badge { animation: tier-bob 2.4s ease-in-out infinite; }
.tier-platinum .pvp-tier-name { color: #7dd3fc; }
.tier-platinum { box-shadow: inset 0 0 30px rgba(125,211,252,.3); }
.tier-platinum::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.28) 50%, transparent 60%);
  background-size: 250% 100%; animation: tier-shine 3.2s linear infinite; }
.tier-diamond .pvp-tier-name { color: #67e8f9; text-shadow: 0 0 12px rgba(103,232,249,.8); }
.tier-diamond { box-shadow: inset 0 0 32px rgba(103,232,249,.35), 0 0 18px rgba(103,232,249,.25); }
.tier-diamond .pvp-tier-badge { animation: tier-spin 5s linear infinite; }
.tier-master .pvp-tier-name { color: #f472b6; text-shadow: 0 0 14px rgba(244,114,182,.85); }
.tier-master { box-shadow: inset 0 0 34px rgba(244,114,182,.4), 0 0 22px rgba(244,114,182,.3); animation: tier-pulse 2s ease-in-out infinite; }
@keyframes tier-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes tier-shine { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@keyframes tier-spin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
@keyframes tier-pulse { 0%,100% { box-shadow: inset 0 0 30px rgba(244,114,182,.32), 0 0 16px rgba(244,114,182,.22); } 50% { box-shadow: inset 0 0 40px rgba(244,114,182,.5), 0 0 30px rgba(244,114,182,.4); } }

/* Finding-opponent radar */
.pvp-finding { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); text-align: center; padding: 1rem; }
.pvp-finding.hidden { display: none; }
.pvp-radar { position: relative; width: 150px; height: 150px; }
.pvp-radar.small { width: 90px; height: 90px; margin: 0 auto .5rem; }
.radar-ring { position: absolute; inset: 0; border: 2px solid #6c3df4; border-radius: 50%; opacity: 0; animation: radar-ping 2.2s ease-out infinite; }
.radar-ring.r2 { animation-delay: .7s; }
.radar-ring.r3 { animation-delay: 1.4s; }
@keyframes radar-ping { 0% { transform: scale(.25); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.radar-core { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; animation: tier-bob 1.6s ease-in-out infinite; }

/* Duel header */
.pvp-duel-bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: .4rem .6rem; align-items: center; }
.pvp-fighter { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.pvp-fighter.opp { justify-content: flex-end; text-align: right; }
.pvp-fighter strong { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.pvp-avatar { font-size: 1.7rem; }
.pvp-avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex: 0 0 auto; }
.pvp-vs { font-weight: 800; color: #6c3df4; font-size: .85rem; }
.pvp-progress { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.pvp-progress .bar { height: 100%; width: 0; border-radius: 99px; transition: width .4s ease; }
.me-bar { background: linear-gradient(90deg, #22c55e, #4ade80); }
.opp-bar { background: linear-gradient(90deg, #f43f5e, #fb7185); }

/* Countdown ring */
.pvp-qtop { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.pvp-timer-wrap { position: relative; width: 68px; height: 68px; flex: 0 0 auto; }
.pvp-timer { width: 68px; height: 68px; transform: rotate(-90deg); display: block; }
.timer-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.timer-fg { fill: none; stroke: url(#pvpTimerGrad); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .25s linear; filter: drop-shadow(0 0 4px rgba(108,61,244,.45)); }
.pvp-timer-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.pvp-timer-wrap.timer-low .timer-fg { stroke: #ef4444; filter: drop-shadow(0 0 6px rgba(239,68,68,.7)); }
.pvp-timer-wrap.timer-low .pvp-timer-num { color: #ef4444; }
.pvp-timer-wrap.timer-low { animation: pvp-timer-pulse .5s ease-in-out infinite; }
@keyframes pvp-timer-pulse { 50% { transform: scale(1.1); } }

/* Result banner */
.pvp-result-banner { overflow: hidden; }
.pvp-win { background: linear-gradient(160deg, rgba(34,197,94,.22), rgba(34,197,94,.04)); }
.pvp-lose { background: linear-gradient(160deg, rgba(244,63,94,.20), rgba(244,63,94,.04)); }
.pvp-tie { background: linear-gradient(160deg, rgba(245,158,11,.22), rgba(245,158,11,.04)); }
.pvp-result-emoji { font-size: 3.6rem; animation: tier-bob 1.8s ease-in-out infinite; }
.pvp-win .pvp-result-emoji { animation: pvp-trophy-pop .7s cubic-bezier(.2,1.6,.4,1) both, tier-bob 1.8s ease-in-out .7s infinite; }
@keyframes pvp-trophy-pop { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.pvp-result-title { font-size: 1.9rem; margin: .3rem 0 .1rem; }
.pvp-result-sub { margin: 0 0 .4rem; font-size: .9rem; }
.pvp-win .pvp-result-title { color: #22c55e; }
.pvp-lose .pvp-result-title { color: #f43f5e; }
.pvp-tie .pvp-result-title { color: #f59e0b; }
.pvp-win { box-shadow: inset 0 0 34px rgba(34,197,94,.25); }
.pvp-lose { box-shadow: inset 0 0 34px rgba(244,63,94,.22); }
.pvp-tie { box-shadow: inset 0 0 34px rgba(245,158,11,.25); }
.pvp-rating-delta { font-size: 1.15rem; font-weight: 800; }
.delta-up { color: #22c55e; }
.delta-down { color: #f43f5e; }

/* Head-to-head table */
.pvp-vs-table { display: grid; gap: .15rem; margin-bottom: .6rem; }
.pvp-vs-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .5rem .2rem; border-bottom: 1px solid var(--border); }
.pvp-vs-row strong:first-child { text-align: left; }
.pvp-vs-row strong:last-child { text-align: right; }
.pvp-vs-row .muted { text-align: center; }
.pvp-vs-head { font-size: .8rem; color: var(--muted); border-bottom: 2px solid var(--border); }
.pvp-vs-head span:first-child { text-align: left; }
.pvp-vs-head span:last-child { text-align: right; }
.pvp-result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .7rem; }

/* Score duel bar */
.pvp-duel { margin-bottom: .4rem; }
.pvp-duel-names { display: flex; align-items: center; justify-content: space-between; font-size: .9rem; }
.pvp-duel-vs { font-size: .75rem; font-weight: 800; color: var(--muted); background: var(--bg-soft, #f1f5f9); border: 1px solid var(--border); border-radius: 99px; padding: .1rem .6rem; }
.pvp-duel-scores { display: flex; justify-content: space-between; font-size: 1.6rem; font-weight: 900; margin: .15rem 0 .45rem; font-variant-numeric: tabular-nums; }
.pvp-duel-bar { height: 12px; border-radius: 99px; background: var(--border); overflow: hidden; }
.pvp-duel-mine { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6c3df4, #0ea5e9); transition: width .8s cubic-bezier(.2,.8,.3,1); }
.pvp-duel-winner { background: linear-gradient(90deg, #22c55e, #a3e635); }

/* Head-to-head winner highlight */
.pvp-stat-win { color: #16a34a; }
.pvp-stat-win::after { content: ' ●'; font-size: .65em; }

/* Recent + history lists */
.pvp-recent, .pvp-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.pvp-recent li { display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.pvp-recent-opp { font-weight: 600; }
.pvp-hist-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .2rem; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.pvp-hist-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pvp-hist-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Quiz start screen PvP banner */
.pvp-banner { display: flex; align-items: center; gap: .8rem; margin-top: .9rem; padding: .85rem 1rem; border-radius: 14px;
  background: linear-gradient(120deg, rgba(108,61,244,.16), rgba(14,165,233,.12));
  border: 1px solid color-mix(in srgb, #6c3df4 45%, transparent); color: inherit; text-decoration: none; }
.pvp-banner .pvp-banner-ico { font-size: 1.8rem; }
.pvp-banner strong { display: block; }
.pvp-banner .pvp-banner-go { margin-left: auto; font-weight: 800; color: #6c3df4; }

/* Solo quiz countdown */
.quiz-timer { display: inline-flex; align-items: center; gap: .3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.quiz-timer.timer-low { color: #ef4444; animation: timer-blink .5s steps(2) infinite; }
@keyframes timer-blink { 50% { opacity: .45; } }

/* Profile PvP tier chip */
.profile-tier { display: inline-flex; align-items: center; gap: .35rem; margin-top: .4rem; padding: .3rem .8rem; border-radius: 99px;
  font-weight: 800; font-size: .85rem; border: 1px solid var(--border); }

/* Profile PvP level badge (admin-managed) */
.pvp-level-badge { display: inline-flex; align-items: center; gap: .45rem; margin-top: .45rem; padding: .4rem .95rem; border-radius: 14px;
  background: linear-gradient(120deg, rgba(108,61,244,.14), rgba(14,165,233,.10));
  border: 1px solid color-mix(in srgb, #6c3df4 40%, transparent); font-weight: 800; }
.pvp-level-badge .pvp-level-icon { font-size: 1.5rem; line-height: 1; }
.pvp-level-badge .pvp-level-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.pvp-level-badge .pvp-level-name { font-size: .95rem; }
.pvp-level-badge .pvp-level-sub { font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Withdrawal requirement checklist */
.req-list { list-style: none; margin: .25rem 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.req-list li { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.req-met { color: var(--text); }
.req-unmet { color: var(--muted); }

/* Admin icon picker */
.icon-pick { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.icon-pick-btn { font-size: 1.4rem; padding: .3rem .45rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card, #fff); cursor: pointer; }
.icon-pick-btn:hover { border-color: #6c3df4; transform: scale(1.1); }
.profile-tier.tier-bronze { color: #cd7f32; border-color: #cd7f32; box-shadow: 0 0 10px rgba(205,127,50,.35); }
.profile-tier.tier-silver { color: #9aa5b1; border-color: #9aa5b1; box-shadow: 0 0 10px rgba(154,165,177,.35); }
.profile-tier.tier-gold { color: #d4a017; border-color: #d4a017; box-shadow: 0 0 12px rgba(212,160,23,.45); }
.profile-tier.tier-platinum { color: #7dd3fc; border-color: #7dd3fc; box-shadow: 0 0 12px rgba(125,211,252,.5); }
.profile-tier.tier-diamond { color: #67e8f9; border-color: #67e8f9; box-shadow: 0 0 14px rgba(103,232,249,.6); }
.profile-tier.tier-master { color: #f472b6; border-color: #f472b6; box-shadow: 0 0 14px rgba(244,114,182,.65); animation: tier-pulse 2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .radar-ring, .radar-core, .pvp-result-emoji, .tier-gold .pvp-tier-badge,
  .tier-diamond .pvp-tier-badge, .tier-master, .tier-platinum::after, .quiz-timer.timer-low { animation: none !important; }
}

/* Tournaments (r29) */
.quick-grid.q5 { grid-template-columns: repeat(3, 1fr); }
.t-banner { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; padding: .85rem 1rem; border-radius: 14px;
  background: linear-gradient(120deg, rgba(245,158,11,.16), rgba(239,68,68,.10));
  border: 1px solid color-mix(in srgb, #f59e0b 45%, transparent); color: inherit; text-decoration: none; }
.t-banner .t-banner-ico { font-size: 1.6rem; }
.t-banner .t-banner-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.t-banner.t-live { border-color: #ef4444; }
.t-banner.t-live .t-banner-ico { animation: timer-blink 1.2s infinite; }
.t-card { display: flex; gap: .8rem; margin-bottom: .7rem; padding: .7rem; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); color: inherit; text-decoration: none; }
.t-card-img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.t-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.t-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.t-card-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-card-meta { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.t-detail-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 12px; margin-bottom: .8rem; }
.t-detail-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; }
.t-detail-head .page-title { margin: 0; }
.t-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .8rem; margin: .8rem 0; }
.t-facts > div { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .7rem; background: var(--bg); border-radius: 10px; }
.t-facts span { font-size: .75rem; color: var(--muted); }
.t-facts strong { font-size: .9rem; }
.t-prizes { display: flex; gap: .8rem; align-items: center; padding: .6rem .8rem; border-radius: 10px;
  background: linear-gradient(120deg, rgba(212,160,23,.14), rgba(245,158,11,.08)); margin-bottom: .8rem; font-weight: 700; }
.t-cta { margin-top: .6rem; }
.lb-list { display: flex; flex-direction: column; gap: .4rem; }
.lb-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; background: var(--bg); }
.lb-rank { font-size: 1.1rem; min-width: 2.2rem; text-align: center; font-weight: 800; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.lb-me { border: 1px solid color-mix(in srgb, #6c3df4 55%, transparent); }
.result-medal { font-size: 3rem; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1rem 0; }
.result-stats > div { display: flex; flex-direction: column; gap: .15rem; padding: .6rem .3rem; background: var(--bg); border-radius: 10px; }
.result-stats strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: .72rem; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: .6rem; color: var(--muted); text-decoration: none; font-size: .9rem; }

@media (prefers-reduced-motion: reduce) {
  .t-banner.t-live .t-banner-ico { animation: none !important; }
}

/* ---------- Support chat widget (player) ---------- */
/* The `hidden` attribute must always win: component classes below set
   display:flex, which otherwise overrides the UA [hidden] rule and makes
   panels/badges impossible to close. */
[hidden] { display: none !important; }
.support-fab {
  position: fixed; right: max(14px, calc(50vw - 215px + 14px)); bottom: 78px; z-index: 1200;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, #6c3df4, #3b82f6); color: #fff; font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(60, 40, 180, .45);
}
.support-fab .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; border-radius: 11px;
  background: #ef4444; color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
  border: 2px solid var(--bg, #fff);
}
.support-panel {
  position: fixed; right: max(14px, calc(50vw - 215px + 14px)); bottom: 142px; z-index: 1201;
  width: min(360px, calc(100vw - 28px)); height: min(500px, calc(100dvh - 220px));
  min-height: 340px; display: flex; flex-direction: column;
  background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); overflow: hidden;
}
.support-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem .9rem; background: linear-gradient(135deg, #6c3df4, #3b82f6); color: #fff;
}
.support-head strong { flex: 1; font-size: 1rem; }
.support-back, .support-close {
  background: rgba(255, 255, 255, .18); border: none; color: #fff; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; font-size: 1rem; line-height: 1;
}
.support-body { flex: 1; overflow-y: auto; padding: .9rem; }
.support-foot {
  display: flex; gap: .5rem; padding: .6rem .7rem;
  border-top: 1px solid var(--border, #e5e7eb); background: var(--card, #fff);
}
.support-foot input {
  flex: 1; border: 1px solid var(--border, #e5e7eb); border-radius: 10px;
  padding: .55rem .7rem; font-size: .95rem; background: var(--bg, #fff); color: inherit;
}
.support-lang-pick { text-align: center; padding-top: 2.2rem; }
.support-lang-pick p { margin-bottom: 1rem; }
.support-lang-pick .btn { margin-bottom: .6rem; font-size: 1.1rem; padding: .8rem; }
.support-menu { display: flex; flex-direction: column; gap: .55rem; }
.support-hello { font-weight: 600; margin: 0 0 .3rem; }
.support-opt {
  display: flex; align-items: center; gap: .6rem; text-align: left;
  border: 1px solid var(--border, #e5e7eb); background: var(--bg, #f8fafc);
  border-radius: 12px; padding: .7rem .8rem; cursor: pointer; font-size: .95rem; color: inherit;
}
.support-opt:hover { border-color: #6c3df4; }
.support-opt .badge {
  margin-left: auto; min-width: 22px; height: 22px; border-radius: 11px;
  background: #ef4444; color: #fff; font-size: .72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}
.support-live { border-color: #6c3df4; font-weight: 600; }
.support-small { font-size: .85rem; opacity: .85; }
.support-topic h4 { margin: 0 0 .5rem; }
.support-topic p { white-space: pre-line; line-height: 1.55; }
.support-topic .btn { margin-top: 1rem; }
.support-thread { display: flex; flex-direction: column; gap: .55rem; }
.support-msg { max-width: 85%; }
.support-msg.mine { align-self: flex-end; }
.support-msg.theirs { align-self: flex-start; }
.support-msg-who { font-size: .72rem; opacity: .65; margin-bottom: .15rem; }
.support-msg-text {
  padding: .55rem .75rem; border-radius: 12px; font-size: .93rem;
  line-height: 1.45; white-space: pre-line; word-break: break-word;
}
.support-msg.mine .support-msg-text { background: #6c3df4; color: #fff; border-bottom-right-radius: 4px; }
.support-msg.theirs .support-msg-text { background: var(--bg, #f1f5f9); border-bottom-left-radius: 4px; }
.support-closed { margin-top: .8rem; text-align: center; }

/* ---------- Admin support + alerts bell ---------- */
.nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; border-radius: 10px;
  background: #ef4444; color: #fff; font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 6px;
}
.nav-item { display: flex; align-items: center; }
.admin-bell-wrap { position: relative; }
.admin-bell-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 1300;
  width: 260px; background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22); padding: .5rem;
}
.admin-bell-title { font-weight: 700; margin: 0 0 .3rem; padding: .2rem .5rem; font-size: .9rem; }
.admin-bell-row {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .55rem; border-radius: 8px; text-decoration: none; color: inherit; font-size: .92rem;
}
.admin-bell-row:hover { background: var(--bg, #f1f5f9); }
.admin-bell-row strong { font-size: 1rem; }
.support-admin-thread {
  display: flex; flex-direction: column; gap: .6rem;
  max-height: 52vh; overflow-y: auto; padding: 1rem;
  border: 1px solid var(--border, #e5e7eb); border-radius: 12px;
  background: var(--bg, #f8fafc); margin-bottom: 1rem;
}
.support-admin-thread .support-msg { max-width: 80%; }
.support-admin-reply { display: flex; gap: .6rem; margin-bottom: .5rem; }
.support-admin-reply input {
  flex: 1; border: 1px solid var(--border, #e5e7eb); border-radius: 10px;
  padding: .6rem .8rem; font-size: .95rem; background: var(--card, #fff); color: inherit;
}
tr.row-unread td { background: rgba(108, 61, 244, .06); }

/* ---------- 18. Admin responsive polish (r46) ---------- */
.ptc-card { margin-bottom: .9rem; }
.ptc-head { display: flex; gap: .75rem; align-items: center; }
.ptc-meta { flex: 1; min-width: 0; }
.ptc-title { margin: 0 0 .25rem; font-size: 1rem; }
.ptc-body { margin-top: .75rem; }
.ptc-timer .countdown { font-weight: 700; color: var(--primary); }
.ptc-msg { margin: .5rem 0 0; }

.form-grid { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
}
.form-check { display: flex; align-items: center; gap: .5rem; padding: .6rem 0; }

/* Phones: make the admin panel comfortable one-handed. */
@media (max-width: 640px) {
  .admin-content { padding: .9rem; }
  .page-title { font-size: 1.25rem; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
  .page-head-actions .btn { flex: 1 1 auto; text-align: center; }
  .table { font-size: .8rem; }
  .table th, .table td { padding: .5rem .6rem; }
  .td-actions { white-space: nowrap; }
  .td-actions .btn { margin: .15rem .1rem; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .topbar-title { font-size: 1rem; }
  .row.gap { flex-direction: column; }
  .admin-bell-drop { right: -3.5rem; }
}

/* ---------- PTC verification popup (r47) ---------- */
.ptc-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 6, 20, .62); padding: 1rem;
}
.ptc-modal-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1.5rem; width: 100%; max-width: 340px; text-align: center;
}
.ptc-modal-title { margin: 0 0 .5rem; font-size: 1.1rem; }
.ptc-code {
  font-size: 2rem; font-weight: 800; letter-spacing: .6rem; text-indent: .6rem;
  color: var(--primary); background: var(--bg);
  border: 1px dashed var(--primary); border-radius: var(--radius-sm);
  padding: .6rem .4rem; margin: .75rem 0; user-select: none;
}
.ptc-code-input {
  width: 100%; padding: .7rem; font-size: 1.25rem; text-align: center;
  letter-spacing: .4rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg); color: var(--text);
}
.ptc-modal-err { color: var(--danger); min-height: 1.25em; margin: .5rem 0 0; }
.ptc-modal-actions { display: flex; gap: .6rem; margin-top: .75rem; }
.ptc-modal-actions .btn { flex: 1; }

/* PTC in-page ad frame: sandboxed iframe with the earning countdown. */
.ptc-frame-wrap {
  position: relative; margin-top: .6rem; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border, #e5e7eb); background: #fff;
}
.ptc-frame { width: 100%; height: 320px; border: 0; display: block; background: #fff; }
.ptc-frame-tall .ptc-frame { height: min(62vh, 560px); min-height: 340px; }

/* Dedicated PTC view page: header only — footer and bottom nav are hidden,
   and the ad frame fills the whole screen below the header. */
.ptc-view-page .app-footer,
.ptc-view-page .bottom-nav { display: none !important; }
.ptc-view-page .app-main { padding-bottom: 1rem; }
#ptc-view { display: flex; flex-direction: column; min-height: calc(100dvh - var(--header-h, 60px) - 2rem); }
#ptc-view > .card { flex: 1; display: flex; flex-direction: column; margin-bottom: 0; }
#ptc-view .ptc-frame-tall { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#ptc-view .ptc-frame-tall .ptc-frame { flex: 1; height: auto; min-height: 320px; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--primary); font: inherit; text-decoration: underline;
}
.ptc-frame-timer {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: rgba(20, 10, 40, .88); color: #fff;
  padding: .35rem .75rem; border-radius: 999px;
  font-size: .85rem; font-weight: 700; pointer-events: none;
}
.ptc-frame-alt { margin: .5rem 0 0; }
.ptc-frame-alt a { color: var(--primary); }
.ptc-done { margin-top: .6rem; }
.ptc-done .btn { width: 100%; }

/* Broadcast ticker: right-to-left looping marquee on the home page. */
.ticker {
  overflow: hidden; border-radius: 12px; margin-bottom: .8rem;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark, #4338ca));
  color: #fff; direction: ltr;
}
.ticker-track {
  display: inline-flex; white-space: nowrap; padding: .55rem 0;
  animation: ticker-scroll 28s linear infinite; will-change: transform;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; padding: 0 1.5rem; font-size: .9rem; font-weight: 600; }
.ticker-item::before { content: "📢"; margin-right: .5rem; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* Daily streak reward editor (Admin → Settings → Rewards). */
.streak-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .5rem; margin: .5rem 0; }
.streak-cell { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; font-weight: 600; }
.streak-cell input { width: 100%; padding: .45rem .5rem; }

/* PTC header countdown gate. */
.ptc-gate { margin-bottom: .9rem; }
.ptc-gate-row { display: flex; gap: .7rem; align-items: center; }
.ptc-gate-ico { font-size: 1.6rem; }
.ptc-gate-text { flex: 1; }
.ptc-gate-msg { font-size: .92rem; }
.ptc-gate-bar { height: 8px; border-radius: 99px; background: var(--bg); margin-top: .45rem; overflow: hidden; }
.ptc-gate-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-dark, #4338ca)); transition: width 1s linear; }
