:root {
  /* Light theme — default, Polymarket-like */
  --bg: #ffffff;
  --bg-2: #f7f8fa;
  --bg-3: #eef0f4;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e4e7ec;
  --border-strong: #cbd0d8;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #ff6b1a;          /* WorldPari warm orange */
  --accent-2: #e15510;
  --accent-soft: #fff1e6;     /* light orange for chip / hover backgrounds */
  --green: #10b981;
  --green-2: #059669;
  --red: #ef4444;
  --red-2: #dc2626;
  --blue: #3a82f7;
  --yes: #10b981;
  --yes-bg: #d1fae5;
  --yes-bg-strong: #a7f3d0;
  --no: #ef4444;
  --no-bg: #fee2e2;
  --no-bg-strong: #fecaca;
  --shadow: 0 1px 2px rgba(15,23,42,0.04), 0 4px 12px rgba(15,23,42,0.06);
  --shadow-lg: 0 4px 8px rgba(15,23,42,0.06), 0 16px 32px rgba(15,23,42,0.10);
}

:root[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-2: #11171f;
  --bg-3: #171f2b;
  --panel: #131a24;
  --card: #131a24;
  --border: #1f2a38;
  --border-strong: #2b3a4f;
  --text: #e7edf5;
  --muted: #8a95a8;
  --accent: #ffa040;
  --accent-2: #ff7a18;
  --accent-soft: rgba(255, 122, 24, 0.18);
  --green: #2fbf71;
  --green-2: #1f8f51;
  --red: #ef4a4a;
  --red-2: #d83a3a;
  --blue: #3a82f7;
  --yes: #2fbf71;
  --yes-bg: rgba(47,191,113,0.12);
  --yes-bg-strong: rgba(47,191,113,0.22);
  --no: #ef4a4a;
  --no-bg: rgba(239,74,74,0.10);
  --no-bg-strong: rgba(239,74,74,0.20);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

/* The HTML hidden attribute must override any display: flex/grid on classed elements. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-2);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  min-height: 100vh;
  font-size: 14px;
}
body {
  /* Subtle WorldPari pattern: soft orange dots fading into the background */
  background-image:
    radial-gradient(rgba(255, 107, 26, 0.07) 1.2px, transparent 1.5px),
    radial-gradient(rgba(255, 107, 26, 0.04) 1px, transparent 1.2px);
  background-size: 28px 28px, 14px 14px;
  background-position: 0 0, 14px 14px;
}
:root[data-theme="dark"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(255, 122, 24, 0.06) 1.2px, transparent 1.5px),
    radial-gradient(rgba(255, 122, 24, 0.03) 1px, transparent 1.2px),
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 122, 24, 0.05), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(58, 130, 247, 0.06), transparent 60%);
  background-size: 28px 28px, 14px 14px, 100% 100%, 100% 100%;
  background-position: 0 0, 14px 14px, 0 0, 0 0;
}

