/*
 * Mobile layer. Loaded after each page's own <style>, so these rules win on phones.
 * Pure layout refactor: no markup, data or behaviour changes. Everything is scoped to <= 720px.
 */
@media (max-width: 720px) {
  body { padding-left: 14px; padding-right: 14px; padding-bottom: 28px; }
  img, svg, iframe, video { max-width: 100%; }

  /* ---------- shared chrome ---------- */
  /* topbar: one row of equal-width links, whatever their count */
  .topbar .nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .topbar .nav a { font-size: 10px; }
  .ticker { margin: 0 -14px; }
  .ticker .lead { padding: 0 11px; font-size: 10px; gap: 6px; }
  .ticker .ev { padding: 8px 16px; font-size: 11px; }
  .panel-head { padding: 8px 12px; font-size: 10px; }
  .btn { min-height: 42px; }
  .btn.big { padding: 12px 16px; }
  .seg button { padding: 9px 14px; }
  footer { margin-top: 36px; gap: 14px; }
  .toast { max-width: calc(100vw - 28px); font-size: 12px; }
  #toasts { bottom: 16px; }

  /* ---------- home ---------- */
  .toputility { margin: 0 -14px; padding: 5px 14px; font-size: 10px; }
  main { gap: 30px; padding-top: 22px; }
  .hero { gap: 16px; align-items: stretch; }
  .hero .herotext { gap: 12px; }
  h1 { font-size: clamp(38px, 12.5vw, 54px); letter-spacing: -.04em; }
  h1 mark { box-shadow: 3px 3px 0 var(--ink); border-width: 2px; }
  .sub { font-size: 12px; line-height: 1.55; }
  .sharewrap { width: 100%; }
  .sharewrap > .btn { width: 100%; justify-content: center; }
  .sharewrap .menu { left: 0; right: 0; min-width: 0; }

  .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cell { padding: 14px 9px 15px; }
  .cell + .cell { border-left: 3px dashed var(--ink); border-top: 0; }
  .cell span { font-size: 8.5px; letter-spacing: .05em; display: block; min-height: 22px; line-height: 1.25; }
  .cell b { margin-top: 6px; font-size: clamp(15px, 5.2vw, 22px); letter-spacing: -.03em; word-break: keep-all; white-space: nowrap; }
  .coverage-note { margin-top: 12px; padding: 9px 11px; font-size: 10px; line-height: 1.45; max-height: 56px; overflow: hidden; cursor: pointer; position: relative; }
  .coverage-note::after { content: '▾'; margin-left: auto; align-self: flex-start; font-size: 12px; }
  .coverage-note.open { max-height: none; }
  .coverage-note.open::after { content: '▴'; }

  .claim { padding: 14px 16px; }
  .claim summary { gap: 10px; }
  .claim summary p { font-size: 12px; line-height: 1.45; }
  .claimmenu { gap: 8px; }
  .claimmenu .btn { flex: 1 1 100%; justify-content: center; }

  .sec { gap: 16px; }
  .sechead { gap: 12px; }
  .sechead h2, .sec > h2, .sec h2 { font-size: 15px; gap: 10px; }

  /* podium: all three cards remain visible and predictable; champion comes first */
  .podium { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; overflow: visible; margin: 0; padding: 0; align-items: stretch; }
  .pod { width: 100%; min-width: 0; }
  .pod.p1 { order: -1; }
  .pod .panel-head { min-height: 46px; gap: 6px; }
  .pod .panel-head > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pod .panel-head > span:nth-child(2) { margin-left: auto; white-space: nowrap; }
  .pod .body, .pod.p1 .body { padding: 14px 14px 17px; gap: 7px; }
  .pod .medal { min-width: 36px; height: 36px; font-size: 18px; }
  .pod .pod-identity { margin-top: 0; }
  .pod .pod-logo { width: 36px; height: 36px; flex-basis: 36px; }
  .pod .nm { font-size: 18px; margin-top: 0; }
  .pod .big { font-size: 30px; }
  .pod .muted { line-height: 1.45; }
  .pod-socials a { min-height: 36px; padding: 7px 9px; }
  .pod-share { width: 38px; height: 38px; }
  .pod-share-wrap > .pod-share-menu { min-width: min(210px, calc(100vw - 56px)); }

  /* controls: search on top, window full width, chips side by side */
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  .searchbox { grid-column: 1 / -1; width: 100%; order: -1; }
  .controls .seg { grid-column: 1 / -1; width: 100%; }
  .controls .seg button { flex: 1; }
  .controls .chip { justify-content: center; text-align: center; min-height: 40px; }

  /* leaderboard table becomes a stack of compact cards */
  .tablewrap { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  table, tbody { display: block; min-width: 0; width: 100%; }
  thead { display: block; margin-bottom: 12px; }
  thead tr { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  thead th { display: none; }
  thead th.sort { display: inline-block; padding: 8px 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-size: 10px; box-shadow: 2px 2px 0 var(--ink); }
  thead th.sort.active { background: var(--ink); color: #fff; }
  thead th.sort.hide-sm { display: inline-block; }
  thead th.sort::after { content: none; }
  thead th.sort.active::after { content: ' ▼'; color: var(--yellow); }
  tbody { display: grid; gap: 12px; }
  tbody tr { display: grid; grid-template-columns: 38px repeat(4, minmax(0, 1fr)) 42px; grid-template-areas: "rk app app app app act" ". users tx views reviews ."; column-gap: 7px; row-gap: 12px; align-items: center; padding: 12px; overflow: visible; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); background: var(--cream); }
  tbody tr:nth-child(even) { background: #fff; }
  tbody td { padding: 0; border: 0; display: block; }
  tbody td:nth-child(1) { grid-area: rk; align-self: start; width: auto; font-size: 13px; padding-top: 3px; }
  tbody td:nth-child(2) { grid-area: app; min-width: 0; }
  tbody td:nth-child(3), tbody td:nth-child(4), tbody td:nth-child(5), tbody td:nth-child(6) { min-width: 0; padding-top: 8px; border-top: 1.5px dashed rgba(11,13,26,.28); text-align: left; font: 700 12px var(--mono); color: var(--ink); }
  tbody td:nth-child(3) { grid-area: users; }
  tbody td:nth-child(3)::before { content: 'Users'; display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
  tbody td:nth-child(4) { grid-area: tx; display: block; }
  tbody td:nth-child(4)::before { content: 'Tx'; display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
  tbody td:nth-child(5) { grid-area: views; display: block; white-space: nowrap; }
  tbody td:nth-child(5)::before { content: 'Views'; display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
  tbody td:nth-child(5) .eye-icon { display: none; }
  tbody td:nth-child(5) .view-value { margin-left: 0; }
  tbody td:nth-child(6) { grid-area: reviews; display: block; white-space: nowrap; }
  tbody td:nth-child(6)::before { content: 'Reviews'; display: block; margin-bottom: 4px; color: var(--muted); font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
  tbody td:nth-child(7) { grid-area: act; align-self: center; width: auto; text-align: right; }
  tbody td.act .actionset, tbody td.act .sharebtn, tbody tr td .sharebtn { opacity: 1; }
  tbody td.act .actionset { display: grid; gap: 7px; }
  tbody td.act .sharebtn, tbody td.act .reportbtn { width: 38px; height: 38px; }
  tbody td.act .sharepop-menu { right: 0; min-width: min(205px, calc(100vw - 56px)); }
  /* keep the icon, title, tags and social links aligned inside every card */
  tbody td.appcell { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; padding-left: 0; align-items: start; }
  tbody td.appcell .app-logo, tbody td.appcell .app-logo-slot { position: static; grid-column: 1; grid-row: 1; width: 30px; height: 30px; margin-top: 1px; transform: none; }
  tbody td.appcell .appinfo { grid-column: 2; min-width: 0; }
  .app-title > a { font-size: 15px; }
  .appcell .appmeta { margin-top: 5px; gap: 5px; font-size: 9px; align-items: stretch; }
  .appcell .meta-link { min-height: 25px; max-width: 100%; padding: 4px 6px; font-size: 9px !important; letter-spacing: .01em; }
  .appcell .meta-link .meta-value { max-width: 150px; }
  .appcell .meta-by { align-self: center; font-size: 9px; letter-spacing: .01em; }
  .appcell .tick { margin-left: 0; }
  .appcell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  tbody tr .mv { display: block; margin: 2px 0 0; }
  .pagination { gap: 10px; }
  .pagination button { padding: 12px 14px; min-height: 44px; }
  #pageInfo { font-size: 11px; text-align: center; }
  .metadata-disclaimer, #verifiedDisclaimer { font-size: 10px; line-height: 1.5; }
  footer { flex-direction: column; align-items: flex-start; }
  footer .support { flex-wrap: wrap; gap: 8px; }
  footer .wallet { max-width: 100%; word-break: break-all; white-space: normal; }
  footer.site-footer { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 42px; padding-top: 22px; }
  .site-footer-links { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 18px 12px; }
  .site-footer-col a { font-size: 10px; line-height: 1.35; }
  .site-footer-bottom { display: grid; gap: 5px; }

  /* ---------- app profile: layout lives in app.html (its own responsive block) ---------- */
  svg.chart { height: 150px; }
  .rankhist { height: 110px; }

  /* ---------- movers ---------- */
  .tools { width: 100%; display: grid; grid-template-columns: 1fr; gap: 10px; }
  .tools .seg { width: 100%; } .tools .seg button { flex: 1; }
  .tools .sharewrap .btn { width: 100%; justify-content: center; }
  .mv { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .mv .t b { font-size: 15px; }
  .chg { font-size: 15px; padding: 3px 8px; }
  .cols { gap: 28px; }
  img.preview { box-shadow: 3px 3px 0 var(--ink); }

  /* ---------- embed gallery ---------- */
  main, .sec, .grid, .item, .item .body { min-width: 0; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .controls .codein { width: 100%; }
  .item .body { padding: 12px; gap: 12px; }
  .stage { padding: 8px; min-height: 0; overflow: auto; }
  pre { max-height: 84px; overflow: auto; font-size: 11px; padding: 10px; }
  .row .note { display: none; }
  .api a { grid-template-columns: 1fr; gap: 4px; padding: 12px; word-break: break-all; }

  /* ---------- verify ---------- */
  .verifybar { gap: 8px; }
  .intro { padding: 20px 16px; gap: 14px; }
  .intro h1 { font-size: clamp(34px, 11vw, 44px); }
  .intro p { font-size: 13px; }
  .steps { padding: 12px 14px; }
  .steps p { font-size: 12px; margin: 8px 0 0; }
  .layout { gap: 18px; }
  form { gap: 14px; }
  input, textarea, select { font-size: 16px; } /* prevents iOS zoom on focus */
  .submitrow { flex-direction: column; align-items: stretch; }
  .submitrow button { width: 100%; }

  /* ---------- about ---------- */
  .doc .inner { padding: 4px 16px 20px; }
  pre { white-space: pre-wrap; }
}

@media (max-width: 360px) {
  .cell b { font-size: 14px; }
  tbody tr { grid-template-columns: 32px repeat(3, minmax(0, 1fr)) 40px; padding: 10px; column-gap: 5px; }
}

@media (max-width: 720px) {
}

@media (max-width: 720px) {
  /* widget previews keep their real width and pan sideways instead of squeezing into a broken layout */
  .stage { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .stage iframe { max-width: none; display: block; margin: 0 auto; }
  .stage img { display: block; margin: 0 auto; }
}

@media (max-width: 720px) {
  .empty { padding: 20px 14px; }
}
