:root {
  --bg: #0f1117;
  --panel: #151922;
  --panel-2: #1a202b;
  --panel-3: #202635;
  --text: #f3f6fb;
  --muted: #95a0b5;
  --line: rgba(255, 255, 255, 0.07);
  --accent: #4f8ef7;
  --accent-soft: rgba(79, 142, 247, 0.14);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  --xbox-green: #107c10;
  --ps-blue: #003087;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 142, 247, 0.08), transparent 28%),
    linear-gradient(180deg, #10141d 0%, #0f1117 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.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;
}

.app-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 108px;
  min-width: 0;
}

.screen[hidden] {
  display: none !important;
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 10px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.last-updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  justify-self: end;
}

.service-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.service-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #d3d8e4;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.98rem;
  font-weight: 700;
}

.service-tab:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.service-tab.is-active[data-service="xbox-game-pass"] {
  color: #fff;
  background: rgba(16, 124, 16, 0.22);
  border-color: rgba(84, 214, 84, 0.32);
}

.service-tab.is-active[data-service="playstation-plus"] {
  color: #fff;
  background: rgba(0, 48, 135, 0.3);
  border-color: rgba(86, 139, 255, 0.32);
}

.service-tab-icon {
  width: 18px;
  height: 18px;
}

.library-summary-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid rgba(79, 142, 247, 0.15);
  border-radius: 10px;
  background: rgba(79, 142, 247, 0.08);
  text-align: left;
}

.library-summary-leading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.library-summary-icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

.library-summary-icon svg {
  width: 100%;
  height: 100%;
}

.library-summary-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.81rem;
  font-weight: 600;
}

.library-summary-stats {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
}

.library-summary-link {
  color: var(--accent);
  font-size: 0.81rem;
  font-weight: 600;
  white-space: nowrap;
}

.filters-panel,
.results-panel,
.library-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(21, 25, 34, 0.92);
  box-shadow: var(--shadow);
}

.filters-panel {
  display: grid;
  gap: 18px;
  padding: 18px 20px 20px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.search-row {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  justify-self: stretch;
  align-self: stretch;
  overflow: hidden;
  border-radius: 16px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.control-input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px 0 46px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.02rem;
  -webkit-appearance: none;
  appearance: none;
}

.control-input::placeholder {
  color: var(--muted);
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group-service {
  width: 100%;
}

.filter-group-sort {
  margin-left: auto;
}

.filter-label {
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 700;
  min-width: 74px;
}

.platform-pills,
.sort-pills,
.time-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.platform-pill,
.sort-pill,
.time-pill,
.save-filters-button,
.status-select select,
.icon-button,
.ghost-button,
.detail-close,
.primary-nav-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel-2);
}

.platform-pill,
.sort-pill,
.time-pill {
  font-size: 0.95rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.03);
}

.platform-pill.is-active,
.sort-pill.is-active,
.time-pill.is-active,
.primary-nav-button.is-active {
  border-color: rgba(79, 142, 247, 0.45);
  background: var(--accent-soft);
}

.filters-status {
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 600;
}

.results-panel {
  margin-top: 14px;
  overflow: hidden;
}

.header-nav .primary-nav-button,
.service-tab {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.header-nav .primary-nav-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #b9c0ce;
}

.header-nav .primary-nav-button.is-active {
  border-color: var(--accent);
  background: transparent;
  color: #fff;
}

.results-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
}

.results-bar-primary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.results-bar strong {
  font-size: 1.2rem;
}

.results-context,
.results-status {
  color: var(--muted);
  font-size: 0.75rem;
}

.results-context {
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: right;
}

.hidden-link {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
}

.table-header {
  display: none;
}

.results-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.browse-card {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(4, minmax(92px, 0.42fr)) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.browse-card-main,
.library-card-main,
.detail-hero {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.browse-card-main {
  align-items: center;
  min-width: 0;
  cursor: pointer;
  padding: 0;
}

.browse-card-copy,
.library-card-copy,
.detail-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1;
  align-content: center;
}

.browse-card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.game-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

.game-art {
  width: 36px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-3);
  flex-shrink: 0;
}

