:root {
  --bg: #050505;
  --bg-soft: #111111;
  --surface: rgba(17, 17, 17, 0.9);
  --surface-strong: rgba(10, 10, 10, 0.98);
  --surface-alt: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f4f4;
  --muted: #ababab;
  --accent: #2a2a2a;
  --accent-strong: #000000;
  --success: #666666;
  --danger: #444444;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(8, 8, 8, 0.86), rgba(14, 14, 14, 0.9)),
    url("/assets/app-background.png") center / cover fixed no-repeat,
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at right, rgba(255, 255, 255, 0.04), transparent 25%),
    linear-gradient(160deg, #030303 0%, #0a0a0a 48%, #151515 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.site-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  position: sticky;
  top: 12px;
  z-index: 10;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(18px);
  background: rgba(10, 10, 10, 0.72);
}

.brand,
.topnav button,
.button,
.ghost-button,
.tag {
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.brand:hover,
.topnav button:hover,
.button:hover,
.ghost-button:hover,
.tag:hover {
  transform: translateY(-1px);
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.35));
}

.brand strong,
.brand small {
  display: block;
  text-align: left;
}

.brand small {
  color: var(--muted);
}

.topnav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topnav button,
.ghost-button,
.tag {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(22, 22, 22, 0.84);
  border-radius: 999px;
  padding: 10px 16px;
}

.view {
  display: grid;
  gap: 28px;
  animation: fade-up 280ms ease;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  padding: 32px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.eyebrow,
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d0d0d0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.detail-copy h1 {
  margin: 12px 0 10px;
  font-family: "Fraunces", serif;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 0.95;
}

.hero p,
.detail-copy p,
.card p,
.stat-copy p,
.empty-state p {
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.filter-row,
.chip-row,
.detail-actions,
.mini-stats,
.image-actions,
.solution-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: #f6f6f6;
  font-weight: 700;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.button.secondary {
  color: var(--text);
  background: rgba(24, 24, 24, 0.84);
  border: 1px solid var(--line);
  box-shadow: none;
}

.hero-panel,
.glass-card,
.detail-layout,
.stats-grid article,
.puzzle-meta,
.solution-panel,
.tips-panel,
.board-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.panel-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.kpi {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(24, 24, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.kpi strong,
.stat-number {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.control-bar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.control-bar {
  padding: 20px 22px;
}

.search-input,
.select-input {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.88);
  color: var(--text);
  padding: 12px 16px;
}

.search-input {
  min-width: min(360px, 100%);
}

.tag.active {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.stats-grid,
.cards-grid,
.detail-layout {
  display: grid;
  gap: 20px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stats-grid article {
  padding: 22px;
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(14, 14, 14, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.card img,
.detail-visual img,
.solution-visual img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.card-image-shell {
  height: 320px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(24, 24, 24, 0.92), rgba(10, 10, 10, 0.96));
}

.card img {
  height: 320px;
}

.card-image-shell-contain {
  display: grid;
  place-items: center;
  padding: 10px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(26, 26, 26, 0.96), rgba(8, 8, 8, 0.98));
}

.card img.card-image-contain {
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 18px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.12);
}

.card-body {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.card-title-row,
.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.difficulty-pill,
.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.difficulty-medium {
  background: rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
}

.difficulty-easy {
  background: rgba(255, 255, 255, 0.08);
  color: #f0f0f0;
}

.difficulty-hard {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.difficulty-expert {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.status-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #f4f4f4;
}

.card-stats,
.puzzle-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.card-stats div,
.puzzle-stats div {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(26, 26, 26, 0.9);
}

.card-stats span,
.puzzle-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.card-stats strong,
.puzzle-stats strong {
  font-size: 1rem;
}

.detail-layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  padding: 24px;
}

.detail-copy,
.detail-side {
  display: grid;
  gap: 20px;
}

.detail-visual {
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.detail-visual img {
  max-height: 760px;
  object-fit: contain;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 40%),
    linear-gradient(180deg, rgba(20, 20, 20, 0.72), rgba(8, 8, 8, 0.9));
}

.detail-visual img.detail-solution-image {
  max-height: 860px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(18, 18, 18, 0.96), rgba(6, 6, 6, 0.98));
}

.image-actions {
  justify-content: flex-end;
}

.board-panel,
.solution-panel,
.tips-panel,
.puzzle-meta {
  padding: 22px;
}

.board-panel {
  max-width: 390px;
  justify-self: end;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(18, 18, 18, 0.94);
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.6rem;
  font-weight: 700;
}

.timer-chip small {
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(34px, 1fr));
  gap: 5px;
}

.cell {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 10px;
  border: 1px solid transparent;
  text-align: center;
  font-size: clamp(0.88rem, 1.2vw, 1rem);
  font-weight: 700;
  color: var(--text);
  background: rgba(28, 28, 28, 0.96);
  caret-color: transparent;
}

.cell.given {
  color: #ffffff;
  background: rgba(42, 42, 42, 0.98);
}

.cell:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.cell.invalid {
  border-color: rgba(255, 122, 122, 0.88);
  color: #ffffff;
  background: rgba(55, 55, 55, 0.96);
}

.cell.correct {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(36, 36, 36, 0.98);
}

.cell[disabled] {
  opacity: 0.62;
  cursor: not-allowed;
}

.solution-visual {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin-top: 16px;
  min-height: 320px;
  display: grid;
  place-items: center;
  cursor: pointer;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(22, 22, 22, 0.78), rgba(6, 6, 6, 0.92));
}

.solution-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.solution-visual img {
  width: 100%;
  max-height: 320px;
  filter: blur(22px) saturate(0.7);
  transform: scale(1.04);
  transition:
    filter 220ms ease,
    transform 220ms ease,
    max-height 220ms ease;
}

.solution-visual img.solution-sheet {
  height: auto;
  max-height: 700px;
  object-fit: contain;
  background: rgba(14, 14, 14, 0.8);
}

.solution-visual.revealed img {
  filter: blur(0);
  transform: scale(1);
  max-height: 760px;
}

.solution-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.28), rgba(0, 0, 0, 0.74));
  text-align: center;
}

.solution-visual.revealed .solution-overlay {
  opacity: 0;
  pointer-events: none;
}

.board-legend,
.tips-list,
.meta-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.board-legend li,
.tips-list li,
.meta-list li {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(20, 20, 20, 0.94);
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 42px 22px;
}

.toast {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(18, 18, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f4f4;
}

.toast.warning {
  background: rgba(28, 28, 28, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f4f4f4;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .hero,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 14px;
  }

  .topbar,
  .control-bar,
  .section-head,
  .timer-row,
  .card-title-row,
  .detail-header {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid,
  .cards-grid,
  .panel-kpis {
    grid-template-columns: 1fr;
  }

  .hero,
  .detail-layout,
  .board-panel,
  .solution-panel,
  .tips-panel,
  .puzzle-meta {
    padding: 18px;
  }

  .board-panel {
    max-width: 100%;
    justify-self: stretch;
  }

  .board {
    grid-template-columns: repeat(6, minmax(34px, 1fr));
    gap: 6px;
  }

  .search-input {
    min-width: 100%;
  }
}
