/* aso analytics, dark theme, palette lives in :root */

:root {
  --bg: #0f0f13;
  --card: #17171c;
  --tile: #1c1c23;
  --ctrl: #1d1d24;
  --line: rgba(255, 255, 255, .07);
  --txt: #f4f4f6;
  --muted: #9a9aa6;
  --dim: #6d6d78;
  --acc: #a855f7;
  --acc2: #c084fc;
  --acct: rgba(168, 85, 247, .16);
  --green: #22c55e;
  --greent: rgba(34, 197, 94, .16);
  --star: #eab308;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }

.svg { width: 20px; height: 20px; flex: none; }

/* no phone frame anymore, app fills the whole page */
.phone {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.app { position: relative; height: 100%; display: flex; flex-direction: column; }

.screens { position: relative; flex: 1; min-height: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.screen.active { opacity: 1; visibility: visible; }

/* header */
.topbar {
  flex: none;
  position: relative;
  z-index: 25; /* above the backdrop so the country button can close the list */
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 10px;
}

.hrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.htitle {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.topbar--nav {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 6px;
}

.topbar__title {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

.navpair { display: flex; gap: 2px; }

.iconbtn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--ctrl);
  color: var(--txt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .15s ease;
}
.iconbtn:active { transform: scale(.92); }
.iconbtn .svg { width: 18px; height: 18px; }

.iconbtn--bare { background: transparent; border-color: transparent; }
.iconbtn--bare.on { color: var(--acc2); }

/* country button */
.cbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--ctrl);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease;
}
.cbtn:active { transform: scale(.97); }
.cbtn .flag { font-size: 15px; line-height: 1; }
.cbtn .svg { width: 14px; height: 14px; color: var(--dim); }

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 112px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }

.pane { display: none; }
.pane.active { display: block; animation: fadeUp .3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* search */
.searchbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--ctrl);
}
.searchbox .svg { width: 17px; height: 17px; color: var(--dim); }
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--txt);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.searchbox input::placeholder { color: var(--dim); }
.searchbox input::-webkit-search-cancel-button { display: none; }

.emptyhint { padding: 84px 24px 0; text-align: center; }
.emptyhint strong { display: block; font-size: 17px; font-weight: 800; }
.emptyhint span { display: block; margin-top: 7px; font-size: 12.5px; line-height: 1.5; color: var(--dim); }

.section-label {
  margin: 20px 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
}

.list { display: flex; flex-direction: column; gap: 10px; }