.game-art-shell {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
}

.game-art-row {
  width: 72px;
  height: 72px;
  border-radius: 10px;
}

.detail-art {
  width: 92px;
  height: 92px;
  border-radius: 10px;
}

.game-art-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel-3);
  position: relative;
}

.game-art-placeholder::before {
  content: "";
  display: none;
}

.library-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.browse-card-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.game-state-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge,
.state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-xbox {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.badge-ps {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

.badge-pc {
  color: #c8d8ff;
  background: rgba(150, 180, 255, 0.14);
}

.state-chip-neutral {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.state-chip-status {
  color: #dff0ff;
  background: rgba(79, 142, 247, 0.18);
}

.state-chip-favorite {
  color: #ffe08c;
  background: rgba(250, 204, 21, 0.16);
}

.state-chip-hidden {
  color: #ffd4d4;
  background: rgba(239, 68, 68, 0.14);
}

.metric-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.metric-main,
.status-icon-bookmark {
  color: var(--accent);
}

.metric-extra {
  color: #facc15;
}

.metric-comp {
  color: #f97316;
}

.metric-review {
  color: #c8d8ff;
}

.metric-muted,
.status-icon-empty {
  color: var(--muted);
}

.status-icon-playing,
.status-icon-complete {
  color: #4caf7d;
}

.status-icon-favorite {
  color: #f5a623;
}

.browse-card-metric {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 0;
  text-align: center;
}

.browse-card-metric-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.browse-card-metric-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 1.1rem;
  font-weight: 700;
}

.browse-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  justify-self: end;
}

.icon-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel-2);
}

.icon-toggle-button svg {
  width: 18px;
  height: 18px;
}

.icon-toggle-button.is-active {
  color: #f5a623;
}

.library-card,
.detail-metrics {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.library-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.detail-metrics,
.detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.metric-chip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel-3);
}

.metric-label {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 0.96rem;
}

.game-card-actions,
.library-card-actions,
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-select {
  position: relative;
  display: inline-flex;
  min-width: 150px;
}

.status-select select {
  width: 100%;
  padding-right: 36px;
  -webkit-appearance: none;
  appearance: none;
}

.status-select::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.status-select-small {
  min-width: 140px;
}

.status-select.is-onboarding select {
  border-color: rgba(79, 142, 247, 0.5);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}

.status-select-hint {
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--panel-2);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.action-button svg {
  width: 16px;
  height: 16px;
}

.action-button-icon {
  color: #f6cc64;
}

.action-button-favorite.is-active {
  border-color: rgba(250, 204, 21, 0.32);
  background: rgba(250, 204, 21, 0.12);
}

.action-button-primary {
  border-color: rgba(79, 142, 247, 0.38);
  background: var(--accent-soft);
}

.browse-card .action-button {
  min-height: 36px;
}

.browse-card-copy {
  gap: 8px;
}

.browse-card-platforms,
.game-state-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.browse-card-platforms {
  min-height: 22px;
}

.browse-card .state-chip,
.browse-card .badge {
  flex-shrink: 0;
}

.library-panel {
  margin-top: 14px;
  padding: 28px 28px 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 24px;
  background:
    radial-gradient(circle at top center, rgba(79, 142, 247, 0.14), transparent 38%),
    linear-gradient(180deg, rgba(18, 24, 35, 0.98), rgba(14, 19, 28, 0.98));
}

.library-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
  padding: 10px 0 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.library-kicker {
  display: none;
}

.library-title,
.detail-copy h2 {
  margin: 0;
  font-size: 2rem;
}

.library-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.library-copy {
  display: none;
}

