:root{
  --bg0:#0b0f15;
  --bg1:#111722;
  --bg2:#172030;

  --text:#f3f6ff;
  --muted:rgba(243,246,255,.62);

  --line:#000;
  --lineSoft:rgba(255,255,255,.08);

  --blue1:#83a0ff;
  --blue2:#526cf0;

  --gold1:#f8e8b2;
  --gold2:#e0c26f;
  --gold3:#b78f46;

  --egg1:#6ff3c1;
  --egg2:#2fd4a1;

  --bad1:#ff7e95;
  --bad2:#c63d5c;

  --cardA:rgba(255,255,255,.06);
  --cardB:rgba(255,255,255,.024);

  --shadow-xl:0 36px 84px rgba(0,0,0,.52);
  --shadow-lg:0 20px 44px rgba(0,0,0,.40);
  --shadow-md:0 12px 26px rgba(0,0,0,.28);
}

*{box-sizing:border-box}
html,body{height:100%}

html{
  width:100%;
  overflow-x:hidden;
  -webkit-text-size-adjust:100%;
}

body{
  margin:0;
  min-height:100%;
  overflow-x:hidden;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 820px at 16% 0%, rgba(67,99,255,.10), transparent 54%),
    radial-gradient(1000px 720px at 100% 100%, rgba(40,190,255,.06), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 44%, var(--bg2));
}

.bg{
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(900px 520px at 50% -10%, rgba(255,255,255,.02), transparent 60%),
    radial-gradient(1000px 720px at 50% 120%, rgba(255,255,255,.015), transparent 70%);
}

.noise{
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.04;
  background-image:
    radial-gradient(1px 1px at 10% 18%, rgba(255,255,255,.24), transparent 60%),
    radial-gradient(1px 1px at 70% 32%, rgba(255,255,255,.18), transparent 60%),
    radial-gradient(1px 1px at 34% 76%, rgba(255,255,255,.15), transparent 60%);
}

a{color:inherit;text-decoration:none}
button,input{font:inherit}

.pressable{
  transition:
    transform .16s ease,
    filter .16s ease,
    box-shadow .16s ease,
    background .16s ease,
    border-color .16s ease;
  will-change:transform;
}

.pressable:hover{
  filter:brightness(1.05);
}

.pressable:active,
.pressable.is-pressed{
  transform:translateY(2px) scale(.985);
  filter:brightness(.98);
}

.app{
  width:min(1220px, calc(100% - 20px));
  margin:10px auto 16px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  min-height:74px;
  padding:10px 14px;
  border-radius:22px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(27,36,50,.96), rgba(18,24,36,.96));
  box-shadow:var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.05);
}

.topbar__left,
.topbar__right{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.backBtn{
  width:44px;
  height:44px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  display:grid;
  place-items:center;
  font-size:20px;
  font-weight:900;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
  flex:0 0 auto;
}

.brandRow{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.brandLogo{
  width:48px;
  height:48px;
  border-radius:16px;
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:var(--shadow-md), inset 0 1px 0 rgba(255,255,255,.05);
  flex:0 0 auto;
}

.brandLogo svg{
  width:28px;
  height:28px;
  display:block;
}

.title{
  font-size:30px;
  line-height:1;
  font-weight:1000;
}

.subtitle{
  margin-top:4px;
  font-size:11px;
  font-weight:900;
  letter-spacing:1.8px;
  text-transform:uppercase;
  color:var(--muted);
}

.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:44px;
  padding:0 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
  white-space:nowrap;
}

.pill--balance{
  min-width:112px;
}

.dot{
  width:8px;
  height:8px;
  border-radius:99px;
  background:#26d47b;
  box-shadow:0 0 0 3px rgba(38,212,123,.14);
}

.layout{
  margin-top:12px;
  display:grid;
  grid-template-columns:270px minmax(0,1fr) 270px;
  gap:12px;
  align-items:start;
}

.panel,
.boardCard{
  border-radius:22px;
  background:linear-gradient(180deg, var(--cardA), var(--cardB));
  border:1px solid var(--line);
  box-shadow:var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.04);
}

.panel{
  padding:12px;
}

.panel--control,
.panel--ladder{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
}

.sectionBlock{
  border-radius:16px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.04);
  padding:10px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
  min-width:0;
}

.sectionBlock--stats{
  padding:9px;
}

.rowTitle{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}

.h1{
  font-size:17px;
  line-height:1;
  font-weight:1000;
}

.h2{
  font-size:14px;
  line-height:1;
  font-weight:950;
}

.hint{
  margin-top:5px;
  color:var(--muted);
  font-size:11px;
  line-height:1.35;
}

.muted{
  color:var(--muted);
  font-size:11px;
  line-height:1.35;
}

.muted--spaced{
  margin-top:7px;
}

.miniTag{
  min-height:28px;
  padding:0 10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.04);
  font-size:11px;
  font-weight:900;
  color:#edf2ff;
  white-space:nowrap;
}

.modeRow{
  margin-top:8px;
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:8px;
}

