/* Games catalogue + per-game library. Scoped. Do not retouch Home. */
@import url("/shared/puzzle-status.css?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");
@import url("/shared/breadcrumbs.css?v=851a8c2ad02a7c5abcc0b0619c547ae99aa57c00");

body.ds-shell .games {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 16px 0 48px;
}

body.ds-shell .games > .card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

body.ds-shell .games > .card .card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 10px;
}

body.ds-shell .games > .card .card-head h2 {
  margin: 0;
}

body.ds-shell .games > .card .card-head .game-cat-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--paper-wash) 70%, var(--paper-bright));
}

body.ds-shell .games > .card .card-head .game-icon {
  display: block;
  width: 34px;
  height: 34px;
}

body.ds-shell[data-game="sudoku"] .lib-thumb .game-icon,
body.ds-shell .games > .card.card-sudoku .game-cat-icon { color: var(--game-sudoku, var(--indigo)); }
body.ds-shell[data-game="killer-sudoku"] .lib-thumb .game-icon,
body.ds-shell .games > .card.card-killer-sudoku .game-cat-icon { color: var(--game-killer, var(--vermillon)); }
body.ds-shell[data-game="binary-puzzle"] .lib-thumb .game-icon,
body.ds-shell .games > .card.card-binary-puzzle .game-cat-icon { color: var(--game-binary, var(--matcha)); }
body.ds-shell[data-game="futoshiki"] .lib-thumb .game-icon,
body.ds-shell .games > .card.card-futoshiki .game-cat-icon { color: var(--game-futoshiki, var(--cta)); }
body.ds-shell[data-game="kakuro"] .lib-thumb .game-icon,
body.ds-shell .games > .card.card-kakuro .game-cat-icon { color: var(--game-kakuro, #6B5B95); }
body.ds-shell[data-game="codebreaker"] .lib-thumb .game-icon,
body.ds-shell .games > .card.card-codebreaker .game-cat-icon { color: var(--game-codebreaker, #E07A5F); }

body.ds-shell .games > .card p[data-i18n$=".blurb"] {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.2em;
}

body.ds-shell .games > .card .actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

body.ds-shell[data-game] .hero-stage,
body.ds-shell[data-game] .lib-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  max-width: 52rem;
  min-height: 0;
}

body.ds-shell[data-game] .lib-hero-copy {
  flex: 1 1 16rem;
  min-width: 0;
}

body.ds-shell[data-game] .lib-hero-aside,
body.ds-shell[data-game] .lib-hero-thumb {
  display: none;
}

body.ds-shell[data-game] .play-mini-empty {
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 33.33% 33.33%,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 33.33% 33.33%;
}

body.ds-shell[data-game] .lib-hero-count {
  margin: 4px 0 0;
  font-family: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  text-align: left;
}

body.ds-shell[data-game] .lib-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-top: 12px;
}

body.ds-shell[data-game] .lib-hero-actions .btn,
body.ds-shell[data-game] .lib-hero-actions .quick-rules-btn {
  min-height: 44px;
  margin-left: 0;
}

body.ds-shell[data-game] .hero-visual {
  display: none;
  min-height: 0;
}

body.ds-shell[data-game] .hero-grid {
  width: 96px;
  aspect-ratio: 1;
  margin-left: 0;
}

body.ds-shell[data-game] .hero-digit {
  font-size: 1.05rem;
}

body.ds-shell[data-game] .hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 18px;
}

body.ds-shell[data-game] #libStats,
body.ds-shell[data-game] .stat-grid {
  display: block;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

body.ds-shell[data-game] .lib-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 0 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

body.ds-shell[data-game] .lib-progress div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 40px;
}

body.ds-shell[data-game] .lib-progress strong {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
}

body.ds-shell[data-game] .lib-progress span {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.ds-shell[data-game] .lib-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
  padding: 0;
}

body.ds-shell[data-game] .lib-filter {
  display: grid;
  gap: 6px;
  min-width: min(100%, 200px);
}

body.ds-shell[data-game] .lib-filter > span {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

body.ds-shell[data-game] .lib-filter select {
  min-height: 44px;
  width: 100%;
  max-width: 240px;
}

body.ds-shell[data-game] .lib-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  max-width: none;
  margin: 0 0 48px;
}

body.ds-shell[data-game] .lib-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 8px 12px;
  align-items: start;
  min-height: 0;
  padding: 12px;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: inherit;
}

