/* ==========================================================
   Components: header, buttons, pills, tags, inputs, cards,
   upvote, skeletons, toasts, states, footer
   ========================================================== */

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  border-radius: var(--r-btn);
}
.logo__mark { width: 34px; height: 34px; flex: none; }
.logo__word {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  display: grid;
  gap: 3px;
}
.logo__word span:last-child { color: var(--accent); }

@media (min-width: 480px) {
  .logo__word { display: flex; gap: .45em; font-size: 15px; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(11, 13, 12, .82);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--divider);
  padding-top: env(safe-area-inset-top);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  height: var(--header-h);
}
.site-nav { display: none; }
.site-header__actions { display: flex; align-items: center; gap: var(--s-2); }

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--s-3);
  font-size: var(--fs-15);
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-btn);
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="page"]::before {
  content: "";
  width: 6px; height: 6px;
  margin-right: var(--s-2);
  background: var(--accent);
  border-radius: 1px;
}

.menu-btn {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: var(--r-btn);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}
.menu-btn:active { background: var(--surface); }
.menu-btn svg { width: 20px; height: 20px; }

@media (min-width: 768px) {
  .site-nav { display: flex; align-items: center; gap: var(--s-1); margin-left: auto; }
  .menu-btn { display: none; }
}

/* Mobile menu panel */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  background: rgba(0, 0, 0, .6);
  opacity: 0;
  transition: opacity var(--t) var(--ease-out);
}
.menu-panel {
  position: fixed;
  z-index: calc(var(--z-menu) + 1);
  top: calc(env(safe-area-inset-top) + var(--s-2));
  left: max(var(--s-2), env(safe-area-inset-left));
  right: max(var(--s-2), env(safe-area-inset-right));
  padding: var(--s-4);
  padding-bottom: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--t) var(--ease-out), transform var(--t) var(--ease-out);
}
.menu-open .menu-backdrop { opacity: 1; }
.menu-open .menu-panel { opacity: 1; transform: none; }
.menu-panel__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-3); }
.menu-panel nav { display: grid; gap: var(--s-1); margin-bottom: var(--s-4); }
.menu-panel nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding-inline: var(--s-3);
  font-size: var(--fs-18);
  font-weight: 500;
  border-radius: var(--r-input);
}
.menu-panel nav a:active { background: var(--surface-2); }
.menu-panel nav a[aria-current="page"] { color: var(--accent); }
.menu-panel nav a svg { width: 18px; height: 18px; color: var(--text-3); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0 var(--s-5);
  font-family: var(--font-sans);
  font-size: var(--fs-15);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-btn);
  transition:
    background-color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t) var(--ease-out),
    transform var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px) scale(.98); }

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  --btn-bd: var(--accent);
}
.btn--ghost {
  --btn-bg: transparent;
  --btn-bd: var(--border-strong);
}
.btn--sm { padding: 0 var(--s-4); font-size: var(--fs-14); }
.btn--lg { min-height: 52px; padding: 0 var(--s-6); font-size: var(--fs-16); }
.btn--block { width: 100%; }

@media (hover: hover) {
  .btn--primary:hover { box-shadow: 0 0 0 1px var(--accent), 0 0 22px var(--accent-glow); }
  .btn--ghost:hover, .btn:not(.btn--primary):hover { --btn-bd: var(--text-3); }
  .menu-btn:hover { border-color: var(--text-3); }
}

.btn[disabled], .btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .55;
  box-shadow: none;
  transform: none;
}

/* Loading: keep width, swap label for a spinner */
.btn.is-loading { color: transparent; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  font-size: var(--fs-15);
  font-weight: 500;
  color: var(--text-2);
  transition: color var(--t-fast) var(--ease-out);
}
.link-arrow svg { width: 16px; height: 16px; transition: transform var(--t-fast) var(--ease-out); }
.link-arrow:hover { color: var(--accent); }
.link-arrow:hover svg { transform: translateX(3px); }

