/* The phone app shell (2026-10-24; templates/_phone_shell.html). Desktop is untouched: everything here is under 641 px. */
.ph-tools, .ph-tabs, .ph-sheet { display: none; }

@media (max-width: 640px) {
  :root { --tabs-h: calc(58px + env(safe-area-inset-bottom)); }
  /* the slim top bar: logo, search, you */
  header.site .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; }
  header.site .logo { flex: 1; min-width: 0; }
  header.site .logo img { height: 30px; width: auto; max-width: 100%; }
  header.site nav.site-nav, header.site .account { display: none !important; }
  header.site form.search { display: none; order: 9; flex-basis: 100%; margin: 6px 0 2px; }
  header.site.ph-searching form.search { display: flex; }
  .ph-tools { display: flex; align-items: center; gap: 8px; }
  .ph-tool { display: grid; place-items: center; position: relative; width: 44px; height: 44px; border: 0; border-radius: 999px;
    background: rgba(255, 255, 255, .08); color: var(--head-text, #f6eee6); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
  a.ph-avatar, a.ph-avatar:visited { background: var(--accent); color: var(--on-accent); font-size: 1.1em; }
  a.ph-signin { width: auto; padding: 0 16px; background: var(--accent); color: var(--on-accent) !important; }
  .ph-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #e0455a; box-shadow: 0 0 0 2px var(--head); }

  /* the tab bar */
  .ph-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: var(--tabs-h); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--border); }
  .ph-tabs a, .ph-tabs a:visited { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 700; letter-spacing: .01em; -webkit-tap-highlight-color: transparent; }
  .ph-tabs svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; stroke-linecap: round; }
  .ph-tabs svg .ph-fill { fill: currentColor; stroke: none; }
  .ph-tabs a.on { color: var(--accent-text, var(--accent)); }
  .ph-tabs a.on svg { fill: color-mix(in srgb, currentColor 22%, transparent); }
  .ph-tabs a:active { transform: scale(.94); }
  .ph-tabs .ph-dot { top: 6px; right: calc(50% - 18px); box-shadow: 0 0 0 2px var(--surface); }
  body { padding-bottom: var(--tabs-h); }
  /* games are their own screens with their own bottom bar */
  body.game-fit .ph-tabs { display: none; }
  body.game-fit { padding-bottom: 0; }
  /* the footer: just the data credits on phones; the tabs and sheets carry the links */
  footer.site .foot-cols { display: none; }
  footer.site { font-size: 12px; }
  /* the Halloween pumpkin sits above the tabs */
  .spk-toggle { bottom: calc(var(--tabs-h) + 8px) !important; }
  body.game-fit .spk-toggle { bottom: calc(8px + env(safe-area-inset-bottom)) !important; }

  /* sheets: slide up, big rows */
  .ph-sheet { display: block; position: fixed; inset: 0; z-index: 88; }
  .ph-sheet[hidden] { display: none; }
  .ph-sheet-back { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); animation: ph-fade .2s ease; }
  .ph-sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; overscroll-behavior: contain;
    padding: 6px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: var(--bg); color: var(--text);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .4); animation: ph-up .28s cubic-bezier(.2, .9, .25, 1); }
  .ph-sheet.closing .ph-sheet-panel { animation: ph-down .2s ease forwards; }
  .ph-sheet.closing .ph-sheet-back { animation: ph-fade .2s ease reverse forwards; }
  .ph-grab { width: 40px; height: 5px; margin: 4px auto 6px; border-radius: 3px; background: var(--border); }
  .ph-sheet-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 6px; }
  .ph-sheet-head > div { flex: 1; min-width: 0; }
  .ph-sheet-head h2 { margin: 0; font-size: 1.6em; letter-spacing: -.02em; }
  .ph-sheet-head h2::before, .ph-sheet-head h2::after { display: none; }
  .ph-sheet-head a { font-size: .92em; }
  .ph-x { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; }
  .ph-me-av { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 1.3em; }
  .ph-group { margin: 16px 4px 6px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  a.ph-row, a.ph-row:visited { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px; margin: 0 0 2px; border-radius: 14px;
    background: var(--surface); color: var(--text); text-decoration: none; }
  a.ph-row:active { background: var(--surface-2); }
  .ph-row-i { width: 30px; font-size: 20px; text-align: center; }
  .ph-row > span:nth-child(2), .ph-row > span:first-child:not(.ph-row-i) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .ph-row b { font-weight: 650; font-size: 16px; }
  .ph-row small { color: var(--muted); font-size: 13px; }
  .ph-chev { color: var(--muted); font-size: 22px; }
  form.ph-look { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; max-width: none; }
  form.ph-look button { min-height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700; }
  form.ph-look button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
  .ph-note { margin: 8px 4px 0; font-size: 13px; color: var(--muted); }
  .ph-signout { margin: 18px 0 4px; }
  .ph-signout button { width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: #e0455a; font: inherit; font-weight: 700; }
  html.ph-locked, html.ph-locked body { overflow: hidden; }
}
@keyframes ph-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ph-down { to { transform: translateY(100%); } }
@keyframes ph-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ph-sheet-panel, .ph-sheet-back { animation: none !important; } }