/* --- Animations --------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.85); }
  70% { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(239, 74, 74, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 74, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 74, 74, 0); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}
@keyframes flashGreen {
  0% { background: rgba(47, 191, 113, 0); }
  30% { background: rgba(47, 191, 113, 0.25); }
  100% { background: rgba(47, 191, 113, 0); }
}
@keyframes flashRed {
  0% { background: rgba(239, 74, 74, 0); }
  30% { background: rgba(239, 74, 74, 0.25); }
  100% { background: rgba(239, 74, 74, 0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Top bar ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.4s ease;
}
:root[data-theme="dark"] .topbar {
  background: linear-gradient(180deg, rgba(17, 23, 31, 0.95), rgba(17, 23, 31, 0.85));
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.logo-mark {
  font-size: 22px;
  display: inline-block;
  animation: wiggle 4s ease-in-out infinite;
  transform-origin: 50% 80%;
}
.logo-text {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
}
.logo-text .accent { color: var(--accent); }
.logo-sub {
  color: var(--muted);
  font-size: 12px;
  margin-left: 6px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}
.tab:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(255, 107, 26, 0.28);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.lang-picker:hover { border-color: var(--accent); }
.lang-picker select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* Auth block */
.auth-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.auth-button:hover { filter: brightness(1.08); }
.auth-button:active { transform: translateY(1px); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-3);
  cursor: pointer;
  transition: border-color 0.15s ease;
  position: relative;
}
.user-chip:hover { border-color: var(--accent); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name {
  font-size: 13px;
  font-weight: 700;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-balance {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.user-balance.flash-up { animation: flashGreen 0.8s ease; }
.user-balance.flash-down { animation: flashRed 0.8s ease; }
.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: none;
  flex-direction: column;
  min-width: 200px;
  box-shadow: var(--shadow);
  z-index: 6;
  animation: scaleIn 0.12s ease;
  transform-origin: top right;
}
.user-menu.open { display: flex; }
.user-menu button {
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.user-menu button:hover { background: var(--bg-3); }
.user-menu hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.btn-small {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}
.btn-small:hover { color: var(--text); border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.05s ease, filter 0.15s ease;
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  pointer-events: none;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}
.btn-primary:disabled::after { display: none; }

/* --- Layout ------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .coupon { position: static; }
  .topbar { grid-template-columns: auto 1fr; row-gap: 8px; }
  .topbar .tabs { grid-column: 1 / -1; order: 3; }
  .topbar-right { justify-self: end; }
}

.events {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  align-content: start;
}

/* --- Card --------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.35s ease both;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}
.card .card-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,122,26,0.08), rgba(58,130,247,0.05));
  z-index: 0;
  transition: opacity 0.2s ease;
}
.card > * { position: relative; z-index: 1; }
.card.cover .card-bg { background-size: cover; background-position: center; opacity: 0.32; filter: blur(0.5px); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.card-emoji {
  font-size: 24px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.card-cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}
.card-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}
.card-author {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
.card-author .ava {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--border);
}
.card-author .ava img { width: 100%; height: 100%; object-fit: cover; }
.card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn.live {
  border-color: var(--red);
  color: var(--red);
  font-weight: 700;
}
.icon-btn.live::before {
  content: "●";
  margin-right: 4px;
  display: inline-block;
  border-radius: 50%;
  background: var(--red);
  color: var(--red);
  width: 8px; height: 8px;
  animation: pulseDot 1.6s infinite;
}

.outcomes-list {
  display: grid;
  gap: 6px;
}
.outcome {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.08s ease, background 0.15s ease;
  text-align: inherit;
  color: inherit;
  font: inherit;
}
.outcome:hover { border-color: var(--accent); transform: translateY(-1px); }
.outcome:active { transform: translateY(0); }
.outcome.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 122, 26, 0.18), rgba(255, 122, 26, 0.05));
  animation: popIn 0.18s ease;
}
.outcome-label {
  font-size: 13px;
}
.outcome-odds {
  font-weight: 800;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  min-width: 44px;
  text-align: right;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  gap: 8px;
}
.card-delete {
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-size: 12px;
}
.card-delete:hover { color: var(--red); }

/* --- Coupon ------------------------------------------------------------- */
.coupon {
  position: sticky;
  top: 76px;
  align-self: start;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s ease;
}
.coupon-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.coupon-header h2 { margin: 0; font-size: 16px; }
.coupon-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}
.coupon-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 8px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.coupon-item {
  padding: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 4px;
  position: relative;
  animation: scaleIn 0.18s ease;
}
.coupon-item-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  padding-right: 22px;
}
.coupon-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.coupon-item-row .odds { color: var(--accent-2); font-weight: 800; }
.coupon-item-remove {
  background: transparent;
  color: var(--muted);
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0 6px;
  position: absolute;
  top: 6px;
  right: 6px;
}
.coupon-item-remove:hover { color: var(--red); }

.coupon-summary {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.coupon-summary .row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.coupon-summary .row.big {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.coupon-summary .row.big span:last-child { color: var(--green); }
.stake-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.stake-row input {
  width: 120px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stake-row input:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- FAB ---------------------------------------------------------------- */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(255, 122, 26, 0.35);
  z-index: 4;
  font-size: 14px;
  animation: scaleIn 0.4s ease;
  transition: transform 0.2s ease;
}
.fab:hover { filter: brightness(1.05); transform: translateY(-2px) scale(1.02); }

/* --- Modal -------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal-backdrop[hidden] { display: none; }
.toast[hidden] { display: none; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: scaleIn 0.18s ease;
}
.modal-narrow { max-width: 420px; }
.modal-wide { max-width: 1000px; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.field input,
.field textarea,
.field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.field input[type="color"] {
  height: 38px;
  padding: 4px;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.style-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-preview {
  margin-top: 4px;
  border-radius: 10px;
  height: 70px;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  filter: saturate(1.1);
}
.outcomes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.outcome-row {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  gap: 6px;
}
.outcome-row input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 13px;
}
.outcome-row button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 0 10px;
  cursor: pointer;
}
.outcome-row button:hover { color: var(--red); border-color: var(--red); }
.hint {
  font-size: 12px;
  color: var(--muted);
}

/* Auth modal */
.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-3);
  border-radius: 10px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.auth-tab.active {
  background: var(--accent);
  color: #ffffff;
}
.auth-avatar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.emoji-grid button {
  aspect-ratio: 1 / 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.12s ease;
}
.emoji-grid button:hover { transform: scale(1.1); border-color: var(--accent); }
.emoji-grid button.selected {
  background: var(--accent);
  border-color: var(--accent);
}

/* Quick amount chips */
.quick-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }

/* --- Resolve modal ------------------------------------------------------ */
.resolve-event {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  animation: slideUp 0.25s ease both;
}
.resolve-event:nth-child(1) { animation-delay: 0.05s; }
.resolve-event:nth-child(2) { animation-delay: 0.18s; }
.resolve-event:nth-child(3) { animation-delay: 0.32s; }
.resolve-event:nth-child(4) { animation-delay: 0.46s; }
.resolve-event:nth-child(5) { animation-delay: 0.6s; }
.resolve-event .res-title { font-size: 13px; font-weight: 700; }
.resolve-event .res-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.resolve-event.win { border-color: var(--green); }
.resolve-event.lose { border-color: var(--red); }
.resolve-summary {
  margin-top: 8px;
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 18px;
  animation: popIn 0.4s ease 0.5s both;
}
.resolve-summary.win {
  background: linear-gradient(180deg, rgba(47, 191, 113, 0.15), rgba(47, 191, 113, 0.05));
  color: var(--green);
  border: 1px solid var(--green);
}
.resolve-summary.lose {
  background: linear-gradient(180deg, rgba(239, 74, 74, 0.15), rgba(239, 74, 74, 0.05));
  color: var(--red);
  border: 1px solid var(--red);
}

/* --- History ------------------------------------------------------------ */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  animation: slideUp 0.25s ease both;
}
.history-item.win { border-left: 4px solid var(--green); }
.history-item.lose { border-left: 4px solid var(--red); }
.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.history-status {
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 12px;
}
.history-status.win { color: var(--green); }
.history-status.lose { color: var(--red); }
.history-legs {
  display: grid;
  gap: 4px;
  font-size: 12.5px;
}
.history-leg {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}
.history-leg.win .leg-outcome { color: var(--green); }
.history-leg.lose .leg-outcome { color: var(--red); }
.history-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 4px;
}