body.ds-shell[data-game] .lib-thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  grid-row: 1 / span 2;
}

body.ds-shell[data-game] .lib-thumb .game-icon {
  display: block;
  width: 50px;
  height: 50px;
}

body.ds-shell[data-game] .lib-thumb .play-mini {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
}

body.ds-shell[data-game] .lib-item-copy {
  min-width: 0;
}

body.ds-shell[data-game] .lib-item .mini-board {
  width: 64px;
  height: 64px;
  opacity: 0.7;
}

body.ds-shell[data-game] .lib-item.is-solved .mini-board {
  opacity: 0.38;
}

body.ds-shell[data-game] .lib-solved-mark {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--matcha) 82%, #14522a);
  color: #FFF9E8;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--paper-bright);
}

body.ds-shell[data-game][data-ds-theme="dark"] .lib-solved-mark,
html[data-ds-theme="dark"] body.ds-shell[data-game] .lib-solved-mark {
  background: color-mix(in srgb, var(--matcha) 88%, #F3E9D8);
  color: #241A14;
  box-shadow: 0 0 0 2px var(--paper-bright);
}

body.ds-shell[data-game] .lib-item h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow-wrap: anywhere;
}

body.ds-shell[data-game] .lib-title-check {
  color: var(--matcha);
  font-size: 0.95rem;
  line-height: 1;
}

body.ds-shell[data-game] .lib-item p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

body.ds-shell[data-game] .lib-item-global {
  font-size: 0.72rem;
  opacity: 0.78;
}

body.ds-shell[data-game] .lib-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  grid-column: 2;
  margin-top: 0;
}

body.ds-shell[data-game] .lib-status {
  font-size: 0.78rem;
  color: var(--muted);
}

body.ds-shell[data-game] .lib-item.is-solved .lib-status {
  color: var(--matcha);
}

body.ds-shell[data-game] .lib-cta .btn {
  min-height: 40px;
  padding: 6px 12px;
}

@media (min-width: 640px) {
  body.ds-shell .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.ds-shell[data-game] .lib-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  body.ds-shell[data-game] .hero-stage,
  body.ds-shell[data-game] .lib-hero {
    flex-wrap: nowrap;
  }
  body.ds-shell[data-game] .hero-visual {
    display: none;
  }
}

@media (min-width: 1100px) {
  body.ds-shell[data-game] .lib-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

body.ds-shell[data-game] .quick-rules-btn {
  min-height: 44px;
  margin-left: 0;
}

.quick-rules-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.quick-rules-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--sumi, #2B2419) 42%, transparent);
}

.quick-rules-card {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 32px));
  max-height: min(80vh, 560px);
  margin: 12vh auto 0;
  padding: 18px 18px 16px;
  overflow: auto;
  background: var(--paper-bright);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  color: var(--ink);
}

.quick-rules-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-rules-top h2 {
  margin: 0;
  font-size: 1.05rem;
}

.quick-rules-x {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.quick-rules-card ul {
  margin: 0;
  padding-left: 1.15em;
}

.quick-rules-card li { margin: 0 0 6px; }

.quick-rules-more {
  margin: 16px 0 0;
}

.quick-rules-more a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid #C88708;
}

.quick-rules-more a:hover { color: #C88708; }

@media (max-width: 760px) {
  body.ds-shell[data-game] .lib-filter select {
    max-width: none;
  }

  .quick-rules-card {
    width: var(--mobile-content-width, 95%);
  }
}

body.ds-shell[data-game] .lib-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 32rem; }
body.ds-shell[data-game] .lib-filter { min-width: 0; }
body.ds-shell[data-game] .lib-filter select { min-width: 0; max-width: none; padding-inline: 8px; font-size: .9rem; }