/* ---------- Eyebrow ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow__dot {
  width: 8px; height: 8px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin-bottom: var(--s-6);
}
.section-title {
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: var(--fs-h2);
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: uppercase;
}
.section-sub { margin-top: var(--s-2); color: var(--text-2); font-size: var(--fs-15); }

/* ---------- Pills (filters) ---------- */
.pills {
  display: flex;
  gap: var(--s-2);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  flex: none;
  min-height: 40px;
  padding: 0 var(--s-4);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.pill svg { width: 16px; height: 16px; }
.pill[aria-pressed="true"] {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}
.pill--toggle[aria-pressed="true"] {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}
.pill:active { transform: scale(.97); }
@media (hover: hover) {
  .pill:not([aria-pressed="true"]):hover { color: var(--text); border-color: var(--text-3); }
}

/* Touch target padding without visual bulk */
@media (pointer: coarse) {
  .pill { min-height: 44px; }
}

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; margin: 0; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}
.tag svg { width: 12px; height: 12px; }
.tag--mp { color: var(--accent); border-color: rgba(124, 255, 79, .3); background: var(--accent-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--s-2);
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 6px;
  box-shadow: 0 0 14px var(--accent-glow);
}

/* ---------- Form controls ---------- */
.field { display: grid; gap: var(--s-2); }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field > .field__label { padding: 0; margin-bottom: var(--s-2); width: 100%; }
.field__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-3);
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--text);
}
.field__opt { font-weight: 400; color: var(--text-3); font-size: var(--fs-13); }
.field__hint { font-size: var(--fs-13); color: var(--text-3); line-height: 1.45; }
.field__error {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: var(--fs-13);
  color: var(--danger);
  line-height: 1.45;
}
.field__error svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.field__error:empty { display: none; }

.input, .select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s-4);
  font-size: 16px; /* keeps iOS from zooming */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-input);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder { color: var(--text-4); }
.input:hover, .select:hover { border-color: #3A423E; }
.input:focus-visible, .select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 3px var(--danger-soft); }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--s-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239AA39E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.select option { background: var(--surface); color: var(--text); }

/* Compact select used in toolbars */
.select--sm { min-height: 44px; width: auto; font-size: var(--fs-15); padding-left: var(--s-3); background-color: transparent; }
@media (max-width: 767px) { .select--sm { font-size: 16px; } }

/* Chips (multi-select checkboxes) */
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); border: 0; padding: 0; margin: 0; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 var(--s-3);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-btn);
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.chip span svg { width: 14px; height: 14px; display: none; }
.chip input:checked + span { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.chip input:checked + span svg { display: block; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .chip:hover span { color: var(--text); border-color: var(--text-3); } }
@media (pointer: coarse) { .chip span { min-height: 44px; } }

/* Checkbox */
.check {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  cursor: pointer;
  font-size: var(--fs-15);
  color: var(--text-2);
  line-height: 1.45;
}
.check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 22px; height: 22px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.check input::after {
  content: "";
  width: 11px; height: 6px;
  border-left: 2px solid var(--on-accent);
  border-bottom: 2px solid var(--on-accent);
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform var(--t-fast) var(--ease-out);
}
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input[aria-invalid="true"] { border-color: var(--danger); }
.check-wrap { padding-block: 11px; } /* 44px tap row */

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
}
@media (min-width: 480px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); } }
@media (min-width: 768px) { .card-grid { gap: var(--s-6) var(--s-5); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: border-color var(--t) var(--ease-out), transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgba(0, 0, 0, .32) 3px, transparent 4px);
  transition: opacity var(--t) var(--ease-out);
  pointer-events: none;
}
.card__badge { position: absolute; top: var(--s-3); left: var(--s-3); z-index: 1; }

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--s-3);
  padding: var(--s-4);
}
.card__head { display: grid; gap: 2px; }
.card__title {
  font-size: var(--fs-18);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card__link:focus-visible { outline: none; }
.card:has(.card__link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.card__handle {
  position: relative;
  z-index: 2;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text-3);
  transition: color var(--t-fast) var(--ease-out);
}
.card__handle:hover { color: var(--accent); }

.card__foot {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px solid var(--divider);
}
.card__plays {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  color: var(--text-3);
  white-space: nowrap;
}
.card__plays svg { width: 14px; height: 14px; }
.card__play { position: relative; z-index: 2; margin-left: auto; }

/* Single column phones: Play goes full width */
@media (max-width: 479px) {
  .card__foot { flex-wrap: wrap; }
  .card__play { flex: 1 0 100%; margin-left: 0; min-height: 48px; }
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
  }
  .card:hover .card__media::after { opacity: 1; }
}
@media (hover: none) {
  .card:active { border-color: var(--border-strong); transform: scale(.99); }
}