/* --- Stream modal ------------------------------------------------------- */
.stream-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  padding: 12px 16px 16px 16px;
}
@media (max-width: 760px) {
  .stream-body { grid-template-columns: 1fr; }
}
.stream-canvas-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.stream-canvas-wrap canvas,
.stream-canvas-wrap iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}
.live-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
  padding: 4px 8px;
  z-index: 2;
}
.live-pill .live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  animation: pulseDot 1.4s infinite;
}
.stream-status {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  z-index: 2;
}
.stream-meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.stream-meta h4 {
  color: var(--text);
  margin: 0 0 4px 0;
  font-size: 15px;
}

.stream-right {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
  min-height: 300px;
  max-height: 480px;
}
.chat-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 13px;
}
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.chat-msg {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 6px;
  animation: slideUp 0.18s ease;
}
.chat-msg .ava {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  overflow: hidden;
}
.chat-msg .ava img { width: 100%; height: 100%; object-fit: cover; }
.chat-msg .body .name { font-weight: 700; color: var(--accent-2); margin-right: 4px; }
.chat-msg .body .ts { color: var(--muted); font-size: 10.5px; margin-left: 4px; }
.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form button {
  padding: 9px 14px;
  font-size: 13px;
}
.chat-locked {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
}

/* Streams list (tab) */
.stream-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  animation: slideUp 0.25s ease both;
}
.stream-card:hover { transform: translateY(-2px); border-color: var(--red); }
.stream-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #1a1f2c, #0d111a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  position: relative;
  overflow: hidden;
}
.stream-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(239,74,74,0.2), transparent 60%);
}
.stream-card-info { display: flex; flex-direction: column; gap: 4px; }
.stream-card-info h3 { margin: 0; font-size: 14px; }
.stream-card-info .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.stream-card-info .live-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--red);
  text-transform: uppercase;
}
.stream-card-info .live-tag::before {
  content: "●";
  color: var(--red);
  animation: pulseDot 1.4s infinite;
}

