:root {
  --bg: #000; --text: #fff; --sec: rgba(235,235,245,.6); --ter: rgba(235,235,245,.3);
  --sep: rgba(84,84,88,.55); --card: #1c1c1e; --card2: #2c2c2e;
  --green: #00d35a; --red: #ff453a; --orange: #ff9f0a; --cyan: #64d2ff; --blue: #0a84ff;
  --yellow: #ffd60a; --pink: #ff6b9a; --purple: #bf5af2;
  --sans: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --display: -apple-system, "SF Pro Display", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.35 var(--sans);
  font-variant-numeric: tabular-nums; }
main { padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 90px); }
button { font: inherit; color: inherit; background: none; border: 0; min-height: 44px; min-width: 44px; cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
.sec { color: var(--sec); } .ter { color: var(--ter); }
.green { color: var(--green); } .red { color: var(--red); }

.nav { display: flex; align-items: center; gap: 8px; height: 52px; }
.avatar { width: 32px; height: 32px; min-width: 32px; min-height: 32px; border-radius: 50%; background: var(--card2); }
.nav .title { font-weight: 600; flex: 1; text-align: left; }
.search { flex: 2; background: var(--card); border: 0; border-radius: 10px; color: var(--text); height: 36px; padding: 0 10px; font: inherit; }

.balance { font: 600 66px/1.05 var(--display); letter-spacing: -1px; margin: 8px 0 4px; transition: color .6s ease-out; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { font: 600 13px var(--mono); padding: 3px 9px; border-radius: 99px; background: var(--card2); }
.pill.green { background: rgba(0,211,90,.15); } .pill.red { background: rgba(255,69,58,.15); }
.pill.paper { background: var(--orange); color: #000; font-family: var(--sans); }

.chart { width: 100%; height: 220px; display: block; margin-top: 12px; }
.ranges { display: flex; justify-content: space-between; margin: 4px 0 12px; }
.ranges button { color: var(--sec); font-weight: 600; font-size: 13px; border-radius: 8px; }
.ranges button.on { color: var(--text); background: var(--card2); }

.card { background: var(--card); border-radius: 16px; padding: 14px; margin: 12px 0; }
.screen { aspect-ratio: 16/9; border-radius: 22px; background: var(--card); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; }
.screen .tl { position: absolute; top: 10px; left: 12px; font-size: 12px; color: var(--sec); }
.screen .tr { position: absolute; top: 10px; right: 12px; font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ter); margin-right: 6px; }
.dot.on { background: var(--green); } .dot.red { background: var(--red); } .dot.paused { background: var(--orange); }

h2 { font: 600 20px var(--display); margin: 22px 0 6px; display: flex; justify-content: space-between; align-items: baseline; }
h2 a { font: 400 15px var(--sans); }
.carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.carousel .card { min-width: 220px; scroll-snap-align: start; margin: 0; }
.botname { font-weight: 600; } .bottitle { font: 600 22px var(--display); margin: 6px 0 2px; }

.list .item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--sep); min-height: 44px; }
.item .main { flex: 1; min-width: 0; } .item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--sec); font-size: 13px; } .item .v { text-align: right; font-weight: 600; }

.discs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.disc { aspect-ratio: 1; border-radius: 50%; background: var(--card); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; font-size: 11px; padding: 6px; border: 2px solid var(--card2); }
.disc.ok { border-color: var(--green); } .disc.bad { border-color: var(--red); } .disc .n { font-weight: 700; font-size: 15px; }
.disc.cur { box-shadow: 0 0 0 3px rgba(100,210,255,.5); }

.btn { display: block; width: 100%; text-align: center; border-radius: 14px; padding: 13px; font-weight: 600; margin: 8px 0; }
.btn.primary { background: var(--blue); color: #fff; } .btn.danger { background: var(--red); color: #fff; } .btn.ghost { background: var(--card2); }
.set { padding: 10px 0; border-bottom: 1px solid var(--sep); }
.set label { display: flex; justify-content: space-between; font-size: 14px; }
.set input[type=range] { width: 100%; accent-color: var(--blue); }
.set input[type=number], .set input[type=text] { width: 110px; background: var(--card2); border: 0; color: var(--text); border-radius: 8px; padding: 6px; font: inherit; text-align: right; }
.switch { width: 51px; height: 31px; border-radius: 99px; background: var(--card2); position: relative; min-height: 31px; }
.switch::after { content: ""; position: absolute; width: 27px; height: 27px; top: 2px; left: 2px; border-radius: 50%; background: #fff; transition: left .25s; }
.switch.on { background: var(--green); } .switch.on::after { left: 22px; }

.skel { background: var(--card); border-radius: 12px; height: 18px; margin: 10px 0; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .5 } to { opacity: 1 } }
.offline { position: sticky; top: 0; z-index: 5; background: var(--red); color: #fff; font-size: 13px; text-align: center; padding: 6px; padding-top: calc(env(safe-area-inset-top) + 6px); }
.empty { color: var(--sec); text-align: center; padding: 28px 0; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom); background: rgba(28,28,30,.72); -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px); border-top: 1px solid var(--sep); }
.tabbar button { flex: 1; color: var(--sec); font-size: 11px; font-weight: 600; height: 50px; }
.tabbar button.on { color: var(--blue); }
.sheet { position: fixed; inset: auto 0 0 0; background: var(--card); border-radius: 16px 16px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); z-index: 10; }
.fade-in { animation: fadein .25s ease-out both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
