:root {
  --bg: #07090e;
  --panel: #0d1117;
  --panel-2: #141b26;
  --panel-3: #0f1620;
  --line: #1e293b;
  --line-soft: #16202e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --amber: #fbbf24;
  --orange: #ea580c;
  --orange-2: #d97706;
  --cyan: #22d3ee;
  --green: #34d399;
  --rose: #f87171;
  --violet: #c084fc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

#app-shell {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  touch-action: manipulation;
}

.hidden { display: none !important; }

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: var(--panel);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 10;
  -webkit-overflow-scrolling: touch;
}

.screen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.screen-title {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
}

.screen-sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.screen-foot { margin-top: auto; text-align: center; font-size: 11px; color: var(--muted-2); line-height: 1.5; padding-top: 8px; }

.screen-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 4px;
}

/* ---- Buttons ---- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--panel-2);
  padding: 12px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: linear-gradient(135deg, var(--orange), var(--orange-2)); color: #fff; box-shadow: 0 8px 22px rgba(234, 88, 12, 0.4); }
.btn-ghost { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.btn-danger { background: rgba(244, 63, 94, 0.16); border-color: rgba(244, 63, 94, 0.5); color: #fda4af; }
.btn-install { background: linear-gradient(135deg, #0891b2, #0e7490); color: #fff; }
.btn-lg { padding: 18px; font-size: 17px; border-radius: var(--radius); }
.btn-third { flex: 1; }
.btn-two-thirds { flex: 2; }

.btn-icon {
  width: 40px; height: 40px; padding: 0; font-size: 18px;
  border-radius: var(--radius-sm); background: var(--panel-2); border-color: var(--line);
  flex-shrink: 0;
}
.btn-icon.sm { width: 28px; height: 28px; font-size: 14px; }

.btn-mini {
  padding: 7px 10px; font-size: 11px; font-weight: 800;
  border-radius: 10px; background: rgba(13, 17, 23, 0.85);
  border-color: rgba(51, 65, 85, 0.8); backdrop-filter: blur(8px);
}
.btn-mini.is-paused { color: var(--amber); border-color: rgba(251, 191, 36, 0.5); }

/* ---- Bars ---- */
.bar { width: 100%; height: 6px; background: #0b1018; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width 0.2s ease; }
.hp-high { background: #34d399; }
.hp-mid { background: #fbbf24; }
.hp-low { background: #f87171; }
.hp-dead { background: #475569; }
.bar-xp { background: linear-gradient(90deg, #22d3ee, #38bdf8); }

/* ---- Misc ---- */
.muted { color: var(--muted-2); font-size: 11px; }
.muted-note { font-size: 12px; color: var(--muted-2); font-style: italic; padding: 2px 4px; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.screen::-webkit-scrollbar { width: 5px; }
.screen::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 99px; }