/* --- Toast & confetti --------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translateX(-50%);
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 20;
  max-width: 80vw;
  animation: scaleIn 0.18s ease;
}
.toast.win { border-color: var(--green); }
.toast.lose { border-color: var(--red); }
.toast.info { border-color: var(--accent); }

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}

/* --- Empty state ------------------------------------------------------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  grid-column: 1 / -1;
  animation: fadeIn 0.3s ease;
}
.empty h3 { margin: 0 0 6px 0; color: var(--text); }

/* --- RTL tweaks --------------------------------------------------------- */
[dir="rtl"] .topbar { direction: rtl; }
[dir="rtl"] .stake-row input { text-align: left; }

/* ============================================================
 * v2: backend-powered UI extras
 * ============================================================ */

/* Search input in topbar */
.search-input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  width: 160px;
  transition: width 0.2s ease, border-color 0.2s ease;
}
.search-input:focus { width: 220px; border-color: var(--accent); outline: none; }

/* User chip in topbar */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px;
}
.balance {
  font-weight: 700; padding: 0 8px; min-width: 80px; text-align: center;
  transition: background 0.6s ease;
}
.flash-green { animation: flashGreen 0.7s ease; border-radius: 6px; }
.flash-red { animation: flashRed 0.7s ease; border-radius: 6px; }
.balance-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; font-weight: 700;
}
.balance-btn:hover { background: var(--accent); border-color: var(--accent); color: #000; }
.user-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; color: var(--text); cursor: pointer;
  padding: 4px 10px; border-radius: 999px;
}
.user-btn:hover { background: var(--bg-3); }
.user-btn .username { font-weight: 600; max-width: 80px; overflow: hidden; text-overflow: ellipsis; }

/* Hamburger (mobile only) */
.hamburger {
  display: none;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 6px 10px; font-size: 18px; cursor: pointer;
}

