/* Theme explorer is intentionally scoped so home/play remain unchanged. */
.theme-explorer-screen {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 24px;
  box-sizing: border-box;
}
.theme-explorer-screen .intro { padding: 0 0 8px; }
.theme-explorer-screen:has(.theme-explorer-selected-bar) { padding-bottom: 116px; }
.theme-explorer-screen .intro h1 { font-size: clamp(30px, 3vw, 36px); margin: 0; }
.theme-explorer-toolbar { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.theme-explorer-toolbar-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.theme-explorer-toolbar-row .theme-explorer-toolbar { flex: 1 1 auto; min-width: 0; margin: 0; }
.theme-explorer-toolbar-row .compact-mode-switch { flex: 0 0 auto; margin: 0; white-space: nowrap; }
.theme-explorer-search { flex: 1; min-width: 0; }
.theme-explorer-search input {
  width: 100%; box-sizing: border-box; border: 1px solid rgba(20,33,61,.18);
  border-radius: 14px; background: #fff; padding: 12px 14px; font: inherit; color: var(--ink);
}
.theme-explorer-tag-filter { min-height: 44px; border: 1px solid rgba(20,33,61,.14); border-radius: 10px; background: #fff; color: var(--ink); padding: 0 9px; font: inherit; }
.theme-explorer-view { display: flex; gap: 4px; }
.theme-explorer-view .icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0;
  border: 1px solid rgba(20,33,61,.14); border-radius: 12px; background: #fff; color: var(--ink);
}
.theme-explorer-view .icon-button.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.theme-explorer-shelf { margin: 18px 0 24px; }
.theme-explorer-shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.theme-explorer-shelf-head h2 { margin: 0; font-size: 20px; }
.theme-explorer-shelf-controls { display: flex; gap: 4px; }
.theme-explorer-shelf-controls .icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(20,33,61,.15); border-radius: 10px; background: #fff; color: var(--ink);
}
.theme-explorer-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 255px);
  grid-template-rows: 1fr; gap: 12px; overflow-x: auto;
  overscroll-behavior-inline: contain; scroll-snap-type: x proximity; scroll-padding-inline: 5px; padding: 3px 5px 10px;
}
.theme-explorer-track.is-list {
  display: grid; grid-auto-flow: row; grid-template-columns: 1fr; grid-auto-columns: auto; overflow: visible;
}
.theme-explorer-track.is-list .theme-explorer-card { display: grid; grid-template-columns: 160px minmax(0, 1fr); min-height: 112px; }
.theme-explorer-track.is-list .theme-explorer-image { width: 160px; height: 100%; aspect-ratio: auto; }
.theme-explorer-track.is-list .theme-explorer-card-body { align-content: center; }
.theme-explorer-card-wrap { position: relative; display: grid; min-width: 0; height: 100%; scroll-snap-align: start; }
.theme-explorer-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  border: 1px solid rgba(20,33,61,.10); border-radius: 16px; background: #fff;
  box-shadow: 0 7px 18px rgba(20,33,61,.08); overflow: hidden; cursor: pointer;
  scroll-snap-align: start; transition: transform .16s ease, box-shadow .16s ease;
  font: inherit; text-align: left; color: var(--ink); padding: 0;
  width: 100%; height: 100%; box-sizing: border-box;
}
.theme-explorer-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20,33,61,.12); }
.theme-explorer-card.is-selected { box-shadow: 0 0 0 3px var(--blue), 0 10px 24px rgba(23,105,232,.16); }
.theme-explorer-card.is-locked { opacity: .58; }
.theme-explorer-card:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; border-color: transparent; }
.theme-explorer-image { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #f6eadb; }
.theme-explorer-card-body { display: grid; gap: 4px; padding: 10px 12px 12px; min-width: 0; }
.theme-explorer-image-wrap { position: relative; display: block; min-width: 0; }
.theme-game-image-wrap { overflow: hidden; background: #f6eadb; }
.theme-game-image { width: 100%; aspect-ratio: 1.93 / 1; object-fit: cover; object-position: center; }
.theme-game-card[data-game-id="question-wolf"] .theme-game-image { object-position: center top; }
.theme-game-icon { display: grid; place-items: center; min-height: 132px; color: var(--blue); background: linear-gradient(135deg, rgba(23,105,232,.12), rgba(245,194,66,.24)); }
.theme-game-icon svg { width: 52px; height: 52px; }
.theme-explorer-label { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); padding: 3px 6px; color: #fff; background: rgba(20,33,61,.88); font-size: 11px; font-weight: 800; line-height: 1.2; letter-spacing: .01em; }
.theme-explorer-label:empty { display: none; }
.theme-explorer-card-body strong { font-size: 15px; line-height: 1.3; }
.theme-explorer-card-body small { color: rgba(20,33,61,.68); font-size: 12px; line-height: 1.35; min-height: 2.7em; }
.theme-explorer-meta { font-size: 11px; color: var(--blue); font-weight: 700; }
.theme-explorer-bookmark, .theme-explorer-card-settings, .theme-explorer-experienced { position: absolute; z-index: 2; border: 0; cursor: pointer; font: inherit; }
.theme-explorer-bookmark { top: 6px; right: 6px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 9px; background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 2px 8px rgba(20,33,61,.14); }
.theme-explorer-card-settings { top: 6px; left: 6px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 9px; background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 2px 8px rgba(20,33,61,.14); }
.theme-explorer-bookmark.is-active { background: var(--blue); color: #fff; }
.theme-explorer-bookmark:focus-visible, .theme-explorer-card-settings:focus-visible, .theme-explorer-experienced:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.theme-explorer-experienced { right: 4px; bottom: 4px; min-width: 44px; min-height: 44px; padding: 3px 5px; border: 0; border-radius: 0; background: transparent; color: var(--muted, #697386); font-size: 12px; font-weight: 700; }
.theme-explorer-experienced.is-active { color: var(--blue); }
.theme-explorer-track.is-list .theme-explorer-bookmark { left: 110px; right: auto; }
.theme-explorer-card-body { padding-bottom: 58px; }
.theme-explorer-mysets { margin: 18px 0; }
.theme-explorer-mysets h2 { font-size: 20px; margin: 0 0 9px; }
.theme-explorer-myset {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 10px 12px; border: 1px solid rgba(20,33,61,.12);
  background: #fff; border-radius: 12px;
}
.theme-explorer-myset + .theme-explorer-myset { margin-top: 7px; }
.theme-explorer-myset strong { min-width: 0; }
.theme-explorer-myset small { color: var(--muted); }
.theme-explorer-myset.is-selected { box-shadow: 0 0 0 2px var(--blue); }
.theme-explorer-myset-cover { display: block; width: 96px; height: 64px; object-fit: cover; border-radius: 9px; }
.theme-explorer-myset > span { display: grid; gap: 4px; min-width: 0; }
.theme-explorer-selected-bar {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-sizing: border-box; width: min(760px, calc(100vw - 24px)); margin: 0; padding: 10px 12px;
  border: 1px solid rgba(20,33,61,.14); border-radius: 16px; background: rgba(255,250,243,.94);
  box-shadow: 0 9px 24px rgba(20,33,61,.12); backdrop-filter: blur(8px);
}
.theme-explorer-selected-bar > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-explorer-selected-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.theme-explorer-selected-actions .icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
}
.theme-explorer-selected-actions .primary-button { min-height: 44px; }
.theme-explorer-selected-bar .action-icon { width: 18px; height: 18px; vertical-align: middle; }
.theme-explorer-filters { margin: 0 0 12px; }
.theme-explorer-screen .theme-options { max-width: 760px; margin: 16px auto 0; padding: 0; background: none; }
.theme-options-details { display: none; gap: 8px; }
.theme-options.is-expanded .theme-options-details { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 11; display: grid; width: min(760px, calc(100vw - 24px)); max-height: min(60vh, 420px); overflow: auto; box-sizing: border-box; padding: 14px; border: 1px solid rgba(20,33,61,.14); border-radius: 16px; background: rgba(255,250,243,.98); box-shadow: 0 12px 30px rgba(20,33,61,.18); }
.theme-explorer-selection-error { color: var(--coral); font-size: 13px; font-weight: 700; }
.theme-options-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.theme-options-head .icon-button { width: 40px; height: 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.theme-explorer-screen .solo-start-button { display: none; }
.theme-explorer-screen .solo-history-open { margin: 10px auto; }
.theme-explorer-screen .mode-switch { margin-bottom: 12px; }
.theme-explorer-screen .compact-mode-switch { display:inline-flex; align-items:center; gap:7px; min-height:44px; margin:4px 0 10px; padding:8px 0; border:0; border-bottom:1px solid var(--line,#d8d2c5); border-radius:0; background:transparent; color:var(--navy,#16243d); font-weight:700; }
.theme-explorer-screen .compact-mode-switch:has(input:focus-visible) { outline:2px solid color-mix(in srgb,var(--cobalt,#2759c7) 45%,transparent); outline-offset:3px; }
.theme-explorer-screen .compact-mode-switch input { width:18px; height:18px; accent-color:var(--cobalt,#2759c7); }
.theme-explorer-screen .compact-mode-switch small { color:var(--muted,#697386); font-size:12px; font-weight:600; }
.theme-explorer-selected-bar .theme-explorer-selection-error { flex:1 1 100%; color:var(--coral,#c54d54); font-size:13px; line-height:1.35; }
.theme-explorer-selected-bar:has(.theme-explorer-selection-error) { flex-wrap: wrap; row-gap: 6px; }
.theme-explorer-selected-bar:has(.theme-explorer-selection-error) .theme-explorer-selection-error { flex: 1 0 100%; order: -2; min-width: 100%; white-space: normal; overflow: visible; }
.theme-explorer-selected-bar:has(.theme-explorer-selection-error) > span:not(.theme-explorer-selection-error) { flex: 1 1 auto; }
.theme-explorer-selected-actions .participant-edit-link { min-height:44px; white-space:nowrap; }
@media (max-width:680px) { .theme-explorer-selected-bar { flex-wrap:wrap; gap:8px; } .theme-explorer-selected-actions { width:100%; display:flex; flex-wrap:wrap; gap:8px; } .theme-explorer-selected-actions .selected-start { flex:1 1 150px; } .theme-explorer-selected-actions .participant-edit-link { flex:1 1 130px; } .theme-explorer-screen:has(.theme-explorer-selected-bar .theme-explorer-selection-error) { padding-bottom:150px; } .theme-explorer-selected-bar:has(.theme-explorer-selection-error) .theme-explorer-selected-actions { width:auto; flex:0 0 auto; gap:4px; } .theme-explorer-selected-bar:has(.theme-explorer-selection-error) .selected-start { flex:0 0 108px; padding-inline:8px; } .theme-explorer-selected-bar:has(.theme-explorer-selection-error) .participant-edit-link { flex:0 0 auto; padding-inline:9px; } }
.theme-explorer-screen .guest-theme-note { margin: 0 0 10px; }
.theme-explorer-card .action-icon, .theme-explorer-shelf-controls .action-icon, .theme-explorer-view .action-icon { width: 19px; height: 19px; }
@media (max-width: 680px) {
  .theme-explorer-screen { padding-inline: 0; padding-bottom: 24px; }
  .theme-explorer-screen:has(.theme-explorer-selected-bar) { padding-bottom: 108px; }
  .theme-explorer-toolbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 8px 0 12px; }
  .theme-explorer-toolbar-row .theme-explorer-toolbar { display: contents; }
  .theme-explorer-toolbar-row .theme-explorer-search { grid-column: 1; }
  .theme-explorer-toolbar-row .theme-explorer-view { grid-column: 2; }
  .theme-explorer-toolbar-row .theme-explorer-tag-filter { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .theme-explorer-toolbar-row .compact-mode-switch { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
  .theme-explorer-filters { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .theme-explorer-filters .filter-chip { flex: 0 0 auto; }
  .theme-explorer-track { grid-auto-columns: minmax(205px, 72vw); gap: 10px; }
  .theme-explorer-track.is-list { grid-template-columns: 1fr; }
  .theme-explorer-track.is-list .theme-explorer-card { grid-template-columns: 116px minmax(0, 1fr); }
  .theme-explorer-track.is-list .theme-explorer-image { width: 116px; }
  .theme-explorer-track.is-list .theme-explorer-bookmark { left: 66px; }
  .theme-explorer-card-body strong { font-size: 14px; }
  .theme-explorer-myset { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .theme-explorer-myset-cover { width: 72px; height: 48px; }
  .theme-explorer-selected-bar { width: calc(100vw - 24px); border-radius: 14px; padding: 9px; }
  .theme-explorer-selected-bar .primary-button { min-height: 44px; padding-inline: 14px; }
  .theme-explorer-shelf { margin-block: 14px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-explorer-card { transition: none; }
  .theme-explorer-track { scroll-behavior: auto; }
}
.content:has(.theme-explorer-screen) { max-width: 1120px; width: min(1120px, calc(100vw - 32px)); box-sizing: border-box; }
#app:has(.theme-explorer-screen) .theme-frame-topbar { width: min(1120px, calc(100vw - 32px)); max-width: 1120px; padding-inline: 40px; }
@media (max-width: 680px) {
  .content:has(.theme-explorer-screen) { width: 100%; padding-inline: 20px; }
  #app:has(.theme-explorer-screen) .theme-frame-topbar { width: 100%; padding-inline: 20px; }
}
