/* home.css - home page (index.html) only; loads after base.css. Split from arcade.css in Phase 0. Owner: C. */
.cabinet {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.marquee {
  text-align: center;
  margin-bottom: 1.75rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--neon-purple);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(192, 132, 252, 0.12), rgba(0, 240, 255, 0.05));
  box-shadow: var(--glow-purple), inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.marquee h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.marquee .tagline {
  margin: 0.5rem 0 0;
  color: var(--neon-purple);
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  text-transform: uppercase;
  max-width: 36rem;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.search {
  flex: 1 1 220px;
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  outline: none;
}

.search:focus {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.dropzone {
  border: 2px dashed var(--neon-purple);
  border-radius: 14px;
  padding: 1.75rem 1.25rem;
  text-align: center;
  background: rgba(26, 15, 46, 0.65);
  margin-bottom: 1.5rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.dropzone h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  color: var(--neon-pink);
  text-shadow: 0 0 10px rgba(255, 43, 214, 0.45);
}

.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dropzone input[type="file"] {
  display: none;
}

.status {
  min-height: 1.25rem;
  margin: -0.5rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.error { color: var(--danger); }
.status.ok { color: var(--success); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

@media (min-width: 1100px) {
  .grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
  transform: translateY(-2px);
}

.card-cover-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-cover-link:hover {
  text-shadow: none;
}

.card-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(192, 132, 252, 0.25), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(0, 240, 255, 0.18), transparent 50%),
    linear-gradient(160deg, #1a0f2e 0%, #0a0612 100%);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  z-index: 2;
  background: #0a0612;
}

.card-cover.no-art .card-cover-img {
  display: none;
}

/* Letterbox bars show the cover gradient once the art has loaded (#0a0612 while loading). */
.card-cover.has-art .card-cover-img {
  background: transparent;
}

.card-cover-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  text-align: center;
  pointer-events: none;
}

.card-cover.has-art .card-cover-placeholder {
  opacity: 0;
}

.card-cover-initials {
  font-size: clamp(1.25rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
  border: 2px solid rgba(0, 240, 255, 0.45);
  border-radius: 12px;
  padding: 0.35rem 0.55rem;
  min-width: 2.75rem;
}

.card-cover-placeholder-title {
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.8rem 0.85rem;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title-link {
  color: inherit;
  text-decoration: none;
}

.card-title-link:hover {
  color: var(--neon-cyan);
  text-shadow: var(--glow-cyan);
}

.card-edit-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--border);
}

.card-edit-panel[hidden] {
  display: none !important;
}

.btn-ghost.active {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--neon-purple);
}

.field input,
.field select,
.field textarea {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--neon-cyan);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.card .actions {
  flex-wrap: nowrap;
}

.card .actions .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  flex: 1 1 auto;
  text-align: center;
}

.card .actions .btn-play {
  flex: 1 1 auto;
  min-width: 0;
}

.card .actions .btn-more {
  flex: 0 0 44px;
  width: 44px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: 0;
}

.card-edit-panel .btn {
  min-height: 44px;
}

.card-edit-panel .btn-danger {
  margin-top: 0.75rem;
}

/* Search hides cards with the hidden attribute; .card's display:flex would otherwise win. */
.card[hidden],
.grid .empty[hidden] {
  display: none !important;
}

@media (hover: none) {
  .card:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 1rem 0;
}
.toolbar .search {
  flex: 1;
  min-width: 180px;
}

/* —— Mobile-first add / upload —— */
.section-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  color: var(--neon-pink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.add-section {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(26, 15, 46, 0.55);
}

.add-help {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.add-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}


.upload-progress {
  margin-top: 1rem;
}

.progress-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  transition: width 0.2s ease;
  box-shadow: var(--glow-cyan);
}

.progress-text {
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--font-mono);
  word-break: break-word;
}

/* Advanced Mac scan folders */
.advanced-panel {
  margin-top: 2rem;
  padding: 0.85rem 1rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: rgba(18, 10, 31, 0.5);
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--neon-purple);
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.advanced-panel summary::-webkit-details-marker {
  display: none;
}

.advanced-panel[open] summary {
  margin-bottom: 0.75rem;
}

.scan-help {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.folder-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.folder-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.folder-path {
  flex: 1 1 160px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neon-cyan);
  word-break: break-all;
}

.folder-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.35rem 0;
}

