@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap');

*{ margin:0; padding:0; box-sizing:border-box; font-family:'Poppins',sans-serif; }

:root{
  --bg:#070c1f;
  --muted:rgba(234,242,255,.70);
  --cyan:#00d4ff;
  --blue:#0aa0ff;

  --grid: rgba(0,212,255,.35);
  --gridSoft: rgba(0,212,255,.18);

  /* Mines theme */
  --g1:#25ff9b;
  --g2:#00c853;
  --gCard: rgba(9, 22, 18, .75);
  --gLine: rgba(37,255,155,.25);

  --radius:18px;
}

html, body{ height:100%; }
body{
  min-height:100vh;
  background:var(--bg);
  overflow-y:auto;
  overflow-x:hidden;
  color: rgba(234,242,255,.92);
}

.page{
  min-height:100vh;
  position:relative;
  padding: 44px 16px;
}

/* ===== Background ===== */
.bg-grid{
  position:fixed;
  inset:0;
  z-index:0;
  --g: 120px;

  background:
    repeating-linear-gradient(to right, var(--grid) 0px, var(--grid) 1px, transparent 1px, transparent var(--g)),
    repeating-linear-gradient(to bottom, var(--grid) 0px, var(--grid) 1px, transparent 1px, transparent var(--g)),
    repeating-linear-gradient(to right, var(--gridSoft) 0px, var(--gridSoft) 1px, transparent 1px, transparent calc(var(--g) * 2)),
    repeating-linear-gradient(to bottom, var(--gridSoft) 0px, var(--gridSoft) 1px, transparent 1px, transparent calc(var(--g) * 2)),
    radial-gradient(1000px 600px at 50% 50%, rgba(0,212,255,.10), transparent 60%),
    radial-gradient(1200px 700px at 10% 20%, rgba(10,160,255,.10), transparent 60%),
    radial-gradient(1200px 700px at 90% 70%, rgba(10,160,255,.08), transparent 60%),
    var(--bg);

  animation: gridMove 20s linear infinite;
  filter:saturate(1.05);
}

@keyframes gridMove{
  0%{ background-position: 0 0,0 0, 0 0,0 0, 0 0,0 0,0 0,0 0; }
  100%{ background-position: 240px 160px,240px 160px, -180px 120px,-180px 120px, 0 0,0 0,0 0,0 0; }
}

.bg-grid::after{
  content:"";
  position:absolute;
  inset:-40%;
  background: linear-gradient(90deg, transparent 0%, rgba(0,212,255,.10) 50%, transparent 100%);
  transform: rotate(12deg);
  animation: scan 9s ease-in-out infinite;
  pointer-events:none;
  mix-blend-mode: screen;
}

@keyframes scan{
  0%{ transform: translateX(-22%) rotate(12deg); opacity:.18; }
  50%{ transform: translateX(22%) rotate(12deg); opacity:.34; }
  100%{ transform: translateX(-22%) rotate(12deg); opacity:.18; }
}

/* Blocks */
.bg-grid .block{
  position:absolute;
  width:260px; height:260px;
  background:rgba(0,180,255,.24);
  border:1px solid rgba(0,212,255,.55);
  box-shadow: 0 0 45px rgba(0,212,255,.14);
  opacity:.22;
  animation: drift 18s ease-in-out infinite;
  will-change: transform;
}

.bg-grid .b1{ top:110px; left:140px; width:220px; height:220px; opacity:.30; animation-duration: 18s; }
.bg-grid .b2{ top:240px; left:420px; width:250px; height:250px; opacity:.20; animation-duration: 22s; }
.bg-grid .b3{ top:300px; right:320px; width:270px; height:270px; opacity:.20; animation-duration: 20s; }
.bg-grid .b4{ bottom:220px; right:220px; width:300px; height:300px; opacity:.22; animation-duration: 24s; }
.bg-grid .b5{ bottom:120px; left:260px; width:240px; height:240px; opacity:.17; animation-duration: 19s; }
.bg-grid .b6{ top:120px; right:120px; width:240px; height:240px; opacity:.15; animation-duration: 21s; }

@keyframes drift{
  0%{ transform: translate(0,0); }
  50%{ transform: translate(26px,-16px); }
  100%{ transform: translate(0,0); }
}

/* ===== Layout Wrap ===== */
.wrap{
  position:relative;
  z-index:5;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items:start;
  justify-content:center;
  max-width: 1180px;
  margin: 0 auto;
}

/* ===== Card Shared ===== */
.card, .game{
  border-radius: var(--radius);
  overflow:hidden;
  backdrop-filter: blur(12px);
}

