:root {
  --bg: #0e1013;
  --surface: #171a20;
  --surface-2: #1f232b;
  --line: #2a2f3a;
  --text: #e9edf4;
  --muted: #9aa3b4;
  --accent: #5b6cff;
  --accent-ink: #ffffff;
  --good: #37c276;
  --bad: #ff6b6b;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(0,0,0,.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family:
    "Roboto",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;

  background: var(--bg);
  color: var(--text);

  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 460px;
  height: 100dvh;

  display: flex;
  flex-direction: column;

  background: var(--bg);

  position: relative;
  overflow: hidden;
}


/* top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding:
    calc(12px + env(safe-area-inset-top))
    18px
    10px;

  background: var(--bg);
}

.topbar-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2px;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--line);

  color: var(--text);

  width: 40px;
  height: 40px;

  border-radius: 50%;

  display: grid;
  place-items: center;

  cursor: pointer;
}

.icon-btn:active {
  transform: scale(.92);
}

.icon-btn svg {
  width: 20px;
  height: 20px;

  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}


/* content */

.content {
  flex: 1;

  overflow-y: auto;

  padding:
    8px
    16px
    calc(90px + env(safe-area-inset-bottom));

  scrollbar-width: none;
}

.content::-webkit-scrollbar {
  display: none;
}

.screen {
  display: none;
  animation: fade .18s;
}

.screen.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}


/* cards */

.card {
  background: var(--surface);

  border: 1px solid var(--line);

  border-radius: var(--radius);

  padding: 16px;

  margin-bottom: 14px;

  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.note {
  display: flex;
  flex-direction: column;
  gap: 4px;

  background: var(--surface-2);

  box-shadow: none;
}

.note strong {
  font-size: 14px;
}

.note span {
  font-size: 12.5px;
  color: var(--muted);
}


/* hero */

.hero {
  position: relative;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px 20px;

  background:
    radial-gradient(
      300px 130px at 50% -20%,
      rgba(91,108,255,.35),
      transparent 70%
    ),
    linear-gradient(
      180deg,
      var(--surface),
      var(--surface-2)
    );
}

.hero-info {
  text-align: center;
}

.hero-name {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .5px;
}

.hero-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}


/* status */

.status-card {
  padding: 8px 16px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 11px 0;

  border-bottom: 1px solid var(--line);
}

.status-row:last-child {
  border-bottom: 0;
}

.st-label {
  font-size: 14px;
  color: var(--muted);
}

.st-val {
  font-size: 14px;
  font-weight: 700;
}

.st-val.ok {
  color: var(--good);
}

.st-val.bad {
  color: var(--bad);
}


/* buttons */

.primary {
  width: 100%;

  border: 0;
  border-radius: 14px;

  padding: 15px;

  font-size: 15px;
  font-weight: 700;

  background: var(--accent);
  color: var(--accent-ink);

  cursor: pointer;

  box-shadow:
    0 8px 20px
    rgba(91,108,255,.3);
}

.primary:disabled {
  opacity: .65;
  cursor: default;
}

.action-row {
  display: flex;
  gap: 10px;

  margin-bottom: 12px;
}

.action {
  flex: 1;

  border: 1px solid var(--line);
  border-radius: 14px;

  padding: 14px 8px;

  font-size: 14px;
  font-weight: 700;

  background: var(--surface-2);
  color: var(--text);

  cursor: pointer;
}

.action:active {
  transform: scale(.97);
}

.action.locked {
  opacity: .4;
}

.footnote {
  text-align: center;

  font-size: 12.5px;
  color: var(--muted);

  padding: 2px 0 14px;
}


/* lists */

.list {
  display: flex;
  flex-direction: column;
}