.folder-add {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.folder-path-input {
  width: 100%;
  min-height: 48px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: var(--font-mono);
}

.folder-path-input:focus {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.suggestions-label {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .add-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
  }
  .folder-add {
    flex-direction: row;
    align-items: stretch;
  }
  .folder-path-input {
    flex: 1;
  }
}

/* Library folder (primary) */
.library-section {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(26, 15, 46, 0.55);
}

.current-folder {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  color: var(--muted);
  word-break: break-all;
}

.current-folder code {
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.library-section .folder-add {
  margin-bottom: 0.85rem;
}

.library-section .suggestions {
  margin-bottom: 1rem;
}

.library-section #btnRescan {
  margin-top: 0.25rem;
}

.library-section code {
  color: var(--neon-cyan);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* —— Profile bar / chips —— */
.profile-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(26, 15, 46, 0.55);
}

.profile-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neon-purple);
  font-weight: 600;
}

.profile-input {
  flex: 1 1 140px;
  min-width: 0;
  min-height: 44px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.45rem 0.7rem;
  font-size: 16px; /* 16px or more, or iOS zooms the page when the field gets focus */
  outline: none;
}

#btnProfileGo {
  min-height: 44px;
}

.profile-msg {
  flex: 1 0 100%;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.profile-msg:empty {
  display: none;
}

.profile-msg.error { color: var(--danger); }
.profile-msg.ok { color: var(--success); }

/* The highlighted chip already shows the active profile. */
.profile-bar.has-chips .profile-current {
  display: none;
}

.profile-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: var(--glow-cyan);
}

.profile-current {
  font-size: 0.85rem;
  color: var(--neon-cyan);
  font-weight: 600;
  text-shadow: var(--glow-cyan);
}


.marquee {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}

.marquee-logo {
  width: clamp(72px, 18vw, 128px);
  height: auto;
  display: block;
  margin: 0.25rem auto 0.15rem;
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.35));
  user-select: none;
  -webkit-user-drag: none;
}

/* —— r2 (owner C): Manage library panel, safe areas, phone layouts ——
   Keep this block last: it overrides the .marquee/.marquee-logo rules above, the .grid width
   queries and base.css's .profile-chips { width: 100% } at equal specificity. */

.manage-panel summary {
  gap: 0.6rem;
}

.manage-hint {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
}

.manage-panel summary::after {
  content: '';
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin: 0 0.35rem 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}

.manage-panel[open] summary::after {
  transform: rotate(45deg);
}

.manage-panel #btnRescan {
  margin-bottom: 0.9rem;
}

.manage-panel .dropzone {
  margin-bottom: 0;
}

.status.manage-status {
  margin: 0.75rem 0 0;
}

.status.manage-status:empty {
  display: none;
}

.upload-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--neon-yellow);
}

.app-settings-btn {
  flex: 0 0 auto;
  min-height: 44px;
}

.cabinet {
  padding:
    max(1.5rem, calc(env(safe-area-inset-top, 0px) + 0.5rem))
    max(1.25rem, env(safe-area-inset-right, 0px))
    max(3rem, calc(env(safe-area-inset-bottom, 0px) + 1rem))
    max(1.25rem, env(safe-area-inset-left, 0px));
}

/* Phones (either orientation): one-row marquee so the games start near the top. */
@media (max-width: 600px), (max-height: 500px) {
  .cabinet {
    padding-top: max(0.75rem, calc(env(safe-area-inset-top, 0px) + 0.5rem));
  }
  .marquee {
    flex-direction: row;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
  }
  .marquee-logo {
    width: auto;
    height: 44px;
    margin: 0;
  }
  .marquee .tagline {
    display: none;
  }
  .marquee h1 {
    font-size: 1.15rem;
    letter-spacing: 0.12em;
  }
  .profile-bar {
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.6rem;
  }
  .status {
    min-height: 1.1rem;
    margin: 0 0 0.35rem;
  }
  .toolbar {
    margin: 0 0 0.75rem;
  }
  .advanced-panel {
    margin-top: 1.25rem;
  }
}

/* Short landscape phones: smaller logo, profile bar on one row, more, smaller columns. */
@media (orientation: landscape) and (max-height: 500px) {
  .marquee {
    padding: 0.3rem 0.75rem;
    margin-bottom: 0.5rem;
  }
  .marquee-logo {
    height: 32px;
  }
  .profile-chips {
    width: auto;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }
  .card-body {
    padding: 0.6rem 0.6rem 0.7rem;
  }
  .card .actions .btn-play {
    padding: 0.5rem 0.35rem;
  }
  .card-cover-initials {
    font-size: 1.25rem;
  }
  .card-cover-placeholder {
    gap: 0.35rem;
    padding: 0.5rem;
  }
}

/* —— r3 (owner H): Fast mode link / badge beside the search box, System picker hint —— */
.fast-link,
.fast-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  padding: 0 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.fast-link {
  /* 44px to tap, but only 42px (the search box) in the row, so the grid doesn't move. */
  margin-top: -1px;
  margin-bottom: -1px;
  border: 1px solid rgba(255, 229, 102, 0.6);
  color: var(--neon-yellow);
  background: rgba(255, 229, 102, 0.06);
}

