:root {
  color-scheme: dark;
  --ink: #f6f7ff;
  --ink-soft: #dfe3f1;
  --muted: #a9b0c2;
  --canvas: #05050a;
  --canvas-raised: #090a12;
  --surface: rgba(18, 20, 33, 0.86);
  --surface-strong: #151827;
  --surface-hover: #1b1f31;
  --line: rgba(213, 220, 255, 0.13);
  --line-strong: rgba(213, 220, 255, 0.24);
  --accent-cyan: #21d4fd;
  --accent-blue: #5576ff;
  --accent-violet: #a13cff;
  --accent-gradient: linear-gradient(125deg, var(--accent-cyan), var(--accent-blue) 52%, var(--accent-violet));
  --danger: #ff7a8a;
  --success: #54e0ae;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(33, 212, 253, 0.13), transparent 27rem),
    radial-gradient(circle at 92% 8%, rgba(161, 60, 255, 0.16), transparent 30rem),
    linear-gradient(160deg, #05050a 0%, #090a12 56%, #060710 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

.app-shell { position: relative; min-height: 100vh; }
.app-update-card { margin-bottom: 24px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 10, 0.78);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(24px) saturate(140%);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.brand-logo {
  width: 40px;
  height: 40px;
  display: block;
  position: relative;
  overflow: hidden;
  flex: 0 0 40px;
  border-radius: 50%;
  filter: drop-shadow(0 0 12px rgba(80, 119, 255, 0.32));
}

.brand-logo img {
  position: absolute;
  width: 239%;
  height: auto;
  max-width: none;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.profile-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, rgba(33, 212, 253, 0.18), rgba(161, 60, 255, 0.28));
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 8px 24px rgba(0, 0, 0, 0.26);
}

.main {
  position: relative;
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 32px 20px 112px;
}

.main:focus { outline: none; }
.is-hidden { display: none !important; }
.desktop-nav { display: none; }

.eyebrow {
  margin: 0 0 11px;
  color: #8fdcff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(36px, 8vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

h2 { margin: 0; font-size: 22px; letter-spacing: -0.025em; }
h3 { margin: 0; font-size: 17px; }
p { line-height: 1.55; }

.lead {
  max-width: 640px;
  margin: 19px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.stack { display: grid; gap: 12px; }
.terms-copy { line-height: 1.55; }
.terms-copy ul { margin: 0; padding-left: 22px; }
.terms-copy li + li { margin-top: 8px; }
.section-gap { margin-top: 30px; }
.card-copy { margin: 8px 0 0; }

.hero {
  min-height: calc(100vh - 216px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

.hero h1 {
  background: linear-gradient(120deg, #ffffff 12%, #d8dced 46%, #9adfff 72%, #d39aff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-actions { display: grid; gap: 12px; margin-top: 38px; }

.button {
  position: relative;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 19px;
  color: var(--ink);
  background: rgba(21, 24, 39, 0.9);
  font-weight: 760;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.button-primary { border-color: transparent; color: #fff; background: var(--accent-gradient); box-shadow: 0 14px 34px rgba(85, 118, 255, 0.25); }
.button-primary::after { content: ""; position: absolute; inset: 1px; border-radius: 14px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34); pointer-events: none; }
.button-primary:hover { background: linear-gradient(125deg, #43ddff, #6684ff 52%, #b558ff); }
.button-dark { color: white; background: linear-gradient(135deg, #252a3e, #121522); }
.button-quiet { border-color: var(--line-strong); color: var(--ink-soft); background: rgba(255, 255, 255, 0.025); box-shadow: none; }
.button-quiet:hover { color: white; background: rgba(255, 255, 255, 0.06); }
.button-full { width: 100%; }
.button:disabled { cursor: wait; opacity: 0.58; transform: none; }

.form-error, .error-text { color: var(--danger); }
.form-error { margin: 0; font-size: 0.9rem; }

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 42%),
    var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
}

.card-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.card + .card { margin-top: 14px; }
.label { color: var(--muted); font-size: 13px; }
.value { margin-top: 5px; color: white; font-size: 20px; font-weight: 800; }
.big-value { font-size: clamp(30px, 7vw, 46px); letter-spacing: -0.04em; }
.meta { color: var(--muted); font-size: 14px; }

.status-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: #778094;
}
.status-dot.on { background: var(--success); box-shadow: 0 0 0 5px rgba(84, 224, 174, 0.13), 0 0 20px rgba(84, 224, 174, 0.48); }
.device-status { display: inline-flex; align-items: center; color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.device-status .status-dot { margin-right: 9px; }
.device-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.notice-card {
  display: grid;
  gap: 5px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 190, 92, 0.36);
  border-radius: 16px;
  color: #ffe1a6;
  background: rgba(255, 164, 46, 0.09);
}
.notice-card span { color: var(--ink-soft); font-size: 14px; }

.power-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 17px;
  overflow: hidden;
  padding: 44px 20px;
  text-align: center;
  background: radial-gradient(circle at 50% 44%, rgba(85, 118, 255, 0.2), transparent 18rem), #090b14;
}

.power-card::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(78, 174, 255, 0.24);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(92, 70, 255, 0.12), inset 0 0 60px rgba(33, 212, 253, 0.05);
}

.power-button {
  position: relative;
  width: 136px;
  height: 136px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(200, 211, 255, 0.28);
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 16px 45px rgba(0, 0, 0, 0.38);
  font-size: 18px;
  font-weight: 820;
  transition: 0.2s ease;
}

.power-button.on { border-color: transparent; color: white; background: var(--accent-gradient); box-shadow: 0 0 38px rgba(85, 118, 255, 0.4); transform: scale(1.03); }
.power-copy { position: relative; margin: 0; color: var(--muted); }

.list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--line);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.23);
}

.list-item {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 17px;
  border: 0;
  color: var(--ink);
  background: rgba(15, 17, 29, 0.96);
  text-align: left;
  transition: background 0.17s ease;
}

button.list-item:hover { background: var(--surface-hover); }
.list-item strong { display: block; }
.list-item:disabled { cursor: default; opacity: 0.58; }
.chevron { color: #a8b0c7; font-size: 24px; font-weight: 300; }
.compact-list .list-item { min-height: 54px; }
.small-button { border: 1px solid rgba(255, 122, 138, 0.2); border-radius: 10px; padding: 8px 10px; color: #ff9aa6; background: rgba(255, 122, 138, 0.09); }
.history-amount { flex: 0 0 auto; color: var(--ink-soft); font-weight: 800; white-space: nowrap; }
.history-amount.positive { color: var(--success); }
.history-amount.negative { color: #ffbdc5; }

.balance-card {
  border-color: rgba(94, 128, 255, 0.32);
  background:
    radial-gradient(circle at 90% 5%, rgba(161, 60, 255, 0.28), transparent 18rem),
    radial-gradient(circle at 0 100%, rgba(33, 212, 253, 0.16), transparent 18rem),
    #111421;
}
.invite-line { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 14px; }
.invite-line strong { color: white; }

.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: #272b3a; transition: 0.2s; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; top: 2px; left: 3px; border-radius: 50%; background: #c3cada; transition: 0.2s; box-shadow: 0 2px 7px rgba(0, 0, 0, 0.36); }
.switch input:checked + span { border-color: rgba(63, 198, 255, 0.55); background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet)); }
.switch input:checked + span::after { transform: translateX(19px); background: white; }

.bottom-nav {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 9px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 74px;
  padding: 7px 5px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: rgba(9, 10, 18, 0.9);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(24px) saturate(145%);
}

.nav-button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 17px;
  color: #b8c0d2;
  background: transparent;
  font-size: 10px;
  font-weight: 680;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.nav-button:hover { color: white; background: rgba(255, 255, 255, 0.045); }
.nav-button .nav-icon { color: #cbd2e4; font-size: 19px; line-height: 1; }
.nav-button.active {
  border-color: rgba(106, 149, 255, 0.26);
  color: white;
  background: linear-gradient(135deg, rgba(33, 212, 253, 0.13), rgba(161, 60, 255, 0.16));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 7px 20px rgba(0, 0, 0, 0.16);
}
.nav-button.active .nav-icon { color: #8bdfff; text-shadow: 0 0 15px rgba(71, 168, 255, 0.7); }

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  padding: 12px;
  background: rgba(1, 2, 7, 0.76);
  backdrop-filter: blur(12px);
}
.modal {
  width: min(100%, 520px);
  max-height: calc(100vh - 24px);
  overflow: auto;
  margin: 0 auto;
  padding: 23px;
  border: 1px solid var(--line-strong);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(29, 33, 51, 0.98), rgba(12, 14, 24, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.icon-button { width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; color: white; background: rgba(255, 255, 255, 0.06); font-size: 25px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: 13px; font-weight: 700; }
.field input, .field select, .copy-field {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(4, 5, 11, 0.68);
}
.field input::placeholder { color: #727b91; }
.field + .field { margin-top: 12px; }
.prototype-note { margin-top: 16px; color: var(--muted); font-size: 12px; }
.channel-state { color: var(--muted); font-size: 13px; font-weight: 760; white-space: nowrap; }
.channel-state.active { color: var(--success); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 560px) {
  .device-row { align-items: flex-start; }
  .device-actions { flex-direction: column; align-items: flex-end; }
}

@media (min-width: 760px) {
  .topbar { padding: 0 36px; }
  .main { padding: 52px 36px 84px; }
  .hero-actions { grid-template-columns: 1fr 1fr; max-width: 540px; }
  .modal-layer { align-items: center; }
}

@media (min-width: 1080px) {
  .app-shell.authenticated { display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 76px 1fr; }
  .app-shell.authenticated .topbar { grid-column: 1 / -1; }
  .desktop-nav {
    grid-column: 1;
    grid-row: 2;
    display: grid !important;
    align-content: start;
    gap: 7px;
    padding: 30px 20px;
    border-right: 1px solid var(--line);
    background: rgba(6, 7, 13, 0.56);
    backdrop-filter: blur(18px);
  }
  .desktop-nav .nav-button {
    min-height: 54px;
    grid-template-columns: 30px 1fr;
    justify-items: start;
    padding: 0 16px;
    color: #c3cada;
    font-size: 14px;
    font-weight: 700;
  }
  .desktop-nav .nav-button.active { color: white; }
  .main { grid-column: 2; grid-row: 2; width: min(100%, 940px); }
  .bottom-nav { display: none !important; }
}