/* Cover fallback when there is no image */
.cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--s-4);
  text-align: center;
  background:
    radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1.4px) 0 0 / 14px 14px,
    linear-gradient(135deg, hsl(var(--hue, 110) 60% 22%), hsl(calc(var(--hue, 110) + 40) 55% 12%));
}
.cover-fallback span {
  font-family: var(--font-pixel);
  font-size: clamp(1.125rem, 7cqi, 2.25rem);
  line-height: 1.15;
  color: hsl(var(--hue, 110) 90% 82%);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
  overflow-wrap: anywhere;
}
.card__media, .cover { container-type: inline-size; }

/* ---------- Upvote ---------- */
.vote {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  min-width: 44px;
  padding: 0 var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-btn);
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.vote::before { content: ""; position: absolute; inset: -4px; } /* 44px hit area */
.vote svg { width: 14px; height: 14px; transition: transform var(--t-fast) var(--ease-out); }
.vote[aria-pressed="true"] { color: var(--accent); border-color: rgba(124, 255, 79, .45); background: var(--accent-soft); }
.vote[aria-pressed="true"] svg path { fill: currentColor; }
.vote.is-pop svg { animation: pop 320ms var(--ease-out); }
.vote:disabled { cursor: progress; }
@media (hover: hover) { .vote:hover { color: var(--text); border-color: var(--text-3); } .vote[aria-pressed="true"]:hover { color: var(--accent); border-color: var(--accent); } }
@media (hover: none) { .vote:active { background: var(--surface-2); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.45) translateY(-2px); } 100% { transform: scale(1); } }

/* ---------- Skeletons ---------- */
.skeleton { pointer-events: none; }
.skel {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, #1A1E1C 40%, var(--surface-2) 80%) 0 0 / 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton .card__media { background: none; }
.skeleton .card__media .skel { position: absolute; inset: 0; border-radius: 0; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -50% 0; } }

/* ---------- States (empty / error) ---------- */
.state {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: var(--s-3);
  padding: var(--s-12) var(--s-6);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-panel);
  background: var(--surface-2);
}
.state__icon {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  margin-bottom: var(--s-2);
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  background: var(--bg);
}
.state__icon svg { width: 26px; height: 26px; }
.state--error .state__icon { color: var(--danger); }
.state__title { font-family: var(--font-pixel); font-weight: 400; font-size: clamp(1.125rem, 1rem + .6vw, 1.5rem); letter-spacing: 0; text-transform: uppercase; }
.state__text { max-width: 42ch; color: var(--text-2); font-size: var(--fs-15); }
.state .btn { margin-top: var(--s-3); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  z-index: var(--z-toast);
  left: 50%;
  bottom: calc(var(--s-5) + env(safe-area-inset-bottom) + var(--toast-offset, 0px));
  transform: translateX(-50%);
  display: grid;
  gap: var(--s-2);
  width: max-content;
  max-width: calc(100vw - var(--s-8));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--text);
  background: #1B1F1D;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-input);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  animation: toast-in var(--t-slow) var(--ease-out);
}
.toast svg { width: 16px; height: 16px; flex: none; color: var(--accent); }
.toast--error svg { color: var(--danger); }
.toast.is-leaving { animation: toast-out var(--t) var(--ease-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ---------- Submit band ---------- */
.band {
  position: relative;
  display: grid;
  gap: var(--s-5);
  padding: var(--s-10) var(--s-6);
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  overflow: hidden;
}
.band__title { font-family: var(--font-pixel); font-weight: 400; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.5rem); line-height: 1.1; letter-spacing: 0; text-transform: uppercase; }
.band__text { color: var(--text-2); max-width: 46ch; margin-top: var(--s-3); }
@media (min-width: 768px) {
  .band { grid-template-columns: 1fr auto; align-items: center; padding: var(--s-12) var(--s-12); }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 0;
  padding-block: var(--s-10) calc(var(--s-10) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--divider);
}
.site-footer__inner {
  display: grid;
  gap: var(--s-4);
}
.site-footer__brand { font-family: var(--font-pixel); font-weight: 700; font-size: 18px; }
.site-footer__brand span { color: var(--accent); }
.site-footer__text { color: var(--text-3); font-size: var(--fs-14); max-width: 52ch; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); }
.site-footer__links a {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  font-size: var(--fs-14);
  color: var(--text-2);
  transition: color var(--t-fast) var(--ease-out);
}
.site-footer__links a:hover { color: var(--accent); }
.site-footer__links svg { width: 16px; height: 16px; }
@media (min-width: 768px) {
  .site-footer__inner { grid-template-columns: 1fr auto; align-items: end; }
  .site-footer__links { justify-content: flex-end; }
}

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .cursor::after, .blink { animation: none; }
}