.row {
  display: flex;
  align-items: center;

  gap: 13px;

  padding: 12px 2px;

  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row-ic {
  flex: none;

  width: 40px;
  height: 40px;

  border-radius: 12px;

  background: var(--surface-2);
  border: 1px solid var(--line);

  display: grid;
  place-items: center;

  font-weight: 800;
  font-size: 16px;

  color: var(--accent);
}

.row-info {
  flex: 1;
  min-width: 0;
}

.row-name {
  font-size: 14.5px;
  font-weight: 600;
}

.row-meta {
  font-size: 12px;
  color: var(--muted);

  margin-top: 2px;
}


/* switch */

.switch {
  position: relative;

  width: 48px;
  height: 28px;

  border-radius: 16px;

  border: 0;

  background: #3a404c;

  cursor: pointer;
}

.switch.on {
  background: var(--accent);
}

.switch::after {
  content: "";

  position: absolute;

  top: 3px;
  left: 3px;

  width: 22px;
  height: 22px;

  border-radius: 50%;

  background: white;

  transition:
    transform .18s;

  box-shadow:
    0 2px 5px
    rgba(0,0,0,.25);
}

.switch.on::after {
  transform: translateX(20px);
}


/* settings */

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;

  padding: 11px 0;

  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row > span {
  font-size: 14px;
}

select {
  background: var(--surface-2);

  color: var(--text);

  border: 1px solid var(--line);

  border-radius: 10px;

  padding: 8px 10px;

  font-size: 13px;
  font-weight: 600;
}


/* root terminal */

.root-overlay {
  position: absolute;

  inset: 0;

  z-index: 80;

  background: #000;

  display: flex;

  animation: fadein .15s;
}

.root-overlay[hidden] {
  display: none;
}

.terminal {
  width: 100%;
  height: 100%;

  background: #050607;

  color: #d7e0d9;

  display: flex;
  flex-direction: column;

  font-family:
    "Cascadia Mono",
    "Consolas",
    monospace;
}

.terminal-header {
  flex: none;

  display: flex;
  justify-content: space-between;

  padding:
    calc(12px + env(safe-area-inset-top))
    14px
    12px;

  background: #111;

  border-bottom: 1px solid #242424;

  font-size: 12px;
  font-weight: 700;
}

.terminal-status {
  color: var(--accent);
}

#terminal-output {
  flex: 1;

  margin: 0;

  padding: 14px;

  overflow: auto;

  white-space: pre;

  font-size: 10px;

  line-height: 1.45;

  color: #cbd5ce;
}


/* mods overlay */

.overlay {
  position: absolute;

  inset: 0;

  z-index: 40;

  background:
    rgba(8,9,12,.72);

  backdrop-filter: blur(6px);

  display: flex;

  justify-content: center;

  align-items: stretch;
}

.overlay[hidden] {
  display: none;
}

.overlay-card {
  background: var(--surface);

  border: 1px solid var(--line);

  width: 100%;

  margin: 60px 16px 16px;

  border-radius: var(--radius);

  padding: 16px;

  align-self: flex-start;

  box-shadow: var(--shadow);
}

.overlay-head {
  display: flex;

  align-items: flex-start;

  gap: 12px;

  margin-bottom: 16px;
}

.overlay-title {
  flex: 1;

  display: flex;

  flex-direction: column;

  gap: 3px;
}

.overlay-title strong {
  font-size: 16px;
}

.overlay-title span {
  font-size: 12px;
  color: var(--muted);
}


/* upload */

.upload-card {
  border: 2px dashed var(--line);

  border-radius: 16px;

  background: var(--surface-2);

  cursor: pointer;

  text-align: center;
}

.upload-card.hover {
  border-color: var(--accent);

  background:
    rgba(91,108,255,.06);
}

.upload-inner {
  padding: 28px 16px;

  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 6px;
}

.upload-icon {
  width: 52px;
  height: 52px;

  border-radius: 14px;

  display: grid;
  place-items: center;

  color: var(--accent);

  background:
    rgba(91,108,255,.14);

  margin-bottom: 8px;
}

.upload-icon svg {
  width: 26px;
  height: 26px;
}

.upload-title {
  margin: 0;

  font-size: 15px;
  font-weight: 700;
}