/* list rows */
.lrow {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease;
}
.lrow:active { transform: scale(.985); }
.lrow--rank { grid-template-columns: auto auto 1fr auto; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px; /* store icons are squares, not circles */
  overflow: hidden;
  background: var(--acct);
  color: var(--acc2);
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lrow__body { min-width: 0; }
.lrow__body strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lrow__body span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lrow__end { text-align: right; }
.rate {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
}
.rate .svg { width: 12px; height: 12px; color: var(--star); }

.pill {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.pill--free { background: var(--greent); color: #4ade80; }
.pill--paid { background: #26262e; color: #c9c9d2; }

.rank {
  width: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--dim);
}

/* watchlist */
.wrow {
  width: 100%;
  padding: 13px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease;
}
.wrow:active { transform: scale(.985); }

.wrow__body { min-width: 0; }
.wrow__body strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wrow__dev { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.wrow__meta { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.wrow__meta .svg { width: 12px; height: 12px; color: var(--star); }
.wrow__meta b { font-size: 11.5px; font-weight: 600; }
.wrow__meta .pill { margin-top: 0; }

.wrow__end { display: flex; align-items: center; gap: 8px; }
.wrow__end .spark { width: 46px; height: 14px; color: #5b5b66; }
.wrow__end .svg { width: 15px; height: 15px; color: #4a4a55; }

/* settings */
.group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
}
.group + .group, .hint + .section-label { margin-top: 0; }
.section-label + .group { margin-top: 0; }
.group { margin-bottom: 10px; }

.grow {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
  text-align: left;
  cursor: pointer;
}
.grow + .grow { border-top: 1px solid var(--line); }
.grow > span:first-child { flex: 1; min-width: 0; }

.gval {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #d9d9e0;
}
.gval .flag { font-size: 14px; line-height: 1; }
.gval .svg { width: 14px; height: 14px; color: #4a4a55; }

.grow--acc { color: var(--acc2); justify-content: flex-start; gap: 10px; }
.grow--acc .svg { width: 16px; height: 16px; }

.grow .chev { width: 15px; height: 15px; color: #4a4a55; }

/* toggle switch */
.grow input { position: absolute; opacity: 0; pointer-events: none; }
.sw {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
  border-radius: 999px;
  background: #2a2a33;
  transition: background .2s ease;
}
.sw::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.grow input:checked + .sw { background: var(--green); }
.grow input:checked + .sw::after { transform: translateX(18px); }

.hint {
  margin: 0 4px 8px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--dim);
}

/* app card */
.hero {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  padding: 16px;
}

.hero__top strong { display: block; font-size: 17px; font-weight: 800; }
.hero__top span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.hero__row { display: flex; justify-content: space-between; margin-top: 14px; }
.hero__row strong { display: block; font-size: 16px; font-weight: 700; }
.hero__row span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--dim); }
.hero__row .r { text-align: right; }

.hero__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.hlab {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
}
.hlab .svg { width: 13px; height: 13px; }
.ti--blue { color: #60a5fa; }
.ti--purple { color: var(--acc2); }
.hero__cols strong { display: block; margin-top: 7px; font-size: 15px; font-weight: 700; }
.hero__cols .cap { display: block; margin-top: 2px; font-size: 10.5px; color: var(--dim); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tile {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--tile);
  padding: 12px;
}
.tile__lab {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}
.tile__lab .svg { width: 13px; height: 13px; color: var(--dim); }
.tile strong { display: block; margin-top: 9px; font-size: 14px; font-weight: 700; }

.sumcard {
  border: 1px solid rgba(168, 85, 247, .28);
  border-radius: 14px;
  background: rgba(168, 85, 247, .10);
  padding: 14px;
}
.sumcard__lab {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--acc2);
}
.sumcard p { margin: 10px 0 0; font-size: 12.5px; line-height: 1.65; color: #cfcfda; }

.copybtn {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border: 1px solid rgba(168, 85, 247, .35);
  border-radius: 12px;
  background: rgba(168, 85, 247, .14);
  color: var(--acc2);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .15s ease;
}
.copybtn:active { transform: scale(.98); }
.copybtn .svg { width: 15px; height: 15px; }

/* bottom tabbar, TODO: ios keyboard covers it, needs thought */
.tabbar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #16161b;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  z-index: 10;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 6px 0 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #8b8b96;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s;
}
.tab .tw {
  width: 42px;
  height: 26px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.tab .svg { width: 18px; height: 18px; }
.tab.active { color: var(--acc2); }
.tab.active .tw { background: var(--acct); }

/* country dropdown */
.dropdown {
  position: absolute;
  z-index: 30;
  min-width: 230px;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #17171c;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  scrollbar-width: none;
}
.dropdown::-webkit-scrollbar { display: none; }
.dropdown.open { opacity: 1; transform: none; pointer-events: auto; }

.drow {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #e8e8ee;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.drow:active { background: #22222a; }
.drow .chk { width: 14px; visibility: hidden; }
.drow .chk .svg { width: 14px; height: 14px; }
.drow.sel .chk { visibility: visible; }
.drow .flag { font-size: 15px; line-height: 1; }

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 20;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 14px);
  max-width: 82%;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #22222a;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.spin { animation: rot .6s linear; }
@keyframes rot { to { transform: rotate(360deg); } }

.empty {
  margin: 34px 0;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
}

/* about/legal text, laid out like the store listing */
.doc__h {
  margin: 26px 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--txt);
}
.doc__p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #d3d3db;
}
.doc__ul { margin: 0 0 14px; padding: 0; list-style: none; }
.doc__ul li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #d3d3db;
}
.doc__ul li::before { content: "•"; position: absolute; left: 2px; }

:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* tiny screens */
@media (max-width: 360px) {
  .content { padding: 4px 10px 112px; }
  .htitle { font-size: 23px; }
}