.library-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.library-stat {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "icon value"
    "label label";
  column-gap: 8px;
  row-gap: 2px;
  min-width: 108px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.library-stat-icon {
  grid-area: icon;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  align-self: center;
}

.library-stat-icon svg {
  width: 18px;
  height: 18px;
}

.library-stat strong {
  grid-area: value;
  font-size: 1.6rem;
  line-height: 1;
}

.library-stat > span:not(.library-stat-icon) {
  grid-area: label;
  color: var(--muted);
  font-size: 0.92rem;
}

.library-stat-list {
  border-color: rgba(93, 153, 255, 0.32);
  background: rgba(79, 142, 247, 0.08);
  color: #b9d3ff;
}

.library-stat-favorites {
  border-color: rgba(245, 166, 35, 0.22);
  background: rgba(245, 166, 35, 0.07);
  color: #ffbe84;
}

.library-stat-completed {
  border-color: rgba(76, 175, 125, 0.22);
  background: rgba(76, 175, 125, 0.08);
  color: #9be1b4;
}

.library-stat-hidden {
  color: #c7ccd7;
}

.library-section + .library-section {
  margin-top: 0;
}

.library-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.library-section-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.library-section-header span {
  color: var(--muted);
}

.library-sections-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 20px;
}

.library-section-featured {
  grid-column: span 1;
}

.library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.library-empty-state {
  display: grid;
  gap: 12px;
  padding: 28px 22px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
}

.library-empty-state h3,
.library-empty-state p {
  margin: 0;
}

.library-empty-state p {
  color: var(--muted);
}

.library-empty-state .ghost-button {
  justify-self: center;
}

.local-data-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

.library-card {
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.library-card-main {
  align-items: center;
  gap: 14px;
}

.library-card .game-art {
  width: 118px;
  height: 118px;
  border-radius: 12px;
}

.library-card-copy {
  gap: 8px;
  align-content: start;
}

.library-card-copy .game-name {
  font-size: 1.05rem;
}

.library-card .game-state-chips {
  gap: 8px;
}

.library-card .state-chip {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.88rem;
}

.library-card-meta {
  font-size: 0.98rem;
}

.library-card-actions {
  gap: 10px;
}

.library-card-actions .action-button,
.library-card-actions .status-select-small {
  min-height: 38px;
}

.library-card-actions .action-button-favorite {
  border-color: rgba(133, 116, 255, 0.24);
  background: rgba(133, 116, 255, 0.1);
}

.library-card-actions .action-button-favorite.is-active {
  border-color: rgba(133, 116, 255, 0.45);
  background: linear-gradient(180deg, rgba(108, 133, 255, 0.28), rgba(126, 103, 255, 0.22));
}

.primary-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 12px;
  justify-content: center;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(21, 25, 34, 0.96);
  backdrop-filter: blur(16px);
}

.primary-nav-button {
  min-width: 132px;
  font-weight: 700;
  border-radius: 14px;
}

.detail-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.72);
}

.detail-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100% - 24px));
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, #161b25 0%, #11151d 100%);
  box-shadow: var(--shadow);
}

.detail-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.detail-meta-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-3);
}

.detail-meta-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.action-sheet {
  position: fixed;
  inset: 0;
  z-index: 35;
}

.action-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.56);
}

.action-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #161b25 0%, #11151d 100%);
  box-shadow: var(--shadow);
}

.action-sheet-header {
  padding: 0 2px 12px;
}

.action-sheet-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.sheet-section {
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.sheet-action-row,
.sheet-cancel-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text);
  background: transparent;
  font-size: 1rem;
  text-align: left;
}

.sheet-section .sheet-action-row:last-child {
  border-bottom: 0;
}

.sheet-check {
  color: var(--text);
}

.sheet-action-row-destructive {
  color: #e05252;
}

.sheet-cancel-button {
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 88px);
  transform: translateX(-50%);
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border: 1px solid rgba(79, 142, 247, 0.26);
  border-radius: 999px;
  background: rgba(21, 25, 34, 0.96);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.96rem;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.empty-state {
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 1.2rem;
}

