/* HeyApps — white, simple, bold type */
:root {
  --bg: #ffffff;
  --ink: #111113;
  --ink-2: #55555c;
  --ink-3: #9a9aa2;
  --line: #ececee;
  --soft: #f5f5f6;
  --radius: 16px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + var(--safe-t)) 20px 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-weight: 900; font-size: 24px; letter-spacing: -0.04em;
  color: var(--ink); text-decoration: none;
}
.wordmark span { color: var(--ink-3); }
.install-chip {
  font-size: 14px; font-weight: 700; padding: 8px 14px;
  border: 1.5px solid var(--ink); border-radius: 999px;
}

main { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.view-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 18px; }
h1 { font-size: 40px; font-weight: 900; letter-spacing: -0.045em; margin: 0; line-height: 1; }
h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.text-btn { font-weight: 700; font-size: 15px; padding: 6px 2px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 16px;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn-ghost { background: var(--soft); color: var(--ink); }
.pill {
  min-width: 68px; height: 32px; padding: 0 14px; border-radius: 999px;
  background: var(--soft); font-weight: 800; font-size: 14px;
}
.pill.is-in { background: var(--ink); color: #fff; }

/* App icon */
.app-icon {
  width: 64px; height: 64px; border-radius: 15px; object-fit: cover;
  border: 1px solid var(--line); background: var(--soft); display: block;
}
.app-icon.lg { width: 84px; height: 84px; border-radius: 20px; }

/* Library grid (home screen) */
.grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px 12px;
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tile .app-icon { width: 100%; max-width: 72px; height: auto; aspect-ratio: 1; }
.tile-name { font-size: 12px; font-weight: 600; text-align: center; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-remove {
  position: absolute; top: -6px; left: calc(50% - 44px);
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  box-shadow: 0 0 0 3px #fff;
}
.tile-remove svg { width: 12px; height: 12px; stroke-width: 3; }
.editing .tile .app-icon { animation: wiggle .28s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
@media (prefers-reduced-motion: reduce) { .editing .tile .app-icon { animation: none; } }

.empty { text-align: center; padding: 60px 12px; }
.empty-title { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 6px; }
.empty-sub { color: var(--ink-2); margin: 0 0 22px; }

/* Discover */
.search {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 14px; border-radius: 14px;
  background: var(--soft);
}
.search svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--ink);
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; color: var(--ink-2);
}
.chip.is-active { border-color: var(--ink); color: var(--ink); }

.list { list-style: none; margin: 8px 0 24px; padding: 0; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.row-text { flex: 1; min-width: 0; }
.row-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.row-tag { color: var(--ink-2); font-size: 14px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-results { color: var(--ink-2); text-align: center; padding: 40px 0; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 56px;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11px; font-weight: 700; min-width: 72px; }
.tab svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--ink); }

/* Runner */
.runner {
  position: fixed; inset: 0; z-index: 50; background: #fff;
  display: flex; flex-direction: column;
}
.runner-bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  border-bottom: 1px solid var(--line);
}
.runner-title { flex: 1; font-weight: 800; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; }
.icon-btn svg { width: 22px; height: 22px; stroke-width: 2.4; }
.runner iframe { flex: 1; width: 100%; border: 0; background: #fff; padding-bottom: var(--safe-b); }

/* Sheets */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(17,17,19,.28);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 520px; background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 10px 22px calc(22px + var(--safe-b));
  animation: up .24s cubic-bezier(.2,.8,.2,1);
}
@media (min-width: 560px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 24px; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 18px; }
.sheet h2 { margin-bottom: 14px; }
.detail-top { display: flex; align-items: center; gap: 16px; }
.detail-top h2 { margin: 0 0 4px; }
.detail-top p { margin: 0; }
.detail-desc { color: var(--ink-2); line-height: 1.5; margin: 18px 0 22px; }
.sheet-actions { display: grid; gap: 10px; }
.sheet .btn { width: 100%; }

.steps { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 14px; }
.steps li { display: flex; align-items: center; gap: 12px; font-size: 16px; line-height: 1.4; flex-wrap: wrap; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
svg.inline { width: 16px; height: 16px; vertical-align: -3px; }
#iosGuide .btn { margin-top: 10px; }
.ios-arrow {
  position: fixed; right: 18px; bottom: 6px; z-index: 61; color: #fff;
  animation: bob 1s ease-in-out infinite alternate;
}
.ios-arrow svg { width: 34px; height: 34px; stroke-width: 3; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
@keyframes bob { from { transform: translateY(-6px); } to { transform: translateY(2px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
  padding: 10px 16px; border-radius: 12px; transition: all .2s ease; z-index: 70;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