.seg{
  min-height:42px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.05);
  color:#fff;
  font-weight:950;
  cursor:pointer;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

.seg.active{
  background:linear-gradient(180deg, rgba(95,124,255,.30), rgba(74,103,234,.16));
  box-shadow:0 12px 22px rgba(82,108,240,.14), inset 0 1px 0 rgba(255,255,255,.05);
}

.betRow{
  margin-top:8px;
  display:grid;
  grid-template-columns:40px minmax(0,1fr) 40px;
  gap:8px;
  align-items:center;
}

.btnSmall,
.chip,
.btnPrimary,
.btnGhost{
  border:1px solid var(--line);
  color:#fff;
  cursor:pointer;
}

.btnSmall{
  height:40px;
  width:40px;
  border-radius:12px;
  background:rgba(255,255,255,.05);
  font-weight:950;
  font-size:17px;
  display:grid;
  place-items:center;
  padding:0;
}

.betInput{
  width:100%;
  min-width:0;
  height:40px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.05);
  color:var(--text);
  font-weight:950;
  padding:0 12px;
  outline:none;
}

.chips{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.chip{
  min-height:36px;
  padding:0 11px;
  border-radius:999px;
  background:rgba(255,255,255,.05);
  font-size:12px;
  font-weight:900;
}

.compactStats{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:7px;
}

.compactStat{
  border-radius:12px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.04);
  padding:9px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
  min-width:0;
}

.label{
  font-size:10px;
  color:var(--muted);
  font-weight:800;
}

.value{
  margin-top:4px;
  font-size:14px;
  line-height:1.12;
  font-weight:1000;
  word-break:break-word;
}

.actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.btnPrimary{
  min-height:46px;
  padding:0 14px;
  border-radius:14px;
  font-weight:950;
  font-size:14px;
  background:linear-gradient(180deg, var(--blue1), var(--blue2));
  box-shadow:0 14px 26px rgba(82,108,240,.24), inset 0 1px 0 rgba(255,255,255,.14);
}

.btnGhost{
  min-height:46px;
  padding:0 14px;
  border-radius:14px;
  font-weight:900;
  font-size:14px;
  background:rgba(255,255,255,.05);
}

.btnPrimary:disabled,
.btnGhost:disabled,
.btnSmall:disabled,
.betInput:disabled,
.chip:disabled,
.seg:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.boardCard{
  padding:12px;
  min-width:0;
}

.boardHead{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:10px;
  margin-bottom:10px;
}

.boardBadge{
  min-height:32px;
  padding:0 12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.92);
  background:linear-gradient(180deg, rgba(95,124,255,.18), rgba(255,255,255,.04));
  font-size:11px;
  font-weight:950;
  letter-spacing:1px;
  white-space:nowrap;
}

.towerGrid{
  border-radius:16px;
  border:1px solid rgba(0,0,0,.92);
  background:
    radial-gradient(520px 260px at 50% 18%, rgba(106,126,255,.14), transparent 70%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.12));
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:500px;
}

.row{
  display:grid;
  grid-template-columns:repeat(4, minmax(0,1fr));
  gap:8px;
}

.cell{
  position:relative;
  height:48px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.92);
  background:
    radial-gradient(140px 60px at 30% 20%, rgba(255,255,255,.08), transparent 60%),
    rgba(0,0,0,.18);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.03);
  cursor:pointer;
  user-select:none;
  overflow:hidden;
  transform-style:preserve-3d;
  transition:transform .14s ease, filter .14s ease;
}

.cell:hover{
  filter:brightness(1.04);
  transform:translateY(-1px);
}

.cell:active{
  transform:translateY(1px) scale(.985);
}

.cell.disabled{
  cursor:default;
  opacity:.68;
}

.cell.disabled:hover{
  transform:none;
  filter:none;
}

.cellInner{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  transform-style:preserve-3d;
  transition:transform 520ms cubic-bezier(.2,.85,.2,1);
}

.cell.revealed .cellInner{
  transform:rotateY(180deg);
}

.face{
  position:absolute;
  inset:0;
  backface-visibility:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
  font-weight:950;
}

.face--front{
  transform:rotateY(0deg);
}

.face--back{
  transform:rotateY(180deg);
}

.icon{
  width:30px;
  height:30px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.22);
  box-shadow:0 10px 24px rgba(0,0,0,.25);
}

.icon.egg{
  border-color:rgba(47,212,161,.35);
  background:linear-gradient(180deg, rgba(111,243,193,.22), rgba(47,212,161,.10));
}

.icon.skull{
  border-color:rgba(255,107,125,.35);
  background:linear-gradient(180deg, rgba(255,107,125,.22), rgba(185,42,60,.10));
}

.icon span{
  transform:translateY(-1px);
}

.cell.hitSafe{
  outline:2px solid rgba(47,212,161,.38);
}

.cell.hitSkull{
  outline:2px solid rgba(255,107,125,.38);
}

