:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-elevated: rgba(16, 26, 42, 0.88);
  --bg-strong: #0e1b2e;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --text: #eef4ff;
  --muted: #a6b8d7;
  --accent: #6ca8ff;
  --accent-2: #8f7cff;
  --danger: #ff7798;
  --success: #6ee7b7;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --header-height: 176px;
  --footer-height: 64px;
  --content-max: 1600px;
  --card-max-width: 320px;
  --blur: saturate(180%) blur(18px);
  --border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(108, 168, 255, 0.16), transparent 24%),
    radial-gradient(circle at 100% 0%, rgba(143, 124, 255, 0.14), transparent 24%),
    linear-gradient(180deg, #07111f 0%, #091524 40%, #050b14 100%);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

.hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  min-height: 100vh;
}

.site-header,
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 40;
}

.site-header {
  top: 0;
  padding: 14px 16px 10px;
}

.site-footer {
  bottom: 0;
  padding: 10px 16px 14px;
}

.header-inner,
.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  background: rgba(7, 17, 31, 0.6);
  border: var(--border);
  box-shadow: var(--shadow);
}

.header-inner {
  border-radius: 28px;
  padding: 22px 22px 18px;
  transition: padding 220ms ease, border-radius 220ms ease, transform 220ms ease;
}

.site-header.is-condensed .header-inner {
  padding-top: 14px;
  padding-bottom: 12px;
  border-radius: 22px;
}

.brand-link {
  text-decoration: none;
  color: var(--text);
  display: inline-block;
}

.brand-link h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  transition: font-size 220ms ease;
}

.site-header.is-condensed .brand-link h1 {
  font-size: clamp(1.4rem, 2.4vw, 2.15rem);
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  transition: margin 220ms ease, font-size 220ms ease;
}

.site-header.is-condensed .brand-subtitle {
  margin-top: 5px;
  font-size: 0.9rem;
}

.search-stack {
  margin-top: 18px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px 10px 52px;
  border-radius: 20px;
  border: var(--border);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 22px;
  height: 22px;
  fill: rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

#searchInput {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}

#searchInput::placeholder {
  color: rgba(255, 255, 255, 0.46);
}

.favorites-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 0px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.toggle-btn {
  min-width: 84px;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.toggle-btn:hover,
.toggle-btn:focus-visible {
  color: var(--text);
  transform: translateY(-1px);
}

.toggle-btn.is-active {
  background: linear-gradient(135deg, rgba(108, 168, 255, 0.28), rgba(143, 124, 255, 0.32));
  color: var(--text);
}

.results-line {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.page-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding:
    calc(var(--header-height) + 18px)
    16px
    calc(var(--footer-height) + 28px);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  justify-items: center;
  gap: 18px;
}

.game-card {
  position: relative;
  width: 100%;
  max-width: var(--card-max-width);
  min-height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
  border: var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
  transform: translateY(0);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.game-card:hover,
.game-card:focus-within {
  transform: translateY(-4px);
  border-color: rgba(108, 168, 255, 0.42);
}

.card-hitbox {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.favorite-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(5, 11, 20, 0.5);
  backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.favorite-btn:hover,
.favorite-btn:focus-visible,
.modal-favorite-btn:hover,
.modal-favorite-btn:focus-visible,
.modal-close:hover,
.modal-close:focus-visible {
  transform: translateY(-1px) scale(1.03);
}

.favorite-btn::before,
.modal-favorite-btn::before {
  content: "★";
  font-size: 1.18rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.4);
}

.favorite-btn.is-favorite,
.modal-favorite-btn.is-favorite {
  background: rgba(255, 119, 152, 0.2);
  border-color: rgba(255, 119, 152, 0.6);
}

.favorite-btn.is-favorite::before,
.modal-favorite-btn.is-favorite::before {
  color: #ffd257;
}

.card-media {
  position: absolute;
  inset: 0;
}

.card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(108, 168, 255, 0.25), rgba(143, 124, 255, 0.2));
}

.card-cover[data-no-image="true"] {
  object-fit: contain;
  padding: 48px;
  opacity: 0.16;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(2, 6, 15, 0.35) 50%, rgba(2, 6, 15, 1) 100%);
  /*background:
    linear-gradient(180deg, rgba(2, 6, 15, 0.12) 0%, rgba(2, 6, 15, 0.34) 35%, rgba(2, 6, 15, 0.9) 100%),
    linear-gradient(180deg, transparent 0%, rgba(2, 6, 15, 0) 50%, rgba(2, 6, 15, 0.28) 100%);*/
}

.card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 280px;
  padding: 18px 16px 16px;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0px 0px 5px rgba(0, 0, 0, 1);
}

.card-meta,
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-meta {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
}

.card-bottom {
  margin-top: 12px;
}

.card-cheats {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: #dff7eb;
  background: rgba(110, 231, 183, 0.16);
  border: 1px solid rgba(110, 231, 183, 0.18);
}

.status-message,
.empty-state {
  margin: 22px auto 0;
  max-width: 720px;
  text-align: center;
  color: var(--muted);
}

.empty-state {
  padding: 26px 20px;
  border-radius: 20px;
  border: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--text);
}