.empty-state-inline {
  padding: 24px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 860px) {
  .library-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: 100%;
    padding: 8px 8px 110px;
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding-bottom: 12px;
  }

  .header-nav {
    display: none;
  }

  .brand {
    justify-self: start;
    min-width: 0;
  }

  .brand-name {
    font-size: 1.32rem;
  }

  .last-updated {
    font-size: 0.82rem;
    text-align: right;
    justify-self: end;
    align-self: start;
    max-width: none;
    white-space: nowrap;
  }

  .service-tabs {
    width: 100%;
  }

  .service-tab {
    flex: 1;
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.96rem;
  }

  .filters-panel,
  .results-panel,
  .library-panel,
  .detail-panel {
    border-radius: 14px;
  }

  .library-summary-panel {
    padding: 14px;
    border-radius: 14px;
  }

  .filters-panel,
  .library-panel {
    padding: 14px;
  }

  .filters-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .library-summary-panel,
  .filter-row,
  .filter-group,
  .library-header {
    display: grid;
    gap: 10px;
  }

  .library-header {
    grid-template-columns: 1fr;
    margin-bottom: 20px;
    padding-bottom: 18px;
  }

  .library-stats {
    justify-content: stretch;
  }

  .library-stat {
    min-width: 0;
    flex: 1 1 calc(50% - 6px);
  }

  .library-sections-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .library-card .game-art {
    width: 96px;
    height: 96px;
  }

  .filter-group-sort {
    margin-left: 0;
  }

  .filter-group,
  .filter-group-service,
  .filter-group-platform,
  .filter-group-sort,
  .filter-group-time {
    min-width: 0;
    width: 100%;
  }

  .platform-pills,
  .sort-pills,
  .time-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .platform-pills::-webkit-scrollbar,
  .sort-pills::-webkit-scrollbar,
  .time-pills::-webkit-scrollbar {
    display: none;
  }

  .results-bar {
    padding: 12px;
    align-items: baseline;
  }

  .results-bar-primary {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .results-list {
    padding: 0 8px 12px;
  }

  .browse-card {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
  }

  .browse-card-main,
  .library-card-main,
  .detail-hero {
    gap: 10px;
  }

  .game-art-shell,
  .game-art-row {
    width: 64px;
    height: 64px;
  }

  .browse-card-main {
    grid-column: 1 / -1;
    align-items: flex-start;
  }

  .browse-card-heading {
    display: grid;
    gap: 6px;
  }

  .browse-card-metric {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-items: start;
    justify-content: start;
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    text-align: left;
  }

  .browse-card-actions {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: stretch;
    flex-wrap: nowrap;
  }

  .browse-card-actions .action-button {
    width: auto;
    flex: 1 1 auto;
  }

  .browse-card-actions .icon-toggle-button {
    flex: 0 0 36px;
  }

  .detail-metrics,
  .detail-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-card-actions,
  .detail-actions,
  .primary-nav {
    width: 100%;
  }

  .status-select,
  .status-select-small,
  .ghost-button,
  .action-button {
    width: 100%;
  }

  .library-empty-state .ghost-button {
    justify-self: stretch;
  }

  .library-stats {
    width: 100%;
  }

  .primary-nav {
    display: flex;
    justify-content: stretch;
  }

  .primary-nav-button {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 6px;
  }

  .app-header {
    gap: 8px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
  }

  .browse-card {
    gap: 10px;
    padding: 10px;
  }

  .browse-card-metric {
    min-height: 52px;
    padding: 7px 8px;
  }

  .browse-card-metric-label {
    font-size: 0.66rem;
  }

  .browse-card-metric-value {
    font-size: 0.92rem;
  }

  .service-tab {
    font-size: 0.88rem;
  }

  .brand-name {
    font-size: 1.22rem;
  }

  .last-updated {
    max-width: none;
    font-size: 0.76rem;
    white-space: nowrap;
  }

  .control-input {
    min-height: 40px;
    font-size: 1rem;
  }

  .game-card-metrics,
  .detail-metrics,
  .detail-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-panel {
    width: calc(100% - 12px);
    padding: 14px;
  }
}