/* Profile modal extras */
.profile-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.profile-avatar { font-size: 56px; line-height: 1; }
.profile-username { font-weight: 700; font-size: 18px; }
.profile-balance { color: var(--accent); font-weight: 700; }
.profile-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0;
}
.profile-stats > div {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; text-align: center;
}
.profile-stats b { display: block; font-size: 18px; }
.profile-stats span { color: var(--muted); font-size: 11px; }
.section-title { margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
.row-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Recovery code display */
.recovery-code {
  font-family: 'Courier New', monospace;
  font-size: 28px; font-weight: 700;
  background: var(--bg-3); border: 1px dashed var(--accent);
  padding: 16px; text-align: center; letter-spacing: 4px;
  margin: 12px 0; border-radius: 10px; color: var(--accent);
}

/* History bet cards */
.history-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.history-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.history-filters .btn-ghost.active { border-color: var(--accent); color: var(--accent); }
.bet-card {
  background: var(--card, var(--panel)); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; animation: slideUp 0.3s ease;
}
.bet-card.status-won { border-left: 3px solid var(--green); }
.bet-card.status-lost { border-left: 3px solid var(--red); }
.bet-card.status-pending { border-left: 3px solid var(--blue); }
.bet-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.bet-leg { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.bet-leg.leg-won { color: var(--green); }
.bet-leg.leg-lost { color: var(--red); opacity: 0.7; }
.bet-leg.leg-pending { color: var(--blue); }
.leg-pick { color: var(--muted); }
.bet-foot { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 12px; }

/* Resolve modal */
.resolve-head { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.resolve-leg { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.resolve-leg.leg-won { color: var(--green); }
.resolve-leg.leg-lost { color: var(--red); }
.resolve-leg.leg-pending { color: var(--blue); }

/* Coupon items */
.coupon-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; margin-bottom: 6px;
  animation: slideUp 0.2s ease;
}
.ci-title { font-weight: 600; font-size: 13px; }
.ci-pick { color: var(--muted); font-size: 12px; }
.ci-right { display: flex; align-items: center; gap: 6px; }
.ci-odds { color: var(--accent); font-weight: 700; }

/* Event card extras */
.event-card { padding: 14px; border-radius: 14px; margin-bottom: 12px; animation: slideUp 0.3s ease; }
.event-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.event-left { display: flex; align-items: center; gap: 10px; }
.event-emoji { font-size: 32px; }
.event-title { font-weight: 700; }
.event-meta { color: var(--muted); font-size: 11px; }
.event-right { display: flex; gap: 6px; }
.event-desc { color: var(--muted); margin: 4px 0 8px; font-size: 13px; }
.event-when { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.outcomes { display: flex; gap: 8px; flex-wrap: wrap; }
.outcome {
  flex: 1 1 30%; min-width: 100px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 10px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.outcome:hover { background: var(--bg-3); transform: translateY(-1px); border-color: var(--accent); }
.outcome.selected { background: var(--accent); color: #000; border-color: var(--accent); }
.outcome.selected .outcome-odds { color: #000; }
.outcome-odds { color: var(--accent); font-weight: 700; }

/* Outcome draft (in create-event modal) */
.outcome-draft { display: grid; grid-template-columns: 1fr 90px 36px; gap: 6px; margin-bottom: 6px; }
.outcome-draft input { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 6px 8px; border-radius: 6px; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* Event preview (create modal) */
.event-preview {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; margin-bottom: 10px; min-height: 60px;
}
.event-preview-emoji { font-size: 32px; }
.event-preview-title { font-weight: 700; }
.event-preview-desc { color: rgba(255,255,255,0.85); font-size: 13px; }

/* Stream modal */
.modal-wide { max-width: 900px; width: 90vw; }
.stream-body { display: grid; grid-template-rows: auto auto 1fr; gap: 8px; max-height: 80vh; }
.stream-video { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.stream-video canvas, .stream-video iframe { width: 100%; height: 100%; display: block; border: 0; }
.stream-controls { display: flex; gap: 8px; }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; color: var(--red); margin-right: 8px; font-weight: 700; font-size: 13px; }
.live-indicator .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulseDot 1.5s infinite; }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 240px; max-height: 320px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { display: flex; align-items: flex-start; gap: 8px; animation: slideUp 0.2s ease; }
.chat-avatar { font-size: 22px; }
.chat-author { font-weight: 600; font-size: 12px; color: var(--accent); }
.chat-text { font-size: 13px; word-break: break-word; }
.chat-input { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; background: var(--bg-3); border: 1px solid var(--border); color: var(--text); padding: 8px; border-radius: 8px; }

/* Quick amounts */
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick-amounts button { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 4px 10px; border-radius: 999px; cursor: pointer; font-size: 12px; }
.quick-amounts button:hover { border-color: var(--accent); color: var(--accent); }

/* Emoji grid in profile */
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-cell { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 4px; cursor: pointer; font-size: 22px; }
.emoji-cell:hover, .emoji-cell.selected { background: var(--accent); border-color: var(--accent); }

/* Confetti */
.confetti {
  position: fixed; top: -10px; width: 8px; height: 14px;
  z-index: 100; pointer-events: none;
  animation: confettiFall 2.5s linear forwards;
  border-radius: 2px;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0.3; }
}

/* Loader */
.loader {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200;
}
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* Toasts */
.toasts {
  position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px;
  z-index: 150;
}
.toasts .toast {
  position: static; transform: translateY(20px); opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  background: var(--panel); border: 1px solid var(--border); padding: 10px 14px; border-radius: 10px;
  max-width: 320px; font-size: 13px; box-shadow: var(--shadow);
}
.toasts .toast.show { opacity: 1; transform: translateY(0); }
.toasts .toast.ok { border-color: var(--green); }
.toasts .toast.err { border-color: var(--red); }

/* Empty hint */
.empty-hint { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 48px 16px; border: 1px dashed var(--border); border-radius: 12px; animation: fadeIn 0.3s ease; }
.empty-hint .title { color: var(--text); font-weight: 700; margin: 8px 0 4px; }
.empty-hint .hint { font-size: 13px; }

/* Auth tabs */
.auth-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.auth-tab { flex: 1; padding: 8px; background: var(--bg-2); border: 1px solid var(--border); color: var(--muted); cursor: pointer; border-radius: 8px; font-size: 13px; }
.auth-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ----- Responsive ----- */
@media (max-width: 980px) {
  .layout { display: flex; flex-direction: column; padding: 12px; }
  .coupon { position: sticky; bottom: 0; max-height: 50vh; overflow: auto; z-index: 4; }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr auto auto;
    grid-template-rows: auto auto;
    gap: 8px; padding: 8px 12px;
  }
  .logo-sub { display: none; }
  .tabs {
    grid-column: 1 / -1; order: 2;
    overflow-x: auto; padding-bottom: 4px;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { height: 0; }
  .tabs .tab { white-space: nowrap; flex-shrink: 0; }
  .topbar-right { gap: 6px; flex-wrap: wrap; }
  .search-input { display: none; }
  .hamburger { display: inline-block; }
  body.menu-open .search-input { display: inline-block; width: 100%; }
  .lang-picker { font-size: 12px; }
  .user-btn .username { display: none; }
  .balance { min-width: 60px; font-size: 12px; }
  .fab { bottom: auto; top: 64px; right: 12px; padding: 8px 12px; font-size: 13px; }
  .modal { width: 94vw; max-width: 100%; max-height: 92vh; overflow: auto; }
  .modal-wide { width: 96vw; max-width: 100%; }
  .row-fields { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, 1fr); }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .stream-body { max-height: 86vh; }
  .chat { min-height: 180px; max-height: 220px; }
  .outcomes { flex-direction: column; }
  .outcome { flex: 1 1 100%; }
  .outcome-draft { grid-template-columns: 1fr 80px 32px; }
  .toasts { left: 8px; right: 8px; bottom: 8px; }
  .toasts .toast { max-width: 100%; }
}

/* Stake row in coupon */
.stake-row { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.stake-row input { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); padding: 8px; border-radius: 8px; font-size: 16px; font-weight: 600; }

/* Coupon header */
.coupon { display: flex; flex-direction: column; gap: 6px; }
.coupon-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }


/* ----- Virtual money disclaimer banner ----- */
.virtual-banner {
  background: linear-gradient(90deg, #ffce3a22, #ff7a1822);
  color: #ffce3a;
  text-align: center;
  font-size: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid #ffce3a44;
  letter-spacing: 0.02em;
  position: sticky; top: 0; z-index: 60;
}

/* ----- Avatar upload widget ----- */
.avatar-upload-row {
  display: flex; align-items: center; gap: 12px; margin: 6px 0 10px;
}
.avatar-upload-preview {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--bg-2); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; line-height: 1; overflow: hidden;
  background-size: cover; background-position: center;
}
.avatar-upload-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.avatar-upload-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ----- Captcha widget ----- */
.captcha-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; min-height: 40px;
}
.captcha-question {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 18px; font-weight: 700;
  background: linear-gradient(90deg, #ff7a18, #3a8dff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: 0.05em;
  flex: 0 0 auto; padding: 4px 8px;
  border-right: 1px dashed var(--border);
}
.captcha-row input {
  flex: 1; background: transparent; border: none;
  color: var(--text); font-size: 16px; font-weight: 600; outline: none;
}
.captcha-row button { padding: 4px 8px; font-size: 16px; }

/* Avatar in chat / topbar — show photo if avatar_url is present */
.avatar-img {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  vertical-align: middle;
}
.user-btn .avatar-img { width: 24px; height: 24px; }
.chat-msg .avatar-img { width: 28px; height: 28px; }
.event-card .author-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Stream video element */
.stream-video video { width: 100%; max-height: 50vh; background: #000; border-radius: 8px; }

/* Mute / banned label */
.user-banned-pill { background: var(--red); color: white; padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.user-mod-pill { background: #3a8dff; color: white; padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-left: 4px; }
.user-admin-pill { background: linear-gradient(90deg,#ff7a18,#ff3a8d); color: white; padding: 2px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; margin-left: 4px; }

/* ============================================================
   POLYMARKET-STYLE OVERRIDES (light theme = default)
   These come last so they win the cascade over older rules.
   ============================================================ */

/* Theme toggle button in topbar */
.theme-toggle {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(20deg); }

/* Topbar — slightly cleaner Polymarket look */
.topbar {
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.logo-text { color: var(--text); }
.logo-text .accent { color: var(--accent); }
/* keep logo wiggle (overrides Polymarket-flat look) */

/* Tab chips */
.tabs { padding: 4px 0; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  padding: 7px 14px;
}
.tab:hover {
  background: var(--bg-3);
  border-color: transparent;
  color: var(--text);
  transform: none;
}
.tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(255, 107, 26, 0.32);
}

/* Layout background */
.layout { background: transparent; }

/* Event grid */
.events {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  padding: 20px;
}
@media (max-width: 720px) {
  .events { padding: 12px; gap: 10px; grid-template-columns: 1fr; }
}

/* Polymarket-like card */
.event-card {
  position: relative;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-left: 4px solid var(--accent) !important;
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-card:hover {
  transform: translateY(-3px) rotate(-0.3deg);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent) !important;
}
.event-card:hover .event-emoji {
  transform: scale(1.08) rotate(-6deg);
}
.event-emoji {
  transition: transform 0.2s ease;
}

/* Header: emoji, title, optional category pill */
.event-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.event-left { display: flex; gap: 12px; align-items: flex-start; flex: 1; min-width: 0; }
.event-emoji {
  font-size: 28px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-3);
  border-radius: 10px;
  flex-shrink: 0;
}
.event-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.event-right { display: flex; gap: 6px; flex-shrink: 0; }

/* Compact ghost buttons in card header */
.event-card .btn-ghost.btn-sm {
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11px;
  background: var(--bg-3);
  color: var(--muted);
  border: 1px solid transparent;
}
.event-card .btn-ghost.btn-sm:hover { color: var(--text); border-color: var(--border); }

.event-desc {
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-when { font-size: 11px; color: var(--muted); }

/* === BINARY (Yes/No) RENDER — main feed style === */
.outcomes.binary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}
.outcomes.binary .outcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 14px 8px;
  border-radius: 14px;
  border: 2px solid;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease, box-shadow 0.18s ease;
  min-height: 72px;
}
.outcomes.binary .outcome:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.outcomes.binary .outcome.yes {
  background: var(--yes-bg);
  border-color: var(--yes-bg-strong);
  color: var(--green-2);
}
.outcomes.binary .outcome.yes:hover {
  background: var(--yes-bg-strong);
  filter: brightness(0.97);
}
.outcomes.binary .outcome.no {
  background: var(--no-bg);
  border-color: var(--no-bg-strong);
  color: var(--red-2);
}
.outcomes.binary .outcome.no:hover {
  background: var(--no-bg-strong);
  filter: brightness(0.97);
}
.outcomes.binary .outcome.selected {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.outcomes.binary .outcome:active { transform: translateY(1px); }
.outcome-pct {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.outcome-action {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.85;
  font-weight: 700;
}
.outcome-odds-pill {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 1px;
}

/* === MULTI (3+ outcomes) — used for community / WTI-style === */
.outcomes.multi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}
.outcomes.multi .outcome {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  font-size: 13px;
  text-align: left;
}
.outcomes.multi .outcome:hover { border-color: var(--accent); background: var(--bg-3); }
.outcomes.multi .outcome.selected {
  border-color: var(--accent);
  background: var(--yes-bg);
}
.outcomes.multi .outcome-label-multi { color: var(--text); font-weight: 600; }
.outcomes.multi .outcome-pct-multi {
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}
.outcomes.multi .outcome-buy {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.outcomes.multi .outcome-buy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Volume / footer of card */
.event-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.event-footer .vol-label { display: flex; gap: 4px; align-items: center; }
.event-footer .vol-amount {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.event-card .live-pill {
  background: var(--red);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.event-card .live-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: white; animation: pulseDot 1.5s infinite;
}

/* Coupon — light-theme tweaks */
.coupon { background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.coupon-empty, .empty-hint { color: var(--muted); }

/* Virtual money disclaimer banner */
.virtual-banner {
  background: #fff8d4;
  color: #644a00;
  border-bottom: 1px solid #f5d76e;
}
:root[data-theme="dark"] .virtual-banner {
  background: rgba(255, 200, 50, 0.12);
  color: #ffd97a;
  border-bottom: 1px solid rgba(255, 200, 50, 0.3);
}

/* Search input */
.search-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  width: 200px;
}
.search-input:focus { outline: none; border-color: var(--accent); }

/* Lang picker matches search */
.lang-picker { background: var(--bg-3); }

/* Buttons readability fix on light theme */
.btn-primary {
  color: white;
  background: var(--accent);
}
.btn-primary:hover { filter: brightness(1.08); }

.auth-button {
  background: var(--accent);
  color: white;
}

/* FAB */
.fab {
  background: var(--accent) !important;
  color: white !important;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35) !important;
}
:root[data-theme="dark"] .fab {
  box-shadow: 0 6px 16px rgba(77, 139, 255, 0.35) !important;
}

/* User chip on light bg */
.user-chip { background: var(--bg-3); border: 1px solid var(--border); }
.user-balance { color: var(--accent-2); }
:root[data-theme="dark"] .user-balance { color: var(--accent); }
