:root {
  color-scheme: dark;
  --bg: #03100b;
  --panel: rgba(7, 27, 19, .86);
  --panel-2: rgba(9, 37, 25, .72);
  --line: rgba(40, 220, 129, .22);
  --line-strong: rgba(40, 220, 129, .48);
  --text: #d9ffe9;
  --muted: #78a88e;
  --green: #28dc81;
  --green-2: #0cae5d;
  --amber: #f4bf58;
  --red: #ff6d7a;
  --shadow: 0 20px 80px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: hidden;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background: radial-gradient(circle at 10% 0%, rgba(13, 160, 83, .18), transparent 32%), radial-gradient(circle at 100% 15%, rgba(3, 91, 53, .16), transparent 28%), linear-gradient(135deg, #03100b, #06150f 52%, #020a07);
}
body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: .14;
  background-image: linear-gradient(rgba(86, 255, 161, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(86, 255, 161, .08) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }
.login-screen { display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(8, 34, 23, .96), rgba(2, 16, 10, .96));
  box-shadow: var(--shadow), 0 0 70px rgba(40, 220, 129, .1);
}
.brand-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.brand-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--green); border-radius: 12px; color: var(--green); font-size: 20px; box-shadow: 0 0 24px rgba(40, 220, 129, .25); }
.brand-name { letter-spacing: .18em; font-size: 14px; font-weight: 700; color: var(--green); }
.brand-sub { margin-top: 5px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.login-card h1 { margin: 0 0 8px; font-size: clamp(24px, 5vw, 32px); letter-spacing: -.05em; }
.login-card p { margin: 0 0 28px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.field { display: grid; gap: 8px; margin: 16px 0; }
.field label { color: var(--muted); font-size: 11px; }
.field input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--text); background: rgba(0, 0, 0, .25); }
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40, 220, 129, .11); }
.primary-btn { width: 100%; margin-top: 12px; padding: 13px 16px; border: 1px solid var(--green); border-radius: 9px; color: #02170c; background: var(--green); font-weight: 700; transition: .2s; }
.primary-btn:hover { background: #7affb5; box-shadow: 0 0 28px rgba(40, 220, 129, .3); }
.primary-btn:disabled { cursor: wait; opacity: .6; }
.error { min-height: 18px; margin-top: 14px; color: var(--red); font-size: 11px; line-height: 1.5; }

.dashboard { width: min(1700px, 100%); margin: auto; padding: 18px 22px 36px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 0 22px; border-bottom: 1px solid var(--line); }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar .brand-mark { margin: 0; }
.topbar .brand-icon { width: 38px; height: 38px; font-size: 16px; }
.topbar .brand-name { font-size: 12px; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.status-dot.off { background: var(--red); box-shadow: 0 0 14px var(--red); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-pill, .ghost-btn { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(7, 31, 21, .65); font-size: 10px; }
.ghost-btn:hover { border-color: var(--green); color: var(--green); }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 28px 0 20px; }
.eyebrow { color: var(--green); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; }
.hero h1 { margin: 8px 0 0; font-size: clamp(23px, 4vw, 36px); letter-spacing: -.07em; }
.hero-note { max-width: 440px; color: var(--muted); font-size: 11px; line-height: 1.7; text-align: right; }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.summary-card { position: relative; overflow: hidden; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.summary-card::after { position: absolute; right: -30px; bottom: -48px; width: 110px; height: 110px; border: 1px solid rgba(40, 220, 129, .18); border-radius: 50%; content: ""; }
.summary-label { color: var(--muted); font-size: 10px; }
.summary-value { margin-top: 9px; color: var(--green); font-size: clamp(20px, 3vw, 28px); font-weight: 700; }
.summary-value small { color: var(--muted); font-size: 10px; font-weight: 400; }
.table-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.table-card { min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(8, 34, 23, .9), rgba(3, 17, 11, .9)); box-shadow: 0 12px 35px rgba(0, 0, 0, .2); }
.table-card.clickable { cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.table-card.clickable:hover, .table-card.clickable:focus-visible { border-color: var(--line-strong); outline: none; transform: translateY(-2px); box-shadow: 0 15px 40px rgba(0, 0, 0, .28), 0 0 24px rgba(40, 220, 129, .08); }
.table-card.clickable::after { display: block; padding: 0 16px 11px; color: #4c8563; content: "click // xem chi tiết cửa cược"; font-size: 9px; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 16px 12px; border-bottom: 1px solid var(--line); }
.table-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.table-code { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid var(--green-2); border-radius: 9px; color: var(--green); font-size: 12px; font-weight: 700; }
.table-name { overflow: hidden; color: var(--text); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.table-round { margin-top: 4px; color: var(--muted); font-size: 10px; }
.phase { padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.phase.betting { border-color: rgba(40, 220, 129, .55); color: var(--green); }
.phase.dealing { border-color: rgba(244, 191, 88, .55); color: var(--amber); }
.phase.result { border-color: rgba(130, 163, 150, .4); color: #a9c1b3; }
.table-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 13px 16px; }
.meta-item { min-width: 0; }
.meta-label { color: var(--muted); font-size: 9px; }
.meta-value { margin-top: 6px; overflow: hidden; color: var(--text); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.meta-value.green { color: var(--green); }
.bets-wrap { overflow: auto; max-height: 270px; border-top: 1px solid rgba(40, 220, 129, .13); }
.bets-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.bets-table th { position: sticky; top: 0; z-index: 1; padding: 9px 12px; color: var(--muted); background: #071e14; font-size: 9px; font-weight: 500; text-align: left; }
.bets-table td { padding: 10px 12px; border-top: 1px solid rgba(40, 220, 129, .1); color: #bde7cc; font-size: 10px; white-space: nowrap; }
.bets-table tr:hover td { background: rgba(40, 220, 129, .045); }
.amount { color: var(--green) !important; font-weight: 600; }
.bet-type { color: #a4d3b5; }
.empty, .table-error { padding: 28px 16px; color: var(--muted); font-size: 10px; text-align: center; }
.table-error { color: var(--red); }
.footer { padding: 18px 0 0; color: #47715a; font-size: 9px; text-align: right; }
.pulse { animation: pulse 1.8s infinite; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 5, 3, .82); backdrop-filter: blur(7px); }
.detail-panel { position: relative; width: min(760px, 100%); max-height: min(840px, 92vh); overflow: auto; padding: 22px; border: 1px solid var(--line-strong); border-radius: 17px; background: linear-gradient(145deg, #092619, #03120b); box-shadow: var(--shadow), 0 0 70px rgba(40, 220, 129, .13); }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.detail-head h2 { margin: 7px 0 5px; color: var(--text); font-size: 22px; letter-spacing: -.06em; }
.detail-sub { color: var(--muted); font-size: 10px; }
.close-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; font-size: 22px; line-height: 1; }
.close-btn:hover { border-color: var(--green); color: var(--green); }
.spotlight-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0 12px; }
.spotlight-card { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0, 0, 0, .18); }
.spotlight-card.hot { border-color: rgba(40, 220, 129, .46); }
.spotlight-card.cold { border-color: rgba(120, 168, 142, .3); }
.spotlight-label { color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.spotlight-value { margin-top: 9px; color: var(--green); font-size: 16px; font-weight: 700; }
.cold .spotlight-value { color: #b2d4bd; }
.spotlight-meta { margin-top: 6px; color: var(--muted); font-size: 10px; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 0; color: var(--muted); font-size: 10px; }
.detail-table-wrap { overflow: auto; border: 1px solid rgba(40, 220, 129, .13); border-radius: 10px; }
.detail-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.detail-table th { padding: 11px 13px; color: var(--muted); background: #071e14; font-size: 9px; font-weight: 500; text-align: left; }
.detail-table td { padding: 12px 13px; border-top: 1px solid rgba(40, 220, 129, .1); color: #bde7cc; font-size: 10px; }
.detail-table .top-door td { background: rgba(40, 220, 129, .065); color: var(--green); }
.rank { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 9px; }
.history-section { margin-top: 22px; }
.history-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: var(--green); font-size: 10px; letter-spacing: .06em; }
.history-title small { color: var(--muted); font-size: 9px; letter-spacing: 0; }
.history-loading, .history-error { padding: 18px; border: 1px solid rgba(40, 220, 129, .13); border-radius: 10px; color: var(--muted); font-size: 10px; text-align: center; }
.history-error { color: var(--red); }
.history-table .player { color: #62d5ff; font-weight: 700; }
.history-table .banker { color: #ff8790; font-weight: 700; }
.history-table .tie { color: var(--amber); font-weight: 700; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

@media (max-width: 950px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  .table-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .dashboard { padding: 12px 12px 28px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: space-between; }
  .hero { display: block; padding-top: 22px; }
  .hero-note { margin-top: 10px; text-align: left; }
  .summary { gap: 8px; }
  .summary-card { padding: 13px; }
  .summary-value { font-size: 20px; }
  .table-head, .table-meta { padding-left: 12px; padding-right: 12px; }
  .table-meta { grid-template-columns: repeat(2, 1fr); }
  .spotlight-grid { grid-template-columns: 1fr; }
  .detail-panel { padding: 16px; }
}
