/* Meme Cam Hub - quiet, line-drawn, lots of air. Dark sidebar, warm paper
   main area; dark mode just swaps the paper. */

:root {
  /* bright + minimal by default (Inspora-style); dark only when you pick it */
  --paper: #ffffff;
  --paper-2: #f5f5f4;
  --ink: #111111;
  --ink-2: #4a4a4a;
  --muted: #6b6b6b;
  --line: #ebebeb;
  --hover: rgba(17, 17, 17, 0.04);

  --side: #ffffff;
  --side-ink: #111111;
  --side-muted: #6f6f6f;
  --side-line: #efefef;
  --side-active: #f2f2f2;
  --side-hover: #f7f7f7;

  --hud-bg: rgba(17, 17, 17, 0.78);
  --hud-ink: #f2f2f2;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --side-w: 236px;
  --top-h: 48px;
  --radius: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #121212;
  --paper-2: #1b1b1b;
  --ink: #ededed;
  --ink-2: #b5b5b5;
  --muted: #7c7c7c;
  --line: #262626;
  --hover: rgba(237, 237, 237, 0.05);
  --side: #0c0c0c;
  --side-ink: #ededed;
  --side-muted: #777777;
  --side-line: #1f1f1f;
  --side-active: #1f1f1f;
  --side-hover: #171717;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- sidebar ---------- */

.sidebar {
  width: var(--side-w);
  flex: none;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: var(--side);
  color: var(--side-ink);
  border-right: 1px solid var(--side-line);
  transition: margin-left 0.22s var(--ease);
  z-index: 20;
}

:root[data-sidebar="closed"] .sidebar {
  margin-left: calc(-1 * var(--side-w));
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--top-h);
  padding: 0 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--side-line);
  flex: none;
}

.brand-mark {
  width: 20px;
  height: 20px;
  flex: none;
}

.brand-mark .bm-bg {
  fill: var(--side-ink);
  stroke: none;
}

.brand-mark .bm-fg {
  fill: var(--side);
  stroke: none;
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-by {
  font-size: 11px;
  color: var(--side-muted);
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 16px;
}

.nav-group + .nav-group {
  margin-top: 14px;
}

.nav-label {
  padding: 6px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--side-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--side-ink);
  font-size: 13px;
}

.nav-item:hover {
  background: var(--side-hover);
}

.nav-item[aria-current="page"] {
  background: var(--side-active);
}

.nav-item .count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--side-muted);
}

.nav-item.soon {
  color: var(--side-muted);
}

.about {
  flex: none;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--side-line);
  font-size: 12px;
  color: var(--side-muted);
}

.about-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--side-ink);
  font-weight: 500;
  margin-bottom: 4px;
}

.about-title svg {
  width: 13px;
  height: 13px;
}

.about p {
  margin: 0 0 6px;
}

.about-meta {
  font: 11px var(--mono);
}

.scrim {
  display: none;
}

/* ---------- main column ---------- */

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--top-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--side);
  color: var(--side-ink);
  border-bottom: 1px solid var(--side-line);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--side-muted);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--side-hover);
  color: var(--side-ink);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

:root:not([data-theme="dark"]) #themeBtn .moon,
:root[data-theme="dark"] #themeBtn .sun {
  display: none;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0 4px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--side-muted);
  min-width: 0;
}

.crumbs li {
  white-space: nowrap;
}

.crumbs li + li::before {
  content: "›";
  margin-right: 8px;
  color: var(--side-muted);
}

.crumbs a {
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--side-ink);
}

.crumbs li:last-child {
  color: var(--side-ink);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 2px;
}

