/* ==============================================================================
   Sekce Dohrané a nedohrané hry (/dohrane-hry)
   Styl malýBobr: karty her, přepínače sekcí, kalendářní roky a štítky
   ============================================================================== */

.games-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.games-hero-text {
  flex: 1;
  min-width: 280px;
}

.games-hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.games-hero-intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 780px;
}

/* Horní ovládací lišta: řazení her + výběr roku + vyhledávání */
.games-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* Posuvný přepínač sekcí (Segmented Dock) s vektorovými SVG ikonami */
.games-tabs {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 0.32rem;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  user-select: none;
}

[data-theme="light"] .games-tabs {
  background: var(--bg-card);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.games-tab-glider {
  position: absolute;
  top: 0.32rem;
  bottom: 0.32rem;
  left: 0.32rem;
  width: calc(50% - 0.32rem);
  border-radius: calc(var(--radius-lg) - 4px);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  box-shadow: 0 4px 16px var(--color-primary-glow);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  pointer-events: none;
  z-index: 0;
}

.games-tabs.is-unfinished .games-tab-glider {
  transform: translateX(100%);
}

.games-tab-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.68rem 1.25rem;
  border-radius: calc(var(--radius-lg) - 4px);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.96rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.22s ease;
}

.games-tab-btn:hover:not(.active) {
  color: var(--text-main);
}

.games-tab-btn.active {
  color: #ffffff;
}

.games-tab-icon {
  flex-shrink: 0;
  color: var(--color-primary-accent);
  opacity: 0.88;
  transition: color 0.22s ease, opacity 0.22s ease, transform 0.22s ease;
}

.games-tab-btn:hover:not(.active) .games-tab-icon {
  opacity: 1;
  transform: translateY(-0.5px);
}

.games-tab-btn.active .games-tab-icon {
  color: #ffffff;
  opacity: 1;
}

.games-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.12rem 0.54rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: background-color 0.22s ease, color 0.22s ease;
}

.games-tab-btn.active .games-tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

[data-theme="light"] .games-tab-btn:not(.active) .games-tab-count {
  background: rgba(99, 44, 160, 0.12);
  color: var(--color-primary);
}

/* Grafické dělení kalendářních roků u dohraných her */
.games-year-block {
  margin-bottom: 2.5rem;
}

.games-year-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.games-year-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(99, 44, 160, 0.28) 0%, rgba(145, 70, 255, 0.15) 100%);
  border: 1px solid var(--border-accent);
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.games-year-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-accent) 0%, transparent 100%);
}

.games-year-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Podtitulek nedohraných her */
.unfinished-note {
  margin-bottom: 1.35rem;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Mřížka a karty her */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  scroll-margin-top: 96px;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  will-change: transform;
}

.game-card:target,
.game-card.is-anchor-target {
  animation: anchorCardPulse 1.15s ease-in-out 0.15s 3;
}

.game-card.has-collection {
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}

.game-banner-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #101016;
}

.game-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.game-card:hover .game-banner {
  transform: scale(1.04);
}

/* Decentní černý rámeček se světlým textem pro rok vydání v pravém horním rohu */
.game-release-badge {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  padding: 0.16rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 14, 0.88);
  color: #f4f4f7;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  backdrop-filter: blur(4px);
}

.game-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  flex: 1;
}

.game-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.game-order-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  flex-shrink: 0;
  margin-top: 0.12rem;
}

.game-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

/* Decentní kouřový štítek prokliku do záznamů v levém horním rohu obrázku (animovaný výjezd nápisu) */
.game-records-badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.42rem;
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 14, 0.88);
  color: #f4f4f7;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, padding 0.24s ease;
}

.game-records-badge svg {
  flex-shrink: 0;
  opacity: 0.92;
}