.fast-link:hover,
.fast-link:focus-visible {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 12px rgba(255, 229, 102, 0.45);
  text-shadow: none;
  outline: none;
}

.fast-badge {
  min-height: 32px;
  padding: 0 0.7rem;
  font-size: 0.72rem;
  border: 1px solid rgba(57, 255, 136, 0.55);
  color: var(--success);
  background: rgba(57, 255, 136, 0.08);
  cursor: default;
}

.fast-link[hidden],
.fast-badge[hidden] {
  display: none !important;
}

.fast-icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  fill: currentColor;
}

.field-hint {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--neon-yellow);
}

.field-hint:empty {
  display: none;
}

/* Phones: the search box keeps most of the row; the link stays small. */
@media (max-width: 600px) {
  .fast-link,
  .fast-badge {
    padding: 0 0.7rem;
    gap: 0.25rem;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
  }
  .fast-badge {
    padding: 0 0.55rem;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
  }
}

/* 320-360px phones: still one row (search + link/badge). */
@media (max-width: 360px) {
  .toolbar .search {
    min-width: 130px;
  }
  .fast-link {
    padding: 0 0.55rem;
  }
}

/* iOS app shell (library.js adds .has-app-btn with the App settings button): keep one toolbar row
   on phones. The Fast mode text stays readable to VoiceOver, only visually hidden. */
@media (max-width: 600px) {
  .toolbar.has-app-btn .search {
    min-width: 110px;
  }
  .toolbar.has-app-btn .fast-link {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .toolbar.has-app-btn .fast-badge {
    padding: 0 0.5rem;
  }
  .toolbar.has-app-btn .fast-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .toolbar.has-app-btn .fast-icon {
    width: 1.15rem;
    height: 1.15rem;
  }
  .toolbar.has-app-btn .app-settings-btn {
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
  }
}

@media (max-width: 360px) {
  .toolbar.has-app-btn {
    gap: 0.5rem;
  }
  .toolbar.has-app-btn .search {
    min-width: 96px;
  }
}

/* —— r4 (home controller navigation, js/padnav.js): system filter row, controller focus ring, hint bar ——
   The ring and the hint bar only exist while a controller is in use (html.padnav-on); mouse, touch and
   keyboard never see them. */
.system-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.35rem 0 1.1rem;
}

.system-filter[hidden] {
  display: none !important;
}

.filter-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  border-color: var(--border);
  color: var(--text);
}

.filter-chip:hover,
.filter-chip:focus {
  border-color: var(--neon-cyan);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(192, 132, 252, 0.18);
  color: var(--neon-purple);
}

.filter-chip.active {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  color: #0a0612;
  box-shadow: var(--glow-cyan);
}

.filter-chip.active .filter-count {
  background: rgba(10, 6, 18, 0.22);
  color: #0a0612;
}

/* Phones (portrait): one swipeable row, edge to edge; the padding leaves room for the focus ring. */
@media (max-width: 600px) {
  .system-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: -0.55rem -1.25rem 0.35rem;
    padding: 0.5rem 1.25rem 0.6rem;
  }
  .system-filter::-webkit-scrollbar {
    display: none;
  }
}

/* Controller focus: a thick yellow ring (dark gap inside it) that reads on covers, chips and buttons. */
.padnav-on .pad-focus {
  outline: none !important;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 7px var(--neon-yellow), 0 0 26px 8px rgba(255, 229, 102, 0.45) !important;
}

.padnav-on .chip.pad-focus {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--neon-yellow), 0 0 14px 3px rgba(255, 229, 102, 0.4) !important;
}

.padnav-on .card.pad-focus {
  border-color: var(--neon-yellow);
  transform: translateY(-3px);
}

.padnav-on .card.pad-focus .btn-play {
  box-shadow: 0 0 0 2px #fff, var(--glow-cyan);
}

.padnav-on .pad-focus:focus,
.padnav-on .pad-focus:focus-visible,
.padnav-on .pad-focus :focus,
.padnav-on .pad-focus :focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .padnav-on .card.pad-focus {
    transform: none;
  }
}

/* Hint bar: which button does what, named as printed on the pad (the dot shows the position). */
.pad-hint {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 6px));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.1rem;
  max-width: calc(100vw - 16px);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 229, 102, 0.45);
  background: rgba(10, 6, 18, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 18px rgba(255, 229, 102, 0.16);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.pad-hint[hidden],
.pad-hint-item[hidden] {
  display: none !important;
}

.pad-hint-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pad-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.4rem;
  border: 1.5px solid var(--neon-yellow);
  border-radius: 999px;
  color: var(--neon-yellow);
  font-size: 0.85rem;
  line-height: 1;
}