.state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-3); margin-top: var(--s-3); }
.state__actions .btn { margin-top: 0; }

/* ---------- Rail: horizontal scroll row on phones and tablets, grid on desktop ---------- */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 82%;
  gap: var(--s-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  padding: 4px var(--gutter) var(--s-4);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
@media (min-width: 480px) { .rail { grid-auto-columns: 46%; } }
@media (min-width: 768px) { .rail { grid-auto-columns: 38%; gap: var(--s-5); } }
@media (min-width: 1024px) {
  .rail {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    margin-inline: 0;
    padding: 0;
  }
  .rail > :nth-child(n + 4) { display: none; }
}
@media (min-width: 1280px) {
  .rail { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rail > :nth-child(4) { display: flex; }
}
/* Rail cards keep the compact footer at every width */
.rail .card__foot { flex-wrap: nowrap; }
.rail .card__play { flex: none; margin-left: auto; min-height: 44px; }

/* ---------- Typing title (typeOut in ui.js) ---------- */
/* Hidden until the script takes over, so the word doesn't flash in full first.
   Failsafe: if the script never runs, show the heading after 2.5s anyway. */
html.js [data-typeout]:not(.tw-ready) { visibility: hidden; animation: tw-failsafe 0s 2.5s forwards; }
@keyframes tw-failsafe { to { visibility: visible; } }

.tw-start, .tw-char { position: relative; }
.tw-char { visibility: hidden; }
.tw-char.is-on { visibility: visible; }
.tw .is-caret::after {
  content: "_";
  position: absolute;
  top: 0;
  left: calc(100% + .08em);
  color: var(--accent);
  visibility: visible;
}
.tw .tw-start.is-caret::after { left: 0; }
/* Solid while typing, blinks forever once done (kept under reduced motion on purpose) */
.tw-done .tw .is-caret::after { animation: blink 1.06s steps(1) infinite !important; }

/* ---------- Action toast ("New version loaded. Tap to refresh") ---------- */
.toast--action {
  pointer-events: auto;
  cursor: pointer;
  min-height: 48px;
  border-color: rgba(124, 255, 79, .45);
  font: inherit;
  font-size: var(--fs-14);
  font-weight: 600;
  text-align: left;
  color: var(--text);
}
.toast--action:hover { border-color: var(--accent); }

/* ---------- Install button (shown only when the browser offers install) ---------- */
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--accent);
  transition: color var(--t-fast) var(--ease-out);
}
.install-btn svg { width: 16px; height: 16px; }
.install-btn:hover { color: var(--text); }
.install-btn--menu {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  margin-bottom: var(--s-2);
  border: 1px solid rgba(124, 255, 79, .35);
  border-radius: var(--r-btn);
  font-size: var(--fs-15);
}

/* ---------- iOS install hint (one time, dismissible, not a modal) ---------- */
.ios-hint {
  position: fixed;
  z-index: var(--z-toast);
  left: max(var(--s-3), env(safe-area-inset-left));
  right: max(var(--s-3), env(safe-area-inset-right));
  bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 480px;
  margin-inline: auto;
  padding: var(--s-3) var(--s-2) var(--s-3) var(--s-3);
  background: #1B1F1D;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
}
.ios-hint.is-visible { opacity: 1; transform: none; }
.ios-hint img { flex: none; border-radius: 10px; }
.ios-hint p { flex: 1; font-size: var(--fs-14); line-height: 1.45; color: var(--text-2); }
.ios-hint strong { display: block; color: var(--text); font-weight: 600; }
.ios-hint b { color: var(--text); font-weight: 600; }
.ios-hint__icon { display: inline-flex; vertical-align: -3px; color: #4DA3FF; }
.ios-hint__icon svg { width: 17px; height: 17px; }
.ios-hint__close { flex: none; display: grid; place-items: center; width: 44px; height: 44px; color: var(--text-3); border-radius: var(--r-btn); }
.ios-hint__close svg { width: 18px; height: 18px; }
.ios-hint__close:hover { color: var(--text); }
