:root {
  --bg: #05070b;
  --panel: #121820;
  --line: #243044;
  --text: #eef3fa;
  --muted: #7f91a8;
  --cyan: #3dd0ff;
  --green: #3dffa8;
  --red: #ff6b8a;
  --gold: #f0c14a;
  --top: 52px;
  --bot: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; height: 100dvh;
  overflow: hidden; background: #000; color: var(--text);
  touch-action: manipulation; user-select: none;
}
.app {
  height: 100%; height: 100dvh;
  max-width: 430px; margin: 0 auto;
  display: grid;
  grid-template-rows: calc(var(--top) + var(--safe-t)) 1fr calc(var(--bot) + var(--safe-b));
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
@media (min-width: 480px) {
  body { display: grid; place-items: center; }
  .app {
    height: min(860px, 100dvh);
    border-radius: 28px;
    box-shadow: 0 0 0 1px #1a2030, 0 30px 80px rgba(0,0,0,.6);
  }
}

.bar.top {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: var(--safe-t) 10px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(5,7,11,.94);
  z-index: 5;
}
.bar-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: .04em;
}
.bar-title i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
  display: inline-block;
}
.ib {
  width: 40px; height: 40px; border: 0; border-radius: 12px;
  background: var(--panel); color: var(--text); font-size: 1.1rem; cursor: pointer;
}

.stage {
  position: relative; overflow: hidden; min-height: 0;
}
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  padding: 12px 12px 8px;
  gap: 10px;
}
.screen.on { display: flex; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  flex-shrink: 0;
}
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 8px; text-align: center;
}
.stat b { display: block; font-size: 1.35rem; color: var(--cyan); }
.stat span { font-size: .7rem; color: var(--muted); font-weight: 700; }

.stack {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center; gap: 4px;
}
.stack.short { flex: 0.85; }
.nav-arrow {
  height: 48px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); font-size: 1.6rem; cursor: pointer;
}
.nav-arrow:active { color: var(--cyan); }
.focus {
  height: 100%; max-height: 100%;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; padding: 18px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  touch-action: pan-y;
}
.focus .kicker {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--cyan); font-weight: 800;
}
.focus h2 {
  margin: 10px 0 8px; font-size: 1.25rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.focus p {
  margin: 0; color: var(--muted); font-size: .9rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.focus .actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px;
}
.focus .actions button, .focus .actions a {
  text-align: center; text-decoration: none; border: 0; border-radius: 14px;
  padding: 14px; font-weight: 800; font-size: .95rem; cursor: pointer;
}
.btn-main { background: var(--cyan); color: #041018; }
.btn-dim { background: #1a2434; color: var(--text); }
.focus.done { opacity: .45; border-color: rgba(61,255,168,.3); }
.empty-focus {
  height: 100%; display: grid; place-items: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 22px;
}

.dots {
  display: flex; justify-content: center; gap: 6px; flex-shrink: 0; min-height: 12px;
}
.dots i {
  width: 6px; height: 6px; border-radius: 50%; background: #334;
}
.dots i.on { background: var(--cyan); width: 16px; border-radius: 99px; }

.pay-hero {
  flex-shrink: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.pay-hero .m {
  background: linear-gradient(145deg, #1c2414, var(--panel));
  border: 1px solid #3a4a28; border-radius: 16px; padding: 12px;
}
.pay-hero .m small { color: var(--muted); font-size: .7rem; }
.pay-hero .m b { display: block; color: var(--gold); font-size: 1.2rem; margin-top: 4px; }

.page-grid {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
}
.page-grid a {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-decoration: none; color: var(--text); padding: 8px;
  min-height: 0;
}
.page-grid a:active { transform: scale(.97); }
.page-grid .ico {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
  background: #1a2434; color: var(--cyan);
}
.page-grid span {
  font-size: .72rem; font-weight: 700; text-align: center;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-nav {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 16px;
}
.pill {
  width: 44px; height: 36px; border: 0; border-radius: 12px;
  background: var(--panel); color: var(--text); font-size: 1.1rem; cursor: pointer;
}
.page-nav span { color: var(--muted); font-size: .8rem; font-weight: 700; min-width: 40px; text-align: center; }

.bar.bottom {
  display: flex; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  background: rgba(5,7,11,.96);
  z-index: 5;
}
.bar.bottom button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .62rem; font-weight: 700; cursor: pointer; padding-top: 6px;
}
.bar.bottom button span { font-size: 1.15rem; }
.bar.bottom button.on { color: var(--cyan); }

/* drawer */
.drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: 76%; max-width: 280px;
  background: #0c1118; border-right: 1px solid var(--line);
  z-index: 30; transform: translateX(-105%);
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
  padding: calc(16px + var(--safe-t)) 12px calc(16px + var(--safe-b));
  display: flex; flex-direction: column; gap: 8px;
}
.drawer.open { transform: translateX(0); }
.drawer-brand {
  display: flex; gap: 12px; align-items: center; padding: 8px; margin-bottom: 8px;
}
.drawer-brand b { display: block; }
.drawer-brand small { color: var(--muted); }
.orb {
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #cff, var(--cyan), #034);
  box-shadow: 0 0 18px rgba(61,208,255,.5);
}
.drawer nav { display: flex; flex-direction: column; gap: 4px; }
.drawer nav button {
  border: 0; background: transparent; color: var(--text); text-align: left;
  padding: 14px 12px; border-radius: 12px; font-weight: 700; font-size: 1rem; cursor: pointer;
}
.drawer nav button.on { background: var(--panel); color: var(--cyan); }
.scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.scrim.on { opacity: 1; pointer-events: auto; }

.sheet-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sheet-scrim.on { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; width: min(430px, 100%);
  transform: translate(-50%, 110%);
  background: #141b24; border-radius: 20px 20px 0 0;
  border: 1px solid var(--line); border-bottom: 0;
  z-index: 45; padding: 8px 16px calc(18px + var(--safe-b));
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.sheet.open { transform: translate(-50%, 0); }
.handle {
  width: 36px; height: 4px; border-radius: 99px; background: #445; margin: 6px auto 12px;
}
.sheet h3 { margin: 0 0 6px; font-size: 1.05rem; }
.sheet p { margin: 0 0 14px; color: var(--muted); font-size: .88rem; }
.sheet .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet .row a, .sheet .row button {
  border: 0; border-radius: 14px; padding: 14px; font-weight: 800;
  text-align: center; text-decoration: none; cursor: pointer; font-size: .95rem;
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bot) + 16px + var(--safe-b));
  transform: translateX(-50%) translateY(12px);
  background: #122018; border: 1px solid rgba(61,255,168,.4); color: var(--green);
  padding: 10px 16px; border-radius: 999px; font-weight: 800; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