.msg{
  margin-top:10px;
  min-height:42px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.04);
  padding:11px 12px;
  font-size:12px;
  color:rgba(243,246,255,.84);
  line-height:1.35;
}

.ladderGrid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:8px;
}

.ladderStep{
  min-height:66px;
  border-radius:14px;
  border:1px solid rgba(0,0,0,.92);
  background:rgba(255,255,255,.04);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:8px 6px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

.ladderStep__k{
  font-size:10px;
  color:var(--muted);
  font-weight:800;
  text-transform:uppercase;
}

.ladderStep__x{
  margin-top:5px;
  font-size:17px;
  font-weight:1000;
  line-height:1;
}

.ladderStep.active{
  background:linear-gradient(180deg, rgba(95,124,255,.30), rgba(74,103,234,.16));
  box-shadow:0 10px 18px rgba(82,108,240,.16);
}

@media (max-width:1080px){
  .layout{
    grid-template-columns:1fr;
  }

  .panel--control{order:1}
  .boardCard{order:2}
  .panel--ladder{order:3}
}

@media (max-width:700px){
  .app{
    width:calc(100% - 14px);
    margin:8px auto 12px;
  }

  .topbar{
    min-height:auto;
    padding:8px 10px;
    align-items:flex-start;
    flex-direction:column;
    border-radius:18px;
  }

  .topbar__left,
  .topbar__right{
    width:100%;
  }

  .topbar__right{
    justify-content:space-between;
    flex-wrap:nowrap;
    gap:8px;
  }

  .pill{
    min-height:38px;
    padding:0 11px;
    font-size:12px;
  }

  .title{
    font-size:22px;
  }

  .subtitle{
    font-size:9px;
    letter-spacing:1.2px;
  }

  .panel,
  .boardCard{
    padding:10px;
    border-radius:18px;
  }

  .sectionBlock{
    padding:9px;
    border-radius:14px;
  }

  .modeRow{
    grid-template-columns:1fr 1fr;
    gap:7px;
  }

  .seg{
    min-height:40px;
    border-radius:11px;
    font-size:13px;
  }

  .compactStats{
    grid-template-columns:1fr 1fr;
    gap:6px;
  }

  .compactStat{
    padding:8px;
    border-radius:11px;
  }

  .value{
    font-size:13px;
  }

  .boardHead{
    flex-direction:column;
    align-items:flex-start;
    gap:8px;
    margin-bottom:8px;
  }

  .boardBadge{
    min-height:30px;
    font-size:10px;
    padding:0 10px;
  }

  .towerGrid{
    min-height:340px;
    gap:6px;
    padding:8px;
    border-radius:14px;
  }

  .row{
    gap:6px;
  }

  .cell{
    height:38px;
    border-radius:10px;
  }

  .icon{
    width:24px;
    height:24px;
  }

  .msg{
    margin-top:8px;
    min-height:38px;
    padding:9px 10px;
    font-size:11px;
  }

  .actions{
    grid-template-columns:1fr 1fr;
    gap:7px;
  }

  .btnPrimary,
  .btnGhost{
    min-height:42px;
    border-radius:12px;
    font-size:13px;
  }

  .betRow{
    grid-template-columns:38px minmax(0,1fr) 38px;
    gap:7px;
  }

  .btnSmall,
  .betInput{
    height:38px;
    border-radius:11px;
  }

  .btnSmall{
    width:38px;
    font-size:16px;
  }

  .chip{
    min-height:34px;
    padding:0 10px;
    font-size:11px;
  }

  .ladderGrid{
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:7px;
  }

  .ladderStep{
    min-height:58px;
    border-radius:12px;
    padding:6px 4px;
  }

  .ladderStep__k{
    font-size:9px;
  }

  .ladderStep__x{
    font-size:14px;
    margin-top:4px;
  }
}

@media (max-width:420px){
  .backBtn{
    width:38px;
    height:38px;
    border-radius:10px;
  }

  .brandLogo{
    width:40px;
    height:40px;
    border-radius:12px;
  }

  .brandLogo svg{
    width:22px;
    height:22px;
  }

  .title{
    font-size:20px;
  }

  .subtitle{
    font-size:8px;
    letter-spacing:1.1px;
  }

  .pill{
    font-size:11px;
    padding:0 9px;
    min-height:36px;
  }

  .modeRow{
    grid-template-columns:1fr;
  }

  .compactStats{
    grid-template-columns:1fr 1fr;
  }

  .actions{
    grid-template-columns:1fr;
  }

  .towerGrid{
    min-height:320px;
    padding:7px;
    gap:5px;
  }

  .row{
    gap:5px;
  }

  .cell{
    height:34px;
  }

  .icon{
    width:22px;
    height:22px;
  }

  .ladderGrid{
    grid-template-columns:1fr 1fr;
    gap:6px;
  }

  .ladderStep{
    min-height:54px;
  }

  .ladderStep__x{
    font-size:13px;
  }
}

@media (prefers-reduced-motion: reduce){
  .cellInner{transition:none}
  .pressable{transition:none}
}