.view {
  flex: 1;
  padding: 28px clamp(16px, 4vw, 48px) 64px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- shared bits ---------- */

.eyebrow {
  font-size: 13px;
  color: var(--muted);
}

.title {
  margin: 4px 0 6px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.lede {
  margin: 0;
  color: var(--ink-2);
  max-width: 60ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.12s var(--ease);
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 15px;
  height: 15px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--ink-2);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

/* ---------- home ---------- */

.home-head {
  margin-bottom: 28px;
}

.section-label {
  margin: 28px 0 10px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper);
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.card:hover {
  border-color: var(--ink-2);
  transform: translateY(-1px);
}

.card-img {
  aspect-ratio: 4 / 3;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
}

.card-name {
  font-weight: 500;
}

.card-meta {
  font: 11px var(--mono);
  color: var(--muted);
}

.card.soon .card-img img {
  filter: grayscale(0.6);
  opacity: 0.75;
}

/* ---------- cam page ---------- */

.cam-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.cam-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.pane {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
}

.pane-caption {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 3;
  font: 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pane-caption .idx {
  color: var(--muted);
  margin-right: 4px;
}

.cam-pane canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cam-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: var(--paper-2);
}

.cam-overlay .lens {
  width: 44px;
  height: 44px;
  color: var(--muted);
}

.cam-overlay p {
  margin: 0;
  max-width: 34ch;
  color: var(--ink-2);
  font-size: 13px;
}

.cam-overlay .status {
  font: 11px var(--mono);
  color: var(--muted);
  min-height: 1.5em;
}

.cam-overlay.error p {
  color: var(--ink);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 3;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--hud-bg);
  color: var(--hud-ink);
  font: 10.5px/1.5 var(--mono);
  white-space: pre-wrap;
  pointer-events: none;
}

.meme-pane {
  display: grid;
  place-items: center;
}

.meme-pane img,
.meme-pane video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.meme-pane.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--hover) 50%, transparent 70%) var(--paper-2);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.meme-pane .swap {
  animation: pop 0.18s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0.4;
    transform: scale(0.985);
  }
}

/* gestures guide */

.guide {
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.guide > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px;
  cursor: pointer;
}

.guide > summary::-webkit-details-marker {
  display: none;
}

.guide > summary .chev {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.2s var(--ease);
}

.guide[open] > summary .chev {
  transform: rotate(180deg);
}

.guide-title {
  font-weight: 600;
}

.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.guide-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.guide-item.active {
  border-color: var(--ink);
  background: var(--hover);
}

.guide-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: var(--paper-2);
  object-fit: cover;
  display: block;
}

.guide-thumbs {
  width: 56px;
  height: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.guide-thumbs img {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: var(--paper-2);
  object-fit: cover;
  display: block;
}

.guide-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 500;
}

.guide-name .n {
  font: 11px var(--mono);
  color: var(--muted);
  font-weight: 400;
}

.guide-how {
  font-size: 12.5px;
  color: var(--ink-2);
}

.guide-note {
  margin: 14px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

/* gallery (coming soon) */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  display: block;
}

/* toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    margin-left: calc(-1 * var(--side-w));
  }

  :root[data-sidebar-mobile="open"] .sidebar {
    margin-left: 0;
  }

  :root[data-sidebar-mobile="open"] .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 15;
  }

  .stage {
    grid-template-columns: 1fr;
  }

  .view {
    padding-top: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- cam page: full-bleed stage + pull-out panel ---------- */

/* the meme and camera split the whole window, edge to edge, no gaps */
:root[data-view="cam"] .view {
  position: relative;
  display: flex;
  max-width: none;
  margin: 0;
  padding: 0;
  height: calc(100vh - var(--top-h));
  height: calc(100dvh - var(--top-h));
  overflow: hidden;
}

:root[data-view="cam"] .stage {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 0;
}

:root[data-view="cam"] .pane {
  aspect-ratio: auto;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

/* whole meme always visible (letterboxed, never cropped) */
:root[data-view="cam"] .meme-pane {
  background: var(--paper-2);
}

:root[data-view="cam"] .cam-pane {
  background: #0e0e0d;
}

:root[data-view="cam"] .cam-pane .cam-overlay {
  background: var(--paper-2);
}

/* on cam pages the sidebar floats over the stage instead of taking width */
:root[data-view="cam"] .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  margin-left: calc(-1 * var(--side-w));
}