.footer-inner {
  min-height: 48px;
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.support-link svg {
  width: 18px;
  height: 18px;
  fill: #ff7aa2;
}

.footer-generated,
.footer-created {
  margin: 0;
  white-space: nowrap;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.modal-root.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 15, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.game-modal {
  position: relative;
  margin: auto;
  margin-top: 20px;
  /*margin: max(20px, calc(var(--header-height) - 8px)) auto calc(var(--footer-height) + 18px);*/
  width: min(100% - 24px, 1040px);
  max-height: 95%;
  /*max-height: calc(100vh - var(--header-height) - var(--footer-height) - 36px);*/
  overflow: auto;
  border-radius: 28px;
  border: var(--border);
  background: linear-gradient(180deg, rgba(7, 17, 31, 0.96), rgba(10, 20, 35, 0.98));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.48);
}

.modal-close {
  position: sticky;
  top: 14px;
  margin-left: auto;
  margin-right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(5, 11, 20, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.modal-close svg {
  width: 20px;
  height: 20px;
  fill: var(--text);
}

.modal-hero {
  position: relative;
  min-height: 240px;
  margin-top: -42px;
  background:
    linear-gradient(180deg, rgba(5, 11, 20, 0.1), rgba(5, 11, 20, 0.88)),
    linear-gradient(135deg, rgba(108, 168, 255, 0.24), rgba(143, 124, 255, 0.28));
  background-size: cover;
  background-position: center;
}

.modal-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 17, 31, 0) 0%, rgba(7, 17, 31, 0) 30%, rgba(7, 17, 31, 1) 100%);
  /*background: linear-gradient(180deg, rgba(2, 6, 15, 0.2), rgba(2, 6, 15, 0.76));*/
}

.modal-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 240px;
  padding: 28px 26px 24px;
}

.modal-kicker {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0px 0px 10px rgba(0, 0, 0, 1);
}

.modal-hero-content h2 {
  margin: 0;
  font-size: clamp(1.7rem, 2.6vw, 2.6rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-shadow: 0px 0px 10px rgba(0, 0, 0, 1);
}

.modal-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.modal-pill,
.modal-favorite-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 0px 20px 20px;
}

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

.detail-item {
  min-height: 94px;
  padding: 16px;
  border-radius: 20px;
  border: var(--border);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.detail-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.detail-value {
  font-weight: 600;
  line-height: 1.3;
}

.cheat-groups {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.cheat-group {
  padding: 18px;
  border-radius: 22px;
  border: var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.cheat-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.cheat-group-header h3 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cheat-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.cheat-list {
  display: grid;
  /*grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));*/
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.cheat-list li {
  min-height: 54px;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.35;
}

@media (max-width: 1180px) {
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {

  :root {
    --card-max-width: 100%;
  }

  .search-wrap {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px 10px 8px 42px;
    min-height: 48px;
  }

  .search-icon {
    left: 12px;
    width: 18px;
    height: 18px;
  }

  #searchInput {
    font-size: 0.9rem;
    min-height: 34px;
  }

  .favorites-toggle {
    flex-shrink: 0;
    gap: 4px;
  }

  .toggle-btn {
    min-width: auto;
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .footer-generated {
    display: none;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding: 10px 10px 8px;
  }
  
  .site-footer {
    padding: 8px 10px 10px;
  }

  .header-inner {
    padding: 16px 14px 12px;
    border-radius: 22px;
  }

  .site-header.is-condensed .header-inner {
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .search-stack {
    margin-top: 14px;
  }

  .search-wrap {
    min-height: 58px;
    border-radius: 18px;
  }

  .brand-link h1 {
    font-size: clamp(1.4rem, 7vw, 2rem);
  }

  .site-header.is-condensed .brand-link h1 {
    font-size: clamp(1.2rem, 6vw, 1.5rem);
  }

  .brand-subtitle,
  .results-line {
    font-size: 0.88rem;
  }

  .cards-grid {
    gap: 14px;
  }

  .game-card,
  .card-content {
    min-height: 244px;
  }

  .game-modal {
    width: min(100% - 12px, 1000px);
    border-radius: 22px;
  }

  .modal-body,
  .modal-hero-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .footer-created {
    display: none;
  }

  .footer-inner {
    justify-content: center;
  }

  .modal-hero,
  .modal-hero-content {
    min-height: 210px;
  }

  .cheat-list {
    grid-template-columns: 1fr;
  }

  .game-card {
	aspect-ratio: 30 / 13;
    min-height: auto;
  }

  .card-content {
    min-height: 100%;
    padding: 10px 12px;
  }

  .card-title {
    font-size: 0.95rem;
  }

  .card-meta {
    margin-top: 6px;
    font-size: 0.8rem;
  }

  .card-bottom {
    margin-top: 8px;
  }

  .card-cheats {
    min-height: 26px;
    font-size: 0.78rem;
    padding: 0 8px;
  }
}

@media (max-width: 480px) {

  .header-inner {
    padding: 12px 10px 8px;
  }

  .site-header.is-condensed .header-inner {
    padding: 8px 10px 6px;
  }

  .brand-subtitle {
    margin-top: 4px;
    font-size: 0.75rem;
  }

  .search-stack {
    margin-top: 8px;
  }

  .results-line {
    font-size: 0.75rem;
    margin-top: 6px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}