:root {
  --bg: #12080b;
  --card: #2a1218;
  --panel: #3a1820;
  --gold: #f0d7a2;
  --gold-deep: #c4924a;
  --red: #c81e36;
  --ink: #fff8ef;
  --muted: rgba(255, 248, 239, 0.68);
  --line: rgba(240, 215, 162, 0.28);
  --nav: 74px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% 0, #3a1420, transparent 42%),
    #070405;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.app {
  width: min(440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background:
    linear-gradient(180deg, #5a1020 0%, #2a0c14 220px, var(--bg) 220px);
  position: relative;
  padding-bottom: calc(var(--nav) + 18px);
  overflow: hidden;
}
.screen { display: none; padding: 14px 14px 8px; }
.screen.on { display: block !important; }

.top {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 12px;
  margin-bottom: 12px;
  min-height: 74px;
}
.brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.brand img { width: 74px; height: 74px; border-radius: 18px; object-fit: cover; }
.home-bal { display: block; width: 100%; text-align: center; color: #ffe45d; font-size: 18px; font-weight: 800; line-height: 1.2; }
.top .open-gate { position: absolute; right: 0; top: 16px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(0,0,0,.25); color: var(--gold);
}

.banners { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.banners::-webkit-scrollbar { display: none; }
.banner {
  flex: 0 0 100%; scroll-snap-align: start;
  min-height: 132px; border-radius: 18px; padding: 16px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background-size: cover; background-position: center;
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
}
.banner b { font-family: Georgia, serif; font-size: 26px; }
.banner span { color: rgba(255,248,239,.86); font-size: 13px; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 8px 0 10px; }
.dots i { width: 7px; height: 7px; border-radius: 99px; background: rgba(255,255,255,.35); display: block; }
.dots i.on { width: 18px; background: var(--gold); }

.news {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,.35); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 10px; overflow: hidden;
}
.news em { font-style: normal; color: #1a0c0e; background: var(--gold); border-radius: 99px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.ticker { overflow: hidden; white-space: nowrap; flex: 1; }
.ticker p { display: inline-block; margin: 0; padding-left: 100%; animation: tick 18s linear infinite; font-size: 13px; }
@keyframes tick { to { transform: translateX(-100%); } }

.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.cat {
  border: 0; background: transparent; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px;
}
.cat .bubble {
  width: 54px; height: 54px; min-width: 54px; min-height: 54px; max-width: 54px; max-height: 54px;
  border-radius: 16px;
  display: grid; place-items: center; overflow: hidden;
  background: #2a1016;
  border: 1px solid var(--line);
  padding: 0;
  box-sizing: border-box;
}
.cat .bubble img {
  width: 36px; height: 36px; max-width: 36px; max-height: 36px;
  object-fit: contain; object-position: center; display: block;
}
.cat.on .bubble { box-shadow: 0 0 0 2px #f0d7a2; }

.block { margin-top: 8px; }
.block h2 { margin: 0 0 10px; font-size: 16px; display: flex; justify-content: space-between; align-items: baseline; }
.block h2 small { color: var(--gold); font-size: 12px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.game {
  border: 0; padding: 0; background: transparent; text-align: left; color: inherit;
  display: block; text-decoration: none; cursor: pointer;
}
.game .art {
  aspect-ratio: 3/4; border-radius: 16px; overflow: hidden; position: relative;
  background:
    linear-gradient(160deg, rgba(240,215,162,.2), transparent 40%),
    linear-gradient(180deg, #6a1a28, #2a0e14);
  border: 1px solid var(--line);
  display: grid; place-items: center;
}
.game .art img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.game .ribbon {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  background: rgba(18,8,11,.78); color: var(--gold);
  border-radius: 999px; text-align: center; font-size: 10px; padding: 4px 6px;
  letter-spacing: 0.04em;
}
.game strong { display: block; margin-top: 6px; font-size: 12px; font-weight: 650; }

.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: min(440px, 100%); bottom: 0; height: var(--nav);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #1a0b10; border-top: 1px solid var(--line);
  z-index: 5;
}
.nav button {
  border: 0; background: transparent; color: var(--muted); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.nav button.on { color: var(--gold); }
.nav .home-btn {
  width: 58px; height: 58px; margin-top: -26px; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #ffe7bf, #c4924a);
  color: #3a160c; border: 4px solid #1a0b10;
  display: grid; place-items: center; font-weight: 800; font-size: 11px;
}
.nav button.on .home-btn { box-shadow: 0 0 0 2px var(--gold); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-head h2 { margin: 0; font-family: Georgia, serif; }
.card {
  background: linear-gradient(180deg, #3a1822, #241016);
  border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 12px;
}
.card h3 { margin: 0 0 8px; font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.row { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: rgba(0,0,0,.25); border-radius: 14px; padding: 10px; }
.stat b { display: block; font-size: 18px; color: var(--gold); }
.stat span { font-size: 12px; color: var(--muted); }
.copy {
  border: 1px solid var(--line); background: #1a0c10; border-radius: 12px;
  padding: 8px 10px; color: var(--gold);
}
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu button, .linkish {
  width: 100%; text-align: left; border: 1px solid var(--line); background: rgba(0,0,0,.22);
  border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between;
}
.balance { font-family: Georgia, serif; font-size: 34px; margin: 4px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button, .primary {
  border: 0; border-radius: 999px; padding: 10px 14px;
  background: linear-gradient(180deg, #e7c78a, #b47b34); color: #3a160c; font-weight: 700;
}
.primary.ghost { background: transparent; color: var(--gold); border: 1px solid var(--line); }
.sheet {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: flex-end; justify-content: center; z-index: 8;
}
.sheet.on { display: flex; }
.sheet .box {
  width: min(440px, 100%); background: #2a1218; border-radius: 22px 22px 0 0;
  padding: 18px 16px 24px; border: 1px solid var(--line);
}
.sheet h3 { margin: 0 0 6px; font-family: Georgia, serif; font-size: 28px; }
.profile { display: flex; gap: 12px; align-items: center; }
.avatar {
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(160deg, #f0d7a2, #8f1d2c);
  font-weight: 800; color: #1a0c0e;
}
.subview { display: none; }
.subview.on { display: block; }
.method-pick.on, .chip-amt.on { box-shadow: 0 0 0 2px var(--gold); }
#block-wall[hidden], #gate[hidden] { display: none !important; }
#gate {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 18px;
  background: rgba(8, 4, 6, 0.92);
}
#gate form {
  width: min(380px, 100%);
  background: #2a141a; border: 1px solid var(--line); border-radius: 18px; padding: 18px;
}
#gate h1 { font-family: Georgia, serif; margin: 0 0 8px; }
#gate input { width: 100%; margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #14090d; }
#gate .msg { min-height: 18px; color: var(--gold); font-size: 13px; }
#gate .ghost {
  margin-left: 8px;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
}