:root[data-view="cam"][data-sidebar-mobile="open"] .sidebar {
  margin-left: 0;
}

:root[data-view="cam"][data-sidebar-mobile="open"] .scrim {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 15;
}

.panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  width: min(380px, 92vw);
  overflow-y: auto;
  padding: 18px 18px 28px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.14);
  transform: translateX(105%);
  transition: transform 0.26s var(--ease);
}

:root[data-panel="open"] .panel {
  transform: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head .title {
  margin-bottom: 0;
}

.panel .panel-close {
  color: var(--muted);
}

.panel .panel-close:hover {
  background: var(--hover);
  color: var(--ink);
}

.panel-controls {
  margin: 14px 0 4px;
}

.panel-label {
  margin: 20px 0 8px;
}

.panel .guide-list {
  grid-template-columns: 1fr;
}

.panel-tab {
  position: absolute;
  right: 0;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 7px;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s var(--ease);
}

.panel-tab:hover {
  opacity: 1;
}

.panel-tab svg {
  width: 14px;
  height: 14px;
}

.panel-tab span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
}

:root[data-panel="open"] .panel-tab {
  opacity: 0;
  pointer-events: none;
}

/* hand colour swatches */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 50%, var(--joint) 0 26%, var(--line) 27% 100%);
  cursor: pointer;
}

.swatch[aria-checked="true"] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.swatch.custom {
  overflow: hidden;
  background: conic-gradient(#ff5f6d, #ffc371, #c6ff6b, #4fe3ff, #a46bff, #ff6ec7, #ff5f6d);
}

.swatch.custom input {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 860px) {
  :root[data-view="cam"] .stage {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

/* ---------- home: centred header + even photo cards ---------- */

:root[data-view="home"] .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  margin-left: calc(-1 * var(--side-w));
}

:root[data-view="home"][data-sidebar-mobile="open"] .sidebar {
  margin-left: 0;
}

:root[data-view="home"][data-sidebar-mobile="open"] .scrim {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 15;
}

:root[data-view="home"] .view {
  max-width: 1120px;
  padding-top: 56px;
}

.home-hero {
  text-align: center;
  margin-bottom: 40px;
}

.home-title {
  margin: 0;
  font-family: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(48px, 6vw, 72px);
  letter-spacing: -0.02em;
  line-height: 1;
}

.home-sub {
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 15px;
}

/* three even cards per row, rows centred (a short last row sits in the middle) */
.tiles {
  --cols: 3;
  --gap: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px var(--gap);
}

.tile {
  width: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  display: block;
  text-decoration: none;
  color: inherit;
}

.tile-img {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.tile-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s var(--ease);
}

.tile:hover .tile-img {
  border-color: #cfcfcf;
}


.tile-cap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 2px 0;
}

.tile-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: none;
}

.tile-name {
  font-size: 15px;
  font-weight: 500;
}

.tile-meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.tile-tag {
  margin-left: auto;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 2px;
  background: var(--paper-2);
  color: var(--muted);
}

.tile.soon .tile-img img {
  filter: saturate(0.55);
  opacity: 0.85;
}

@media (max-width: 900px) {
  .tiles {
    --cols: 2;
    --gap: 18px;
  }
}

@media (max-width: 560px) {
  .tiles {
    --cols: 1;
  }
}

/* ---------- credits: centred in the top bar ---------- */

.credits-float {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--side-muted);
  white-space: nowrap;
}

.credits-float a {
  color: var(--side-ink);
  text-decoration: none;
}