.pad-key b {
  font-weight: 800;
}

.pad-key-wide {
  border-radius: 7px;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.pad-dia {
  width: 0.9rem;
  height: 0.9rem;
  flex: none;
}

.pad-dia circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  opacity: 0.5;
}

.pad-dia circle.on {
  fill: currentColor;
  opacity: 1;
}

@media (max-width: 600px) {
  .pad-hint {
    gap: 0.55rem;
    padding: 0.38rem 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0;
  }
  .pad-hint-item {
    gap: 0.25rem;
  }
  .pad-key {
    gap: 0.2rem;
    min-width: 1.45rem;
    height: 1.45rem;
    padding: 0 0.28rem;
    font-size: 0.76rem;
  }
  .pad-key-wide {
    font-size: 0.64rem;
  }
  .pad-dia {
    width: 0.72rem;
    height: 0.72rem;
  }
}

/* Narrow phones (iPhone SE class, up to 380px): keys without the position dots, tighter spacing. */
@media (max-width: 380px) {
  .pad-hint {
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.7rem;
  }
  .pad-hint-item {
    gap: 0.22rem;
  }
  .pad-dia {
    display: none;
  }
  .pad-key {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.25rem;
  }
}

/* —— "Who's playing?" welcome screen (js/welcome.js), added 2026-10-11 —— */
html.welcome-open, body.welcome-open { overflow: hidden; }
.welcome {
  position: fixed; inset: 0; z-index: 10000; overflow-y: auto;
  /* centred with margin:auto on .welcome-inner, so a list taller than the screen (phone landscape) starts at the top
     and scrolls instead of being cut off above it */
  display: flex;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 30%, #1d0f3a 0%, #0a0612 70%);
  color: var(--text);
}
.welcome-inner { width: 100%; max-width: 1100px; text-align: center; margin: auto; }
.welcome-logo { height: 84px; width: auto; margin-bottom: 0.5rem; }
.welcome-title { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 1.75rem; color: var(--neon-cyan); text-shadow: var(--glow-cyan); }
.welcome-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.welcome-tile {
  width: clamp(150px, 20vw, 210px); padding: 1.1rem 0.75rem 1rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  background: var(--bg-card); color: inherit; font: inherit;
  border: 2px solid var(--border); border-radius: 1.1rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.welcome-tile:hover, .welcome-tile.pad-focus, .welcome-tile:focus-visible {
  outline: none; transform: scale(1.06); border-color: var(--neon-cyan); box-shadow: var(--glow-cyan);
}
.welcome-avatar {
  width: clamp(84px, 11vw, 120px); aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(2.4rem, 5vw, 3.6rem); font-weight: 800; color: #fff;
  background: hsl(var(--h, 270) 70% 42%); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.25);
}
.welcome-avatar-add { background: transparent; border: 3px dashed var(--border); color: var(--neon-purple); box-shadow: none; }
.welcome-name { font-size: clamp(1.2rem, 2.4vw, 1.7rem); font-weight: 700; word-break: break-word; }
.welcome-last { font-size: 0.85rem; color: var(--muted); }
.welcome-add { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; }
.welcome-add[hidden] { display: none; }
.welcome-input {
  min-width: min(100%, 22rem); padding: 0.9rem 1rem; font-size: 1.3rem; border-radius: 0.75rem;
  border: 2px solid var(--border); background: var(--bg-panel); color: var(--text);
}
.welcome-add .btn { font-size: 1.2rem; padding: 0.8rem 1.4rem; }
.welcome-msg { min-height: 1.5rem; margin: 1rem 0 0; color: var(--success); }
.welcome-msg.error { color: var(--danger); }
.welcome-hint { margin: 0.5rem 0 0; color: var(--muted); font-size: 1rem; }
.btn-switch-profile { margin-left: 0.5rem; }
@media (prefers-reduced-motion: reduce) { .welcome-tile { transition: none; } }

/* —— Slim current-player bar (replaces the old Profile box; profiles are picked on the welcome screen) —— */
.profile-bar {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  padding: 0.35rem 0.5rem 0.35rem 0.6rem;
  border-radius: 999px;
}
.profile-bar .profile-current {
  display: block;                 /* the old rule hid it beside the chips */
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.05rem;
  color: var(--text);
  text-shadow: none;
}
.profile-bar.no-player .profile-current { color: var(--muted); font-weight: 500; }
.player-avatar {
  flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.05rem; color: #fff;
  background: hsl(var(--h, 270) 70% 42%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.player-avatar[hidden], .profile-chips[hidden] { display: none; }
.profile-bar .btn-switch-profile { flex: none; margin: 0; min-height: 36px; padding: 0.3rem 0.9rem; font-size: 0.8rem; }
