:root {
  --bg: #0c0c16;
  --surface: #161626;
  --surface-2: #1f1f35;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --muted: #9ca3af;
  --indigo: #8b5cf6;
  --violet: #7c3aed;
  --emerald: #10b981;
  --amber: #facc15;
  --rose: #f43f5e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 85% 0%, rgba(139, 92, 246, 0.16), transparent 40%),
    radial-gradient(circle at 10% 10%, rgba(250, 204, 21, 0.1), transparent 35%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 "Inter", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 12, 22, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fef7e6;
  border: 1.5px solid #18181b;
}
.brand small { display: block; color: var(--muted); font-size: 11px; }

.wrap { width: min(1160px, 94vw); margin: 20px auto 40px; }
.panel, .hero, .stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
}
.login { max-width: 460px; margin: 9vh auto; }
.login h1, .hero h1 { margin: 0 0 6px; }
.hidden { display: none !important; }
.eyebrow { color: var(--amber); font-size: 11px; letter-spacing: 2px; font-weight: 900; margin: 0 0 6px; }
.muted { color: var(--muted); margin: 4px 0; }
.tiny { font-size: 12px; }

.inline { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
input, select {
  min-width: 0;
  flex: 1;
  background: #0c0c16;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  color: #fff;
  outline: none;
  font: inherit;
}
input:focus, select:focus { border-color: var(--indigo); }
select option { background: #161626; }

.primary, .ghost, .file-btn, .danger {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  font: inherit;
  text-decoration: none;
}
.ghost, .file-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: #e2e8f0;
  border-radius: 12px;
}
.danger {
  background: rgba(244, 63, 94, 0.18);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fda4af;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(120deg, rgba(139, 92, 246, 0.16), var(--surface));
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.stat small { display: block; color: var(--muted); font-size: 12px; }
.stat b { display: block; font-size: 24px; margin-top: 4px; color: var(--amber); }

.tabs { display: flex; gap: 8px; overflow: auto; margin: 16px 0; }
.tab, .filter {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 10px 15px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 800;
}
.tab.active {
  background: var(--amber);
  color: #111827;
  border-color: var(--amber);
}
.filter.active {
  background: var(--violet);
  color: #fff;
  border-color: var(--indigo);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel h2 { margin: 0 0 4px; }
.tab-panel { margin-bottom: 16px; }
.notice { color: var(--emerald); font-size: 13px; min-height: 18px; font-weight: 700; }
.notice.error { color: var(--rose); }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }

.user-row, .request-row, .round-row, .rank-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 8px;
}
.user-row small, .request-row small { display: block; color: var(--muted); }
.grant-box { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.grant-box h3, .subhead { margin: 20px 0 8px; }
.request-row { grid-template-columns: 1fr auto auto auto; }
.round-row { grid-template-columns: 1fr auto auto; }
.round-row input { max-width: 135px; }

.pill {
  font-size: 11px;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  padding: 5px 10px;
  border-radius: 999px;
  text-transform: capitalize;
}
.pill.pending { background: rgba(139, 92, 246, 0.22); color: #c4b5fd; }
.pill.rejected { background: rgba(244, 63, 94, 0.18); color: #fda4af; }

.publish-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(12, 12, 22, 0.65);
  border: 1px solid var(--line);
}
.publish-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.picker-filters { display: flex; gap: 8px; overflow: auto; margin: 16px 0 8px; }
.picker-filters .filter { padding: 7px 12px; font-size: 12px; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
  padding: 4px;
}
.pick-item { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
.pick-item .playing-card { width: 100%; height: 92px; border: 2px solid transparent; }
.pick-item.active .playing-card {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.35);
}
.pick-coins {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 999px;
}
.pick-coins.has-coins {
  color: var(--amber);
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.playing-card {
  height: 82px;
  width: 58px;
  background: linear-gradient(165deg, #ffffff, #f3f4f6);
  color: #111827;
  border-radius: 9px;
  position: relative;
  padding: 5px;
  font-weight: 900;
  display: inline-block;
  vertical-align: middle;
}
.playing-card.red { color: #e11d48; }
.card-corner { font-size: 11px; line-height: 11px; position: absolute; top: 5px; left: 5px; }
.card-center { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; }
.card-corner.bottom { top: auto; left: auto; bottom: 5px; right: 5px; transform: rotate(180deg); }

.rank-row { grid-template-columns: 44px 1fr auto auto; }
.rank-row .playing-card { transform: scale(0.72); transform-origin: left center; margin-right: -14px; }

.two-col { display: grid; grid-template-columns: 220px 1fr; gap: 12px; }
.chat-users { display: flex; flex-direction: column; gap: 7px; }
.chat-users button {
  text-align: left;
  background: var(--surface-2);
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  cursor: pointer;
}
.chat-users button.active { border-color: var(--amber); background: rgba(250, 204, 21, 0.12); }

.chat-messages {
  height: 320px;
  overflow: auto;
  background: #0c0c16;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 9px;
}
.message {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  max-width: 85%;
  align-self: flex-start;
}
.message.admin {
  align-self: flex-end;
  background: rgba(139, 92, 246, 0.25);
  border-color: rgba(139, 92, 246, 0.45);
}
.message small { display: block; color: var(--muted); font-size: 10px; margin-top: 5px; }
.message img { display: block; max-width: 180px; max-height: 140px; margin-top: 7px; border-radius: 8px; cursor: zoom-in; }
.attach {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 22px;
  cursor: pointer;
  background: var(--surface-2);
}
.image-preview img { max-width: 120px; max-height: 90px; margin-top: 8px; border-radius: 8px; }

.search-panel { margin-bottom: 14px; padding: 14px 18px; }
.search-results { display: grid; gap: 8px; margin-top: 10px; }
.search-results:empty { display: none; margin-top: 0; }
.user-row.clickable { cursor: pointer; }
.user-row.clickable:hover { border-color: var(--amber); }

.chat-user-info {
  background: var(--surface-2);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chat-user-info small { display: block; color: var(--muted); font-size: 11px; }

.profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 16px;
  overflow: auto;
}
.profile-modal-box { width: min(680px, 95vw); max-height: 90vh; overflow: auto; }
.prof-balance-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.prof-balance-bar b { font-size: 22px; color: var(--amber); display: block; }
.prof-list { display: grid; gap: 8px; max-height: 220px; overflow: auto; }
.prof-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.img-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.img-modal-bar { position: fixed; top: 16px; right: 20px; display: flex; gap: 10px; align-items: center; }
.img-modal img { max-width: 92vw; max-height: 84vh; border-radius: 12px; }
.img-modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: #fff;
  font-size: 18px;
}

.file-btn { display: inline-flex; align-items: center; }
footer { text-align: center; color: #6b7280; font-size: 11px; padding: 12px 0 25px; }

@media (max-width: 700px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col, .publish-controls { grid-template-columns: 1fr; }
  .chat-users { flex-direction: row; overflow: auto; }
  .request-row, .round-row, .user-row, .rank-row { grid-template-columns: 1fr auto; }
}

/* Hand-drawn font & tactile button/tab animations for Admin */
@import url('https://fonts.googleapis.com/css2?family=Delius&family=Patrick+Hand&display=swap');

body {
  font-family: "Rosemary", "Delius", system-ui, -apple-system, sans-serif;
}

h1, h2, h3, .subhead {
  font-family: "Rosemary", "Delius", system-ui, sans-serif;
}

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

.tab-panel:not(.hidden) {
  animation: adminTabIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

button {
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
}

button:active {
  transform: scale(0.94);
}
