:root {
  --bg: #0e1116;
  --bg-soft: #151a21;
  --panel: #1a2029;
  --panel-2: #212934;
  --line: #2b3542;
  --text: #e6ebf2;
  --muted: #8d9bad;
  --accent: #4ade80;
  --accent-dim: #2f6f4f;
  --gold: #f5c451;
  --red: #f87171;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- login ---------- */

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #1c2a22 0%, var(--bg) 60%);
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.login-mark { font-size: 40px; line-height: 1; margin-bottom: 12px; }
.login-card form { display: grid; gap: 8px; margin-top: 20px; }
.fineprint { color: var(--muted); font-size: .8rem; margin: 18px 0 0; }
.devlink { display: block; margin-top: 10px; font-weight: 600; }

/* ---------- forms ---------- */

label { font-size: .82rem; color: var(--muted); font-weight: 500; }

input[type=text], input[type=email], input[type=number],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .12);
}
textarea { resize: vertical; min-height: 76px; }
input:disabled, select:disabled, button:disabled { opacity: .55; cursor: not-allowed; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover:not(:disabled) { background: #2a3441; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent-dim); border-color: #3c8b64; color: #eafff3; }
.btn.primary:hover:not(:disabled) { background: #38835d; }
.btn.danger { border-color: #6b2b2b; color: #ffd7d7; background: #3a1f1f; }
.btn.danger:hover:not(:disabled) { background: #4a2626; }
.btn.small { padding: 5px 10px; font-size: .82rem; }
.btn.block { width: 100%; margin-top: 6px; }
.btn.ghost { background: transparent; }

.field { display: grid; gap: 5px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Main column plus a sidebar (ticker / bet slip), stacked on narrow screens. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.split.wide { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: grid; gap: 12px; }

/* Grid/flex items default to min-width:auto, which lets a wide child (a table,
   a long unbroken string) push the item past its track. Zeroing it lets the
   .table-wrap scrollers do their job instead of the page scrolling sideways. */
.stack > *, .split > *, .event-grid > *, .grid2 > *, .grid3 > * { min-width: 0; }

.notice {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.notice.ok { border-color: var(--accent-dim); background: rgba(74, 222, 128, .08); }
.notice.error { border-color: #6b2b2b; background: rgba(248, 113, 113, .09); color: #ffd9d9; }

/* ---------- app shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: rgba(14, 17, 22, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; }
.brand .dice { font-size: 20px; }

/* Wordmark: the first three letters carry the brand colours, "et" stays in the
   surrounding text colour so it works on both the dark app and the login card. */
.wordmark { font-weight: 800; letter-spacing: -.03em; }
.wordmark .l { color: #0171bb; }
.wordmark .s { color: #a3b61c; }
.wordmark .b { color: #f07901; }
.login-card .wordmark { font-size: 1.9rem; }

.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-weight: 520;
  font-size: .9rem;
}
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--panel-2); }

.balance-chip {
  display: flex;
  align-items: baseline;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  font-variant-numeric: tabular-nums;
}
.balance-chip .amount { font-weight: 700; color: var(--accent); }
.balance-chip.flash { animation: pulse .7s ease; }
@keyframes pulse {
  0% { background: rgba(74, 222, 128, .3); }
  100% { background: var(--panel); }
}

.lang-select {
  width: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .82rem;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
}
.lang-select:hover { color: var(--text); }
.login-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.login-card .lang-select { background: var(--bg-soft); }

.bell {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 15px;
}
.bell .dot {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff;
  border-radius: 999px;
  font-size: .66rem; font-weight: 700;
  min-width: 17px; height: 17px;
  display: grid; place-items: center;
  padding: 0 4px;
}

main.page { max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel.tight { padding: 12px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
}
.badge.open { color: var(--accent); border-color: var(--accent-dim); background: rgba(74, 222, 128, .1); }
.badge.closed { color: var(--gold); border-color: #6b551f; background: rgba(245, 196, 81, .1); }
.badge.settled { color: var(--blue); border-color: #2b4a6b; background: rgba(96, 165, 250, .1); }
.badge.cancelled { color: var(--red); border-color: #6b2b2b; background: rgba(248, 113, 113, .1); }
.badge.admin { color: var(--violet); border-color: #4a3b6b; background: rgba(167, 139, 250, .12); }
.badge.win { color: var(--accent); border-color: var(--accent-dim); background: rgba(74, 222, 128, .1); }
.badge.loss { color: var(--red); border-color: #6b2b2b; background: rgba(248, 113, 113, .1); }

/* ---------- event cards ---------- */

.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}
.event-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.event-card:hover { border-color: #3a4757; transform: translateY(-2px); }
.event-card h3 { margin: 0; }
.event-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }

.outcome-bars { display: grid; gap: 6px; }
.outcome-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: .87rem; }
.outcome-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.outcome-label span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.odds { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gold); }
.odds.none { color: var(--muted); font-weight: 500; }
.bar { height: 5px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; grid-column: 1 / -1; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width .4s ease; }

.pool-line { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 9px; }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid rgba(43, 53, 66, .55); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
.table-wrap { overflow-x: auto; }
.pos { color: var(--accent); }
.neg { color: var(--red); }

/* ---------- betting slip ---------- */

.betslip { display: grid; gap: 10px; }
.outcome-picker { display: grid; gap: 7px; }
.pick {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: var(--radius-sm); padding: 10px 13px;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: border-color .12s, background .12s;
}
.pick:hover:not(:disabled) { border-color: #3a4757; }
.pick.selected { border-color: var(--accent); background: rgba(74, 222, 128, .1); }
.quick-stakes { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- bingo ---------- */

/* The board is squared by making the whole grid square and giving every row an
   equal share. Putting `aspect-ratio` on the cells instead lets tall content
   drive their width back up, which pushes the grid past its track widths. */
.bingo-grid {
  display: grid;
  gap: 7px;
  aspect-ratio: 1;
  grid-auto-rows: minmax(0, 1fr);
}

.bingo-cell {
  position: relative;
  /* Take the row's height rather than the content's, so one long entry cannot
     make its whole row taller than the rest of the board. */
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
.bingo-cell:hover { border-color: #3a4757; }
.bingo-cell:active { transform: scale(.985); }
.bingo-cell.blank { border-style: dashed; color: var(--muted); align-items: center; justify-content: center; text-align: center; }
.bingo-cell.done { background: rgba(74, 222, 128, .09); border-color: var(--accent-dim); }
.bingo-cell.in-line { background: rgba(245, 196, 81, .12); border-color: var(--gold); }
.bingo-cell.locked { cursor: default; opacity: .82; }
.bingo-cell.locked:hover { border-color: var(--line); }
.bingo-cell.in-line.locked { opacity: 1; }

.bingo-text {
  font-size: .82rem;
  font-weight: 550;
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.bingo-cell.done .bingo-text { text-decoration: line-through; text-decoration-color: var(--accent-dim); }
.bingo-meta { display: grid; gap: 1px; font-size: .66rem; line-height: 1.3; color: var(--muted); }
.bingo-done-by { color: var(--accent); font-weight: 600; }
.bingo-when { opacity: .75; }
.bingo-empty { font-size: 1.1rem; line-height: 1; opacity: .45; }

.bingo-edit {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: .7rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.bingo-cell:hover .bingo-edit { opacity: 1; }
.bingo-edit:hover { color: var(--text); }

/* On a phone a square is ~57px, too small for the byline — the provenance
   lives in the cell tooltip and the edit dialog instead. */
@media (max-width: 620px) {
  .bingo-cell { padding: 4px; justify-content: center; }
  .bingo-text { font-size: .62rem; -webkit-line-clamp: 4; }
  .bingo-meta { display: none; }
  .bingo-cell.done::after {
    content: '✓';
    position: absolute;
    bottom: 2px; right: 4px;
    font-size: .7rem;
    color: var(--accent);
  }
  .bingo-edit { opacity: 1; width: 18px; height: 18px; font-size: .6rem; }
}

.feed { display: grid; gap: 7px; max-height: 320px; overflow-y: auto; }
.feed-item { font-size: .84rem; color: var(--muted); border-left: 2px solid var(--line); padding: 3px 0 3px 10px; }
.feed-item.fresh { border-left-color: var(--accent); color: var(--text); }

/* ---------- notifications ---------- */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(400px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 60;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.drawer.open { transform: translateX(0); }
.drawer header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer .list { overflow-y: auto; padding: 8px; display: grid; gap: 8px; }
.notif {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 12px;
}
.notif.unread { border-left: 3px solid var(--accent); }
.notif .t { font-weight: 600; font-size: .9rem; }
.notif .b { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.notif .when { font-size: .74rem; color: var(--muted); margin-top: 5px; }

.toast-wrap { position: fixed; bottom: 18px; right: 18px; z-index: 80; display: grid; gap: 9px; width: min(340px, calc(100vw - 36px)); }
.toast {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
  box-shadow: var(--shadow); animation: slidein .2s ease;
}
.toast.ok { border-color: var(--accent-dim); }
.toast.error { border-color: #6b2b2b; }
.toast .t { font-weight: 650; font-size: .9rem; }
.toast .b { font-size: .84rem; color: var(--muted); margin-top: 2px; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: grid; place-items: center; z-index: 70; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 20px;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .v { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 9px 13px; cursor: pointer; font: inherit; font-weight: 550;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .icon { font-size: 34px; display: block; margin-bottom: 10px; opacity: .7; }

.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: .78rem; }

.live-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--accent); display: inline-block; }
.live-dot.off { background: var(--red); }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .nav { order: 3; width: 100%; }
  main.page { padding: 16px 14px 70px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}

/* minmax(0, 1fr) rather than 1fr: a bare 1fr track keeps min-width:auto, so a
   wide table would stretch the column past the viewport instead of scrolling
   inside its own .table-wrap. */
@media (max-width: 1000px) {
  .split, .split.wide { grid-template-columns: minmax(0, 1fr); }
}