.upload-hint {
  margin: 0;

  font-size: 12.5px;

  color: var(--muted);
}

.upload-hint span {
  color: var(--accent);

  font-weight: 600;
}


/* file */

.file-chip {
  margin-top: 10px;

  display: flex;
  align-items: center;

  gap: 8px;

  background:
    rgba(91,108,255,.14);

  border:
    1px solid
    rgba(91,108,255,.3);

  padding: 7px 10px;

  border-radius: 10px;

  font-size: 12.5px;

  font-weight: 600;
}

.chip-name {
  max-width: 160px;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.chip-clear {
  border: 0;

  background: none;

  color: var(--muted);

  cursor: pointer;

  display: grid;
  place-items: center;
}

.chip-clear svg {
  width: 16px;
  height: 16px;
}


/* mod buttons */

.mod-actions {
  display: flex;

  gap: 10px;

  margin: 14px 0;
}

.mod-btn {
  flex: 1;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 8px;

  border: 1px solid var(--line);

  border-radius: 13px;

  padding: 13px 8px;

  font-size: 14px;
  font-weight: 700;

  background: var(--surface-2);

  color: var(--text);

  cursor: pointer;
}

.mod-btn:disabled {
  opacity: .4;

  cursor: default;
}

.mod-btn.armed {
  border-color: var(--accent);

  color: var(--accent);
}

.mod-btn.busy {
  opacity: .6;
}

.mod-btn svg {
  width: 19px;
  height: 19px;
}


/* apk info */

.apk-info {
  display: flex;

  flex-direction: column;

  gap: 4px;

  padding: 10px;

  margin-bottom: 12px;

  border-radius: 10px;

  background: var(--surface-2);

  border: 1px solid var(--line);

  overflow: hidden;
}

.apk-label {
  font-size: 10px;

  color: var(--muted);

  font-weight: 700;
}

#apk-link {
  font-size: 11px;

  color: var(--accent);

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;
}


/* status */

.mod-status {
  text-align: center;

  font-size: 12.5px;

  color: var(--muted);

  font-weight: 600;

  min-height: 16px;
}

.mod-status.busy {
  color: var(--accent);
}

.mod-status.ok {
  color: var(--good);
}

.mod-status.err {
  color: var(--bad);
}


/* toast */

.notif {
  position: absolute;

  left: 50%;

  bottom:
    calc(
      96px +
      env(safe-area-inset-bottom)
    );

  transform:
    translateX(-50%)
    translateY(10px);

  background: var(--surface-2);

  border: 1px solid var(--line);

  color: var(--text);

  padding: 10px 16px;

  border-radius: 12px;

  font-size: 13px;

  font-weight: 600;

  opacity: 0;

  pointer-events: none;

  transition:
    opacity .2s,
    transform .2s;

  max-width: 86%;

  text-align: center;

  z-index: 100;

  box-shadow: var(--shadow);
}

.notif.show {
  opacity: 1;

  transform:
    translateX(-50%)
    translateY(0);
}

.notif.success {
  border-color: var(--good);

  color: var(--good);
}

.notif.error {
  border-color: var(--bad);

  color: var(--bad);
}


/* bottom nav */

.bottomnav {
  position: absolute;

  left: 0;
  right: 0;

  bottom:
    env(safe-area-inset-bottom);

  display: flex;

  background:
    rgba(23,26,32,.92);

  backdrop-filter: blur(14px);

  border-top:
    1px solid var(--line);

  padding: 6px 4px;
}

.nav-item {
  flex: 1;

  background: none;

  border: 0;

  color: var(--muted);

  cursor: pointer;

  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 3px;

  padding: 6px 0;

  font-size: 11px;

  font-weight: 600;
}

.nav-item svg {
  width: 22px;
  height: 22px;

  fill: none;

  stroke: currentColor;

  stroke-width: 1.8;

  stroke-linecap: round;

  stroke-linejoin: round;
}

.nav-item.active {
  color: var(--accent);
}


@keyframes fadein {
  from {
    opacity: 0;
  }
}