/* eKRON PWA — app shell + install experience */
body.app-installed .app-install-card,
body.app-installed [data-install-sticky],
body.app-installed #app-install-gate,
body.app-installed [data-install-open],
html.app-installed .app-install-card,
html.app-installed [data-install-sticky],
html.app-installed #app-install-gate,
html.app-installed [data-install-open] {
  display: none !important;
}

body.app-body {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
}

body.app-body.has-install-sticky {
  padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px));
}

body.app-body.install-gate-open {
  overflow: hidden;
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 300;
  background: rgba(2, 6, 23, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  padding-top: env(safe-area-inset-top, 0px);
}

.app-header-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-header .brand {
  min-width: 0;
  flex: 1;
}

.app-header .brand-mark--app {
  height: 38px;
  width: auto;
  max-width: min(148px, 42vw);
  object-fit: contain;
  object-position: left center;
  display: block;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
}

.app-icon-btn:hover {
  color: #fff;
  text-decoration: none;
}

/* ── Main layout ── */
.app-main {
  width: min(720px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 24px;
}

.app-panel { display: none; }
.app-panel.active { display: block; }

.app-section-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 12px;
}

/* ── Install gate (fullscreen) ── */
.app-install-gate {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
}

.app-install-gate.open {
  display: flex;
}

.app-install-gate-panel {
  position: relative;
  width: min(480px, 100%);
  max-height: min(92dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, #0b1628 0%, #020617 100%);
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-bottom: none;
  border-radius: 28px 28px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.55);
  animation: appSheetUp 0.35s ease;
}

@keyframes appSheetUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.app-install-gate-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.app-install-gate-brand {
  text-align: center;
  margin: 4px 0 14px;
}

.app-install-gate-brand img {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 16px 40px rgba(251, 191, 36, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.app-install-gate h2 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.app-install-gate-lead {
  margin: 0 0 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.app-install-gate-steps {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.app-install-gate-actions {
  display: grid;
  gap: 10px;
}

.app-install-gate-actions .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.app-install-gate-actions .btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--soft);
}

/* ── Sticky install bar ── */
.app-install-sticky {
  display: none;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 350;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(7, 17, 31, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.app-install-sticky.visible {
  display: flex;
}

.app-install-sticky img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: cover;
}

.app-install-sticky-text {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.app-install-sticky-text span {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.app-install-sticky .btn {
  flex-shrink: 0;
  padding: 9px 12px;
  font-size: 0.78rem;
}

.app-install-sticky-dismiss {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

/* ── In-page install card (home tab) ── */
.app-install-card {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.1), rgba(124, 58, 237, 0.06));
}

.app-install-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-install-card-head img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid rgba(251, 191, 36, 0.22);
}

.app-install-card-head strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 3px;
}

.app-install-card-head span {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.app-install-card [data-install-card-steps] {
  display: grid;
  gap: 8px;
}

.app-install-card .install-step {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.app-install-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.app-install-card-actions .btn {
  justify-content: center;
  text-align: center;
  font-size: 0.82rem;
  padding: 11px 10px;
}

/* ── Hero ── */
.app-hero {
  text-align: center;
  padding: 4px 0 16px;
}

.app-hero-lockup img {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  margin-bottom: 12px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  box-shadow: 0 12px 32px rgba(251, 191, 36, 0.15);
}

.app-hero h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.app-hero p {
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 400px;
}

/* Trust strip inside app */
.app-body [data-trust-strip] { margin: 14px 0 0; display: block; }

.app-body .trust-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
}

.app-body .trust-strip .trust-item {
  font-size: 0.68rem;
  padding: 7px 8px;
}

/* Metrics */
.app-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0 14px;
}

.app-metric {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

.app-metric .num {
  display: block;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--gold);
}

.app-metric .lbl {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
}

/* Contract card */
.app-contract-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  margin-bottom: 14px;
}

.app-contract-card .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  font-weight: 700;
  margin-bottom: 8px;
}

.app-contract-card .addr {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.74rem;
  word-break: break-all;
  line-height: 1.45;
  margin-bottom: 10px;
}

.app-contract-card .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.app-contract-card .btn {
  justify-content: center;
  font-size: 0.8rem;
  padding: 10px;
}

/* Tiles */
.app-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.app-tile {
  display: block;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-decoration: none;
}

.app-tile:hover {
  border-color: rgba(251, 191, 36, 0.4);
  text-decoration: none;
  color: #fff;
}

.app-tile .icon { font-size: 1.2rem; margin-bottom: 6px; }
.app-tile strong { display: block; font-size: 0.86rem; margin-bottom: 3px; }
.app-tile span { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }

.app-warning {
  margin: 14px 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Family + links */
.app-family-list,
.app-link-list {
  display: grid;
  gap: 8px;
}

.app-family-item,
.app-link-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.app-link-item {
  display: block;
  text-decoration: none;
  color: #fff;
}

.app-link-item:hover {
  border-color: rgba(251, 191, 36, 0.35);
  text-decoration: none;
  color: #fff;
}

.app-family-item h3 { margin: 0 0 4px; font-size: 0.95rem; }
.app-family-item p { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

.app-family-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.app-family-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
}

.app-family-badge.live {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

.app-link-item strong { display: block; font-size: 0.88rem; margin-bottom: 2px; }
.app-link-item em { display: block; font-style: normal; font-size: 0.7rem; color: var(--gold); margin-bottom: 3px; word-break: break-all; }
.app-link-item span { font-size: 0.76rem; color: var(--muted); line-height: 1.4; }

/* Tab bar */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(2, 6, 23, 0.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.app-tabbar-inner {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 60px;
}

.app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 4px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.app-tab .tab-icon { font-size: 1.15rem; line-height: 1; }
.app-tab.active { color: var(--gold); }

/* Install page */
.install-page .app-main { max-width: 640px; }

.install-hero-card {
  text-align: center;
  padding: 20px 16px;
  border-radius: 22px;
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.08), rgba(124, 58, 237, 0.05));
  margin-bottom: 18px;
}

.install-hero-card img {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  object-fit: cover;
  margin-bottom: 12px;
  border: 1px solid rgba(251, 191, 36, 0.22);
}

.install-hero-card h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.install-hero-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.install-steps { display: grid; gap: 10px; margin: 0 0 16px; }

.install-step {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.install-platform {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 6px;
}

.install-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
  word-break: break-word;
}

.install-step code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--gold);
  word-break: break-all;
}

.install-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.install-actions .btn {
  width: 100%;
  justify-content: center;
}

/* Homepage investor-app style promo */
.investor-app-section {
  padding: 56px 0;
}

.investor-app-card {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  border-radius: 28px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.09), rgba(124, 58, 237, 0.07));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.investor-app-copy {
  padding: 28px 28px 24px;
}

.investor-app-copy .kicker { margin-bottom: 10px; }

.investor-app-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.investor-app-copy h2 strong {
  color: var(--gold);
  font-weight: 900;
}

.investor-app-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.investor-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.investor-app-install {
  padding: 24px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(2, 6, 23, 0.35);
  display: grid;
  gap: 10px;
  align-content: center;
}

.investor-app-install .install-step {
  margin: 0;
}

.investor-app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.investor-app-brand img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(251, 191, 36, 0.22);
  flex-shrink: 0;
}

/* Registry in app */
.app-body .registry-panel { margin: 0; }
.app-body .registry-head h3 { font-size: 0.95rem; }
.app-body .registry-contract-card .addr { font-size: 0.7rem; }

@media (min-width: 640px) {
  .app-metrics { grid-template-columns: repeat(4, 1fr); }
  .app-install-gate { align-items: center; padding: 20px; }
  .app-install-gate-panel {
    border-radius: 28px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.28);
    max-height: 88dvh;
  }
}

@media (max-width: 860px) {
  .investor-app-card { grid-template-columns: 1fr; }
  .investor-app-install {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
}

@media (max-width: 400px) {
  .app-tiles,
  .app-install-card-actions,
  .app-contract-card .actions {
    grid-template-columns: 1fr;
  }

  .app-install-sticky {
    left: 8px;
    right: 8px;
    padding: 8px 10px;
  }

  .app-install-sticky .btn {
    padding: 8px 10px;
    font-size: 0.72rem;
  }
}