.credits-float a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* small screens: just "Made by @catherinee.md" so it fits between the icons */
@media (max-width: 640px) {
  .credits-float > :not(:first-child) {
    display: none;
  }
  .crumbs {
    display: none;
  }
  /* phones: bottom-right corner, over everything, with a plain backing */
  .credits-float {
    position: fixed;
    left: auto;
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--paper);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    font-size: 12px;
    z-index: 30;
  }
}

.request-note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.request-note a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.panel .request-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.panel-controls {
  display: flex;
  gap: 8px;
}

/* coming-soon cams aren't clickable yet */
.tile.soon,
.nav-item.soon {
  cursor: default;
}

.tile.soon:hover .tile-img {
  border-color: var(--line);
}

.nav-item.soon:hover {
  background: transparent;
}

/* ---------- phones & touch ---------- */

/* the raw camera <video> stays in the page (iOS needs it) but out of sight */
.cam-source {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

html {
  -webkit-text-size-adjust: 100%;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

/* white swatch was invisible on the white panel (phones) */
@media (max-width: 860px) {
  .swatch {
    border-color: #cfcfcf;
  }
}

/* touch screens: finger-sized targets */
@media (pointer: coarse) {
  .icon-btn {
    width: 40px;
    height: 40px;
  }
  .swatch {
    width: 36px;
    height: 36px;
  }
  .swatches {
    gap: 10px;
  }
  .chip {
    height: 40px;
    padding: 0 16px;
  }
  .panel-tab {
    padding: 16px 9px;
  }
  .nav-item {
    padding: 10px 8px;
  }
}

/* phones: two cards per row so the home page isn't one long scroll */
@media (max-width: 560px) {
  .tiles {
    --cols: 2;
    --gap: 12px;
    gap: 18px var(--gap);
  }
  :root[data-view="home"] .view {
    padding: 32px 14px 48px;
  }
  .home-hero {
    margin-bottom: 26px;
  }
  .home-sub {
    font-size: 14px;
    max-width: 30ch;
  }
  .tile-name {
    font-size: 14px;
  }
  .tile-avatar {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 330px) {
  .tiles {
    --cols: 1;
  }
}

/* phone turned sideways: camera and meme side by side, not two thin strips */
@media (max-width: 960px) and (orientation: landscape) {
  :root[data-view="cam"] .stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
  }
}

/* phones have their own Share button; dropping ours keeps the centred
   credits clear of the top-bar icons */
@media (max-width: 640px) {
  #shareBtn {
    display: none;
  }
}

/* phones, cam page: drop the top bar so camera + meme get the whole screen.
   Only the menu button stays, floating over the camera's top-left corner. */
@media (max-width: 860px) {
  :root[data-view="cam"] .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: auto;
    height: auto;
    padding: max(10px, env(safe-area-inset-top)) 0 0 max(10px, env(safe-area-inset-left));
    background: transparent;
    border: 0;
    z-index: 12;
  }
  :root[data-view="cam"] .topbar .crumbs,
  :root[data-view="cam"] .topbar .topbar-actions {
    display: none;
  }
  :root[data-view="cam"] .topbar .credits-float {
    position: fixed;
    left: auto;
    top: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--paper);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    font-size: 12px;
  }
  :root[data-view="cam"] #sidebarToggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  }
  :root[data-view="cam"] .view {
    height: 100vh;
    height: 100dvh;
  }
}

/* phones: rows/columns must not grow to fit a tall meme - the whole meme
   should shrink into its half of the screen instead of being cut off */
@media (max-width: 860px) {
  :root[data-view="cam"] .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  }
  /* the floating menu button would sit on the open panel's heading */
  :root[data-view="cam"][data-panel="open"] .topbar {
    display: none;
  }
}

@media (max-width: 960px) and (orientation: landscape) {
  :root[data-view="cam"] .stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
}

/* phones: pin the meme to its box so a tall picture can't overflow it -
   object-fit then shows the whole meme */
@media (max-width: 960px) {
  :root[data-view="cam"] .meme-pane img,
  :root[data-view="cam"] .meme-pane video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}