/* ===== Event Card ===== */
.card{
  background: rgba(12, 20, 48, .74);
  border: 1px solid rgba(0,212,255,.28);
  box-shadow: 0 30px 85px rgba(0,0,0,.58), 0 0 70px rgba(0,212,255,.14);
}

.card-inner{ padding: 26px 26px 24px; }

.brand{ display:flex; align-items:center; gap:12px; margin-bottom:12px; }

.logo{
  width:44px; height:44px;
  border-radius:14px;
  object-fit: cover;
  border:1px solid rgba(0,212,255,.28);
  box-shadow: 0 12px 28px rgba(0,0,0,.35), 0 0 25px rgba(0,212,255,.16);
  flex: 0 0 44px;
}

.brand-title{ font-weight:800; color:rgba(234,242,255,.94); line-height:1.1; font-size:15px; }
.brand-subtitle{ font-size:12.5px; color:var(--muted); margin-top:2px; font-weight:600; }

.title{
  text-align:center;
  margin: 8px 0 10px;
  letter-spacing: 2px;
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  text-transform:uppercase;
}

.subtitle{
  text-align:center;
  color:var(--muted);
  line-height:1.7;
  font-size: 14.5px;
  margin: 0 8px 16px;
}

.countdown{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap: 12px;
  margin-top: 10px;
}

.cd-box{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  padding: 12px 10px;
  text-align:center;
}

.cd-box .num{
  font-size: 26px;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(0,212,255,.95), rgba(10,160,255,.90));
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
}

.cd-box .lbl{ font-size: 12px; color:var(--muted); margin-top: 4px; font-weight: 800; }

.btn{
  width:100%;
  text-align:center;
  padding: 15px 16px;
  border-radius: 14px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color:#fff;
  box-shadow: 0 14px 34px rgba(0,212,255,.24);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  margin-top: 16px;
  border:0;
  outline:0;
  cursor:pointer;
}

.btn:hover{ transform: translateY(-2px); box-shadow: 0 20px 48px rgba(0,212,255,.33); filter:brightness(1.03); }
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; filter:none; }

.hint{ margin-top:10px; font-size:13px; color:var(--muted); text-align:center; line-height: 1.55; }

/* ===== Mines Game Panel ===== */
.game{
  background: var(--gCard);
  border: 1px solid var(--gLine);
  box-shadow: 0 30px 85px rgba(0,0,0,.55), 0 0 70px rgba(37,255,155,.12);
}

.game-head{
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--gLine);
  display:flex;
  gap: 14px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
}

.gt{
  font-size: 28px;
  font-weight: 900;
  letter-spacing:.5px;
  color: var(--g1);
  text-shadow: 0 0 18px rgba(37,255,155,.18);
}

.gs{
  margin-top:2px;
  color: rgba(234,242,255,.75);
  font-size: 13px;
}