.game-records-label {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease, margin-left 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.game-card.has-collection:hover .game-records-badge {
  background: rgba(99, 44, 160, 0.88);
  border-color: rgba(169, 112, 255, 0.55);
  color: #ffffff;
}

.game-records-badge:hover {
  padding-right: 0.54rem;
}

.game-records-badge:hover .game-records-label {
  max-width: 76px;
  opacity: 1;
  margin-left: 0.34rem;
}

.games-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Rozbalovací filtr podle roku dohrání */
.year-filter-dropdown { position: relative; user-select: none; }

.year-filter-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.year-filter-pill:hover,
.year-filter-pill.is-open { border-color: var(--border-accent); background: var(--bg-card); }

.year-filter-pill.has-active-year {
  border-color: var(--color-primary-accent);
  background: var(--color-primary-glow);
  box-shadow: 0 2px 12px var(--color-primary-glow);
}

.year-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.54rem 0.9rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.year-filter-pill.has-active-year .year-filter-btn { padding-right: 0.35rem; }
.year-filter-cal-icon, .year-filter-label { color: var(--color-primary-accent); flex-shrink: 0; }
.year-filter-chevron { color: var(--text-muted); transition: transform 0.2s ease; flex-shrink: 0; }
.year-filter-pill.is-open .year-filter-chevron { transform: rotate(180deg); }

.year-filter-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 0.45rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}

.year-filter-clear:hover,
[data-theme="light"] .year-filter-clear:hover { background: var(--color-primary); color: #ffffff; }
[data-theme="light"] .year-filter-clear { background: rgba(99, 44, 160, 0.16); color: var(--color-primary); }

.year-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 205px;
  max-height: min(440px, 68vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 105;
  animation: fadeInDown 0.15s ease-out;
}

.year-filter-menu::-webkit-scrollbar { width: 6px; }
.year-filter-menu::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.year-filter-menu::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.year-filter-menu::-webkit-scrollbar-thumb { background: rgba(145, 70, 255, 0.36); border-radius: 9999px; }
.year-filter-menu::-webkit-scrollbar-thumb:hover { background: rgba(145, 70, 255, 0.68); }
[data-theme="light"] .year-filter-menu::-webkit-scrollbar-thumb { background: rgba(99, 44, 160, 0.28); }
[data-theme="light"] .year-filter-menu::-webkit-scrollbar-thumb:hover { background: rgba(99, 44, 160, 0.55); }

@supports not selector(::-webkit-scrollbar) {
  .year-filter-menu { scrollbar-width: thin; scrollbar-color: rgba(145, 70, 255, 0.42) transparent; }
  [data-theme="light"] .year-filter-menu { scrollbar-color: rgba(99, 44, 160, 0.35) transparent; }
}

.year-filter-menu.open { display: flex; }
.year-filter-divider { height: 1px; background: var(--border-subtle); margin: 0.2rem 0.25rem; }

.year-filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.48rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.year-filter-item:hover { background: var(--bg-card-hover); color: var(--text-main); }
.year-filter-item.active { background: var(--color-primary-glow); color: var(--color-primary-accent); font-weight: 700; }
.year-filter-item.is-zero:not(.active) { opacity: 0.48; }
.year-filter-item-count { font-size: 0.78rem; color: var(--text-dim); font-weight: 600; }
.year-filter-item.active .year-filter-item-count { color: var(--color-primary-accent); }

@media (max-width: 640px) {
  .games-hero { flex-direction: column; align-items: stretch; gap: 1rem; }
  .games-tabs, .games-toolbar-controls { width: 100%; }
  .games-toolbar .sorting-dropdown { width: 100%; }
  .games-toolbar .sorting-btn { width: 100%; justify-content: space-between; }
  .year-filter-dropdown { flex-shrink: 0; }
  .year-filter-menu { left: 0; right: auto; }
  .games-toolbar-controls .search-input-box { flex: 1; min-width: 165px; width: auto; }
  .games-tab-btn { gap: 0.4rem; padding: 0.62rem 0.55rem; font-size: 0.86rem; }
  .games-tab-icon { width: 16px; height: 16px; }
  .games-tab-count { padding: 0.1rem 0.42rem; font-size: 0.74rem; }
}
