:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #1b1b1b;
  --surface-2: #242424;
  --surface-3: #2b2b2b;
  --line: rgba(255, 255, 255, 0.16);
  --text: #f6f6f6;
  --muted: #c0c0c0;
  --soft: #eeeeee;
  --green: #7df0b2;
  --blue: #8bb8ff;
  --amber: #ffd166;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding:
    calc(10px + var(--safe-top))
    calc(14px + var(--safe-right))
    0
    calc(14px + var(--safe-left));
  background:
    linear-gradient(180deg, rgba(125, 240, 178, 0.24), transparent 230px),
    radial-gradient(circle at 100% 0, rgba(139, 184, 255, 0.2), transparent 240px),
    var(--bg);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 16px;
}

.title-stack {
  min-width: 0;
}

.kicker,
.summary-label {
  display: block;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 2px;
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.55rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.app-main {
  min-height: 0;
  overflow: hidden;
  padding-bottom: calc(90px + var(--safe-bottom));
}

.app-view {
  display: none;
  height: 100%;
  overflow: auto;
  padding-bottom: 18px;
  scrollbar-width: none;
}

.app-view::-webkit-scrollbar {
  display: none;
}

.app-view.is-active {
  display: block;
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-card {
  min-height: 180px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.1) 48%, rgba(125, 240, 178, 0.2)),
    var(--surface);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.36);
}

.app-orb {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.app-orb span {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--green);
  box-shadow:
    0 0 0 11px rgba(125, 240, 178, 0.08),
    0 0 26px rgba(125, 240, 178, 0.42);
}

.hero-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
  line-height: 1.12;
  color: #ffffff;
}

.hero-card p {
  margin-top: 7px;
  color: #f2f2f2;
  line-height: 1.35;
  font-weight: 650;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric-card {
  min-height: 136px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent), var(--surface);
  cursor: pointer;
}

.metric-icon,
.preview-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--green);
}

.metric-icon svg,
.tab-button svg,
.primary-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-card span:not(.metric-icon) {
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 750;
}

.metric-value {
  max-width: 100%;
  font-size: 0.96rem;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
}

.section-head {
  padding: 10px 2px 14px;
}

.list-card,
.device-panel,
.form-card,
.notification-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 27, 27, 0.98);
  overflow: hidden;
}

.list-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row span {
  color: #f0f0f0;
  font-weight: 650;
}

.list-row strong {
  color: #ffffff;
  font-size: 0.94rem;
  text-align: right;
  font-weight: 850;
}

.device-panel,
.form-card {
  padding: 14px;
}

.device-panel p {
  color: var(--soft);
  line-height: 1.45;
  font-weight: 650;
}

.phone-frame {
  width: min(190px, 70%);
  height: 246px;
  position: relative;
  margin: 18px auto 4px;
  padding: 16px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)),
    #080808;
  box-shadow: inset 0 0 0 6px #050505;
}

.phone-speaker {
  width: 52px;
  height: 5px;
  margin: 4px auto 30px;
  border-radius: 999px;
  background: #2b2b2b;
}

.phone-bubble {
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 30px rgba(125, 240, 178, 0.28);
}

.phone-lines {
  display: grid;
  gap: 8px;
}

.phone-lines span {
  height: 9px;
  border-radius: 999px;
  background: #2b2b2b;
}

.phone-lines span:nth-child(2) {
  width: 76%;
}

.phone-lines span:nth-child(3) {
  width: 56%;
}

.notification-preview {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(35, 35, 35, 0.86);
}

.preview-icon {
  color: #050505;
  background: var(--green);
  font-weight: 900;
}

.notification-preview strong,
.notification-preview span {
  display: block;
}

.notification-preview span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

label {
  display: block;
  color: var(--soft);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

input,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080808;
  color: var(--text);
  outline: none;
  padding: 13px 12px;
  -webkit-appearance: none;
}

textarea {
  min-height: 118px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(125, 240, 178, 0.42);
  box-shadow: 0 0 0 4px rgba(125, 240, 178, 0.08);
}

.primary-action {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #03150b;
  font-weight: 850;
  cursor: pointer;
  margin-top: 10px;
}

.secondary-action {
  background: #242424;
  color: var(--text);
  border: 1px solid var(--line);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: 164px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-muted {
  color: #f1f1f1;
  background: rgba(255, 255, 255, 0.12);
}

.status-ok {
  color: #03150b;
  background: var(--green);
}

.status-warn {
  color: #2b1e00;
  background: var(--amber);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(76px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 4px;
  padding: 8px calc(14px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(14px + var(--safe-left));
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(12, 12, 12, 0.88);
  backdrop-filter: blur(22px);
  box-shadow: 0 -16px 42px rgba(0, 0, 0, 0.3);
}

.tab-button {
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab-button.is-active {
  color: var(--green);
  background: rgba(125, 240, 178, 0.1);
}

.tab-button span {
  font-size: 0.72rem;
  font-weight: 800;
}

.primary-action:active,
.metric-card:active,
.tab-button:active {
  transform: scale(0.985);
}

@media (min-width: 760px) {
  .app-shell {
    width: min(460px, 100%);
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .tabbar {
    left: 50%;
    right: auto;
    width: min(460px, 100%);
    transform: translateX(-50%);
  }
}

body[data-standalone="true"] .app-shell {
  padding-top: max(10px, var(--safe-top));
}

body[data-standalone="true"] .tabbar {
  bottom: 0;
}

@media (max-height: 740px) {
  .phone-frame {
    width: 132px;
    height: 172px;
    border-radius: 22px;
    padding: 12px;
  }

  .phone-speaker {
    width: 40px;
    margin-bottom: 18px;
  }

  .phone-bubble {
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
  }
}
