:root {
  --ink: #262b34;
  --soft: #707681;
  --paper: #f6f7f9;
  --card: #fff;
  --red: #ef3340;
  --cyan: #14b8c4;
  --line: #dfe3e8;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(circle at 10% 24%, rgba(20, 184, 196, .08) 0 2px, transparent 2.5px) 0 0 / 42px 42px,
    linear-gradient(180deg, #fff 0, var(--paper) 36%, #eef0f3 100%);
  color: var(--ink);
  font-family: 'Nunito Sans', sans-serif;
}
button, a { font: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 20px rgba(38, 43, 52, .05);
  backdrop-filter: blur(16px);
}
.topbar-inner, .featured-section, .catalog-section, .site-footer { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.topbar-inner { display: flex; min-height: 76px; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font: 400 1.5rem 'Jua', sans-serif;
  box-shadow: inset 0 -4px 0 rgba(112, 0, 8, .18), 0 5px 12px rgba(239, 51, 64, .22);
}
.brand-name { color: var(--ink); font-size: 1.05rem; font-weight: 900; letter-spacing: .08em; }
.brand-mode { padding: 4px 7px; border-radius: 5px; background: var(--red); color: #fff; font-size: .64rem; font-weight: 900; letter-spacing: .1em; }
.topbar nav { display: flex; align-items: center; gap: 8px; }
.topbar nav a, .topbar nav button { border: 0; border-radius: 999px; padding: 10px 15px; background: transparent; color: var(--soft); font-size: .84rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.topbar nav a:hover, .topbar nav button:hover { background: #eceff2; color: var(--ink); }
.topbar nav button { background: var(--red); color: #fff; }

.featured-section { padding-top: 42px; }
.section-label, .catalog-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-label { margin-bottom: 14px; }
.section-label p, .catalog-heading > div > p { margin: 0; color: var(--red); font-size: .75rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.section-label span, .catalog-heading > span { color: var(--soft); font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.online-status { display: inline-flex; align-items: center; gap: 7px; }
.online-status i { width: 8px; height: 8px; border-radius: 50%; background: #39bd62; box-shadow: 0 0 0 4px rgba(57, 189, 98, .12); }

.featured-carousel { position: relative; }
.featured-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, .8fr);
  min-height: 460px;
  overflow: hidden;
  border: 7px solid #fff;
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(38, 43, 52, .14), 0 3px 0 rgba(38, 43, 52, .08);
  animation: featured-in 420ms ease both;
}
.featured-tabs { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }
.featured-tabs:empty { display: none; }
.featured-tabs button {
  display: flex;
  width: 44px;
  height: 12px;
  overflow: hidden;
  align-items: center;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #cbd0d6;
  color: transparent;
  cursor: pointer;
  transition: width 220ms ease, background 220ms ease;
}
.featured-tabs button:hover, .featured-tabs button:focus-visible { background: #9299a3; outline: 3px solid rgba(20, 184, 196, .22); outline-offset: 3px; }
.featured-tabs button.is-active { width: 72px; background: var(--red); }
.tab-number { opacity: 0; }

.featured-visual, .card-visual { position: relative; min-width: 0; overflow: hidden; background: var(--accent); }
.featured-visual { border-radius: 22px; }
.featured-visual::after, .card-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(255, 255, 255, .2), transparent 48%, rgba(0, 0, 0, .08));
}
.game-image, .game-fallback { width: 100%; height: 100%; }
.game-image { object-fit: cover; }
.game-fallback {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 76% 24%, rgba(255, 255, 255, .6) 0 8%, transparent 8.5%),
    radial-gradient(circle at 19% 76%, rgba(255, 255, 255, .25) 0 11%, transparent 11.5%),
    linear-gradient(135deg, transparent 0 44%, rgba(255, 255, 255, .2) 44% 58%, transparent 58%),
    var(--accent);
  color: rgba(27, 36, 46, .78);
}
.game-fallback span { font: 400 clamp(4.5rem, 10vw, 9rem) 'Jua', sans-serif; letter-spacing: -.06em; text-shadow: 0 5px 0 rgba(255, 255, 255, .25); }

.featured-content { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 4vw, 54px); }
.featured-meta, .card-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--red); font-size: .68rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.featured-meta time, .card-meta time { color: var(--soft); }
.featured-content h2 { margin: 24px 0 15px; font: 400 clamp(2.5rem, 4.7vw, 4.9rem)/.98 'Jua', sans-serif; letter-spacing: -.045em; }
.featured-content > p, .card-content > p { margin: 0; color: var(--soft); line-height: 1.65; }
.category-chip { width: fit-content; margin-top: 20px; padding: 7px 12px; border-radius: 999px; background: #eef0f3; color: #59616c; font-size: .7rem; font-weight: 900; }
.primary-action {
  display: inline-flex;
  width: fit-content;
  min-height: 52px;
  align-items: center;
  gap: 11px;
  margin-top: 30px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .9rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(112, 0, 8, .18), 0 8px 18px rgba(239, 51, 64, .25);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.primary-action::before { content: '▶'; font-size: .72rem; }
.primary-action:hover { transform: translateY(-2px); box-shadow: inset 0 -4px 0 rgba(112, 0, 8, .18), 0 12px 22px rgba(239, 51, 64, .3); }

.catalog-section { padding-top: 82px; padding-bottom: 105px; }
.catalog-heading { margin-bottom: 26px; }
.catalog-heading h1 { margin: 6px 0 0; font: 400 clamp(2rem, 4vw, 3.6rem) 'Jua', sans-serif; letter-spacing: -.035em; }
.catalog-heading > span { padding: 7px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.projects-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.game-card {
  min-width: 0;
  overflow: hidden;
  border: 5px solid #fff;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 10px 25px rgba(38, 43, 52, .1), 0 2px 0 rgba(38, 43, 52, .08);
  animation: card-in 480ms ease both;
  animation-delay: var(--delay);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.game-card:hover { transform: translateY(-8px); border-color: var(--accent); box-shadow: 0 18px 34px rgba(38, 43, 52, .15); }
.card-visual { display: block; aspect-ratio: 1 / .78; border-radius: 17px; }
.card-visual .game-image, .card-visual .game-fallback { transition: transform 380ms ease; }
.game-card:hover .card-visual .game-image, .game-card:hover .card-visual .game-fallback { transform: scale(1.05); }
.card-number { position: absolute; top: 11px; left: 11px; z-index: 2; display: grid; width: 35px; height: 35px; place-items: center; border: 3px solid #fff; border-radius: 50%; background: var(--red); color: #fff; font-size: .66rem; font-weight: 900; box-shadow: 0 3px 9px rgba(0, 0, 0, .16); }
.card-content { display: flex; min-height: 260px; flex-direction: column; padding: 19px 16px 17px; }
.card-meta { font-size: .59rem; }
.card-content h2 { margin: 14px 0 9px; font: 400 1.35rem/1.1 'Jua', sans-serif; letter-spacing: -.02em; }
.card-content > p { display: -webkit-box; overflow: hidden; font-size: .82rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.card-action { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; margin-top: auto; padding: 0 14px; border-radius: 13px; background: #eef0f3; color: var(--ink); font-size: .8rem; font-weight: 900; text-decoration: none; }
.card-action:hover { background: var(--cyan); color: #fff; }

.loading-state, .error-state { padding: 48px; border-radius: 24px; background: #fff; color: var(--soft); box-shadow: 0 12px 30px rgba(38, 43, 52, .08); }
.error-state h2, .error-state p { margin: 0; }
.error-state p { margin-top: 8px; }
.site-footer { display: flex; min-height: 104px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--soft); font-size: .76rem; font-weight: 700; }
.site-footer p { margin: 0; }
.footer-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--cyan); }

@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes featured-in { from { opacity: .35; transform: scale(.99); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 980px) {
  .featured-card { grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); min-height: 430px; }
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .topbar-inner, .featured-section, .catalog-section, .site-footer { width: min(100% - 26px, 1160px); }
  .brand-name, .brand-mode { display: none; }
  .topbar nav { gap: 1px; }
  .topbar nav a, .topbar nav button { padding: 9px 8px; font-size: .74rem; }
  .featured-section { padding-top: 28px; }
  .featured-card { display: flex; min-height: 0; flex-direction: column; border-width: 5px; border-radius: 24px; }
  .featured-visual { aspect-ratio: 16 / 10; border-radius: 18px; }
  .featured-content { min-height: 360px; justify-content: flex-start; padding: 27px 21px 30px; }
  .featured-content h2 { font-size: clamp(2.35rem, 12vw, 3.6rem); }
  .primary-action { width: 100%; justify-content: center; margin-top: auto; }
  .catalog-section { padding-top: 62px; padding-bottom: 72px; }
  .catalog-heading { align-items: flex-start; flex-direction: column; }
  .projects-grid { grid-template-columns: minmax(0, 1fr); }
  .card-visual { aspect-ratio: 16 / 10; }
  .card-content { min-height: 245px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