.game-controls{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

/* Nickname box */
.nickbox{
  border:1px solid var(--gLine);
  background: rgba(255,255,255,.04);
  border-radius: 14px;
  padding: 10px 12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.nicklabel{
  font-size: 11px;
  font-weight: 900;
  letter-spacing:.6px;
  color: rgba(234,242,255,.68);
}
.nickrow{
  display:flex;
  gap:10px;
  align-items:center;
}
.nickinput{
  width: 150px;
  max-width: 180px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: rgba(234,242,255,.92);
  font-weight: 900;
  outline: none;
}
.nickinput:focus{
  border-color: rgba(37,255,155,.35);
  box-shadow: 0 0 0 4px rgba(37,255,155,.08);
}
.nickhint{
  font-size: 11.5px;
  color: rgba(234,242,255,.62);
  font-weight: 700;
}

.pill{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--gLine);
  background: rgba(255,255,255,.04);
  color: rgba(234,242,255,.75);
  font-size: 12px;
  font-weight: 800;
}

.pill select{
  background: rgba(0,0,0,.18);
  color: rgba(234,242,255,.9);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}

.pill select:focus{
  border-color: rgba(37,255,155,.35);
  box-shadow: 0 0 0 4px rgba(37,255,155,.08);
}

.gbtn{
  padding: 10px 12px;
  border-radius: 14px;
  border: 0;
  outline: 0;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .4px;
  color: #04160e;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 12px 28px rgba(37,255,155,.18);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.gbtn:hover{ transform: translateY(-1px); filter: brightness(1.03); }
.gbtn.ghost{
  color: rgba(234,242,255,.85);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: none;
}

.game-body{
  padding: 16px 18px 18px;
  display:grid;
  grid-template-columns: 1fr 260px;
  gap: 14px;
  align-items:start;
}

/* Board */
.board-wrap{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  padding: 14px;
}

.board{
  display:grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.tile{
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;

  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);

  cursor:pointer;
  color: rgba(234,242,255,.92);
  font-size: 20px;
  font-weight: 900;

  line-height: 1;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;

  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.tile:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.tile:disabled{ cursor:not-allowed; opacity:.88; }

.tile.gem{
  background: rgba(37,255,155,.10);
  border: 1px solid rgba(37,255,155,.35);
  box-shadow: 0 0 25px rgba(37,255,155,.12);
}

.tile.bomb{
  background: rgba(255,70,70,.10);
  border: 1px solid rgba(255,70,70,.35);
  box-shadow: 0 0 25px rgba(255,70,70,.12);
}

.board-hint{
  margin-top: 10px;
  color: rgba(234,242,255,.72);
  font-size: 12.5px;
}

/* Stats */
.stats{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content:start;
}

.stat{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  padding: 12px 12px;
}

.label{
  color: rgba(234,242,255,.68);
  font-size: 11px;
  font-weight: 900;
  letter-spacing:.6px;
}

.value{
  margin-top: 6px;
  font-size: 22px;
  font-weight: 900;
  color: var(--g1);
}

.safe-tiles{
  grid-column: 1 / -1;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(37,255,155,.07);
  padding: 12px 12px;
  color: rgba(234,242,255,.82);
  font-weight: 900;
  text-align:center;
}

.cashout{
  grid-column: 1 / -1;
  padding: 14px 14px;
  border-radius: 14px;
  border: 0;
  outline: 0;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .5px;
  color: #04160e;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 16px 34px rgba(37,255,155,.16);
}
.cashout:disabled{
  opacity:.55;
  cursor:not-allowed;
  box-shadow:none;
}

/* Leaderboard */
.lb{
  grid-column: 1 / -1;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  padding: 12px;
}

.lb-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
}

.lb-title{
  font-weight: 900;
  color: rgba(234,242,255,.92);
  font-size: 13px;
  letter-spacing: .3px;
}
.lb-sub{
  margin-top:2px;
  font-size: 11.5px;
  color: rgba(234,242,255,.68);
}

.lb-refresh{ padding: 8px 10px; border-radius: 12px; }

.lb-list{
  margin-top:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  list-style: none;
  padding-left: 0;
}

.lb-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  padding: 10px 10px;
}

.lb-left{
  display:flex;
  gap:10px;
  align-items:center;
  min-width: 0;
}

.lb-rank{
  font-weight: 900;
  color: var(--g1);
}

.lb-name{
  font-weight: 900;
  color: rgba(234,242,255,.92);
  min-width: 0;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.lb-right{
  text-align:right;
}
.lb-score{
  font-weight: 900;
  color: rgba(234,242,255,.92);
}
.lb-meta{
  margin-top:2px;
  font-size: 11px;
  color: rgba(234,242,255,.60);
}

.lb-empty{
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,.12);
  background: rgba(0,0,0,.12);
  padding: 10px;
  color: rgba(234,242,255,.70);
  font-weight: 700;
}

.lb-foot{
  margin-top:10px;
  font-size: 11.5px;
  color: rgba(234,242,255,.62);
}

/* Note */
.small-note{
  grid-column: 1 / -1;
  color: rgba(234,242,255,.68);
  font-size: 12px;
  line-height: 1.55;
}

/* ===== Responsive ===== */
@media (max-width: 1180px){
  .wrap{ grid-template-columns: 1fr; max-width: 980px; }
  .game-body{ grid-template-columns: 1fr; }
  .lb-name{ max-width: 220px; }
}

@media (max-width: 620px){
  .page{ padding: 34px 12px; }
  .card-inner{ padding: 22px 18px 18px; }

  .title{ font-size: 26px; }
  .subtitle{ font-size: 14px; }
  .countdown{ grid-template-columns:repeat(2,1fr); }
  .cd-box .num{ font-size: 24px; }

  .gt{ font-size: 24px; }

  .game-head{ padding: 16px 14px 12px; }
  .game-body{ padding: 14px 14px 16px; }

  .board-wrap{ padding: 12px; }
  .board{ gap: 10px; }
  .tile{ border-radius: 14px; font-size: 20px; }

  .nickinput{ width: 180px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .bg-grid{ animation:none; }
  .bg-grid::after{ animation:none; }
  .bg-grid .block{ animation:none; }
}

