.auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-user-avatar {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(127, 231, 255, 0.08);
  border: 1px solid rgba(127, 231, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-user-avatar img,
.auth-user-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.auth-user-avatar img {
  object-fit: cover;
}

.auth-user-avatar svg {
  width: 24px;
  height: 24px;
}

.auth-user-avatar[hidden],
.auth-button[hidden] {
  display: none !important;
}

.auth-button {
  min-height: 46px;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  font-weight: 800;
}

.auth-logout {
  color: var(--cyan);
}

.games-panel {
  margin-top: 22px;
  padding: 22px;
  border-radius: var(--radius);
}

.games-toolbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(460px, 0.9fr);
  gap: 18px;
  align-items: end;
  padding: 2px;
}

.games-search,
.games-sort,
.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-form label[hidden] {
  display: none !important;
}

.games-search input,
.comment-device-grid select,
.auth-form input,
.comment-form textarea {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
  padding: 0 16px;
}

.comment-device-grid select {
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.comment-device-grid select option {
  color: #07111f;
  background: #f3f7ff;
}

.games-sort {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.games-sort legend {
  padding: 0 0 8px;
}

.sort-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  min-height: 56px;
  padding: 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(132, 196, 255, 0.12);
}

.sort-chip {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.sort-chip:hover,
.sort-chip.active {
  color: var(--text);
  border-color: rgba(127, 231, 255, 0.32);
  background: linear-gradient(135deg, rgba(127, 231, 255, 0.14), rgba(120, 168, 255, 0.08));
}

.games-search input:focus,
.comment-device-grid select:focus,
.auth-form input:focus,
.comment-form textarea:focus {
  border-color: rgba(127, 231, 255, 0.36);
  box-shadow: 0 0 0 3px rgba(127, 231, 255, 0.08);
}

.games-status {
  margin-top: 18px;
  color: var(--muted);
  font-weight: 700;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.game-card {
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: rgba(127, 231, 255, 0.32);
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.3);
}

.game-cover-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  background: rgba(255, 255, 255, 0.04);
}

.game-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-compat {
  position: absolute;
  left: 10px;
  top: 10px;
  display: inline-flex;
  justify-content: center;
  max-width: calc(100% - 20px);
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(8, 17, 31, 0.58);
  border: 1px solid rgba(125, 247, 199, 0.46);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.game-compat.playable,
.game-compat.ingame {
  border-color: rgba(255, 209, 102, 0.5);
}

.game-compat.menu,
.game-compat.intro {
  border-color: rgba(255, 159, 125, 0.5);
}

.game-compat.unknown,
.game-compat.nothing {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.game-compat.detail {
  position: static;
  align-self: flex-start;
  min-width: 0;
  max-width: fit-content;
  min-height: 24px;
  padding: 4px 12px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  background: rgba(8, 17, 31, 0.68);
  border-color: rgba(127, 231, 255, 0.34);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.game-card-body {
  padding: 14px;
}

.game-card h3 {
  display: -webkit-box;
  min-height: 3.3em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 1.02rem;
  line-height: 1.35;
}

.game-card-meta,
.game-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.game-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.game-genres span {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(127, 231, 255, 0.08);
  font-size: 0.78rem;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2300;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 14, 0.78);
  backdrop-filter: blur(12px);
}

body.game-detail-open main > section:not(#game-detail-screen),
body.game-detail-open .site-footer {
  display: none;
}

body.games-route main > section:not(#games):not(#game-detail-screen) {
  display: none;
}

body.games-route #games {
  min-height: calc(100vh - 92px);
  padding-top: 34px;
}

body.games-route .reveal {
  opacity: 1;
  transform: none;
}

.game-detail-screen {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 86px);
  padding: 24px 0 54px;
}

.game-detail-screen[hidden] {
  display: none;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 16px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(127, 231, 255, 0.08);
  border: 1px solid rgba(127, 231, 255, 0.16);
  font-weight: 900;
}

#game-detail-content {
  overflow: hidden;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(14, 26, 47, 0.88), rgba(10, 20, 36, 0.76));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.game-detail-hero {
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 34px;
  border-radius: 30px 30px 0 0;
  background:
    linear-gradient(90deg, rgba(7, 16, 29, 0.98), rgba(7, 16, 29, 0.72) 48%, rgba(7, 16, 29, 0.94)),
    linear-gradient(180deg, rgba(7, 16, 29, 0.16), rgba(7, 16, 29, 0.98)),
    var(--game-hero) center / cover;
}

.game-detail-hero.no-hero {
  background:
    linear-gradient(135deg, rgba(16, 31, 56, 0.96), rgba(7, 16, 29, 0.98)),
    radial-gradient(circle at 20% 20%, rgba(127, 231, 255, 0.12), transparent 36%);
}

.game-detail-cover {
  width: min(100%, 260px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(132, 196, 255, 0.24);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.46);
  background: rgba(255, 255, 255, 0.04);
}

.game-detail-copy {
  max-width: 760px;
  display: grid;
  gap: 14px;
  align-content: center;
}

.game-detail-copy h2 {
  margin: 0;
  font-size: clamp(2rem, 4.3vw, 3.6rem);
  line-height: 1.04;
  text-wrap: balance;
}

.game-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.game-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
  padding: 22px;
  align-items: start;
}

.game-media-panel,
.game-info-panel,
.comments-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.media-viewer,
.compat-card,
.game-text-block,
.comments-panel,
.video-block {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
}

.media-viewer > img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 16px;
  display: block;
}

.screenshot-strip,
.video-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 12px;
}

.screenshot-strip button {
  flex: 0 0 120px;
  height: 68px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  background: transparent;
}

.screenshot-strip button.active,
.video-tabs button.active {
  border-color: var(--cyan);
}

.screenshot-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-frame {
  margin-top: 12px;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-tabs button {
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.compat-card dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.compat-card div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(132, 196, 255, 0.1);
}

.compat-card dt {
  color: var(--muted);
}

.compat-card dd {
  margin: 0;
  text-align: right;
}

.game-text-block p,
.comment-card p,
.comments-empty,
.comments-login,
.no-media {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.comments-panel {
  margin: 0 22px 22px;
  padding: 22px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(16, 31, 56, 0.72), rgba(10, 20, 36, 0.88)),
    radial-gradient(circle at top right, rgba(127, 231, 255, 0.08), transparent 34%);
  border: 1px solid rgba(132, 196, 255, 0.14);
}

.comments-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.comments-head h3 {
  margin: 0;
}

.comments-head p {
  margin: 8px 0 0;
  max-width: 64ch;
  color: var(--muted);
  line-height: 1.65;
}

.comments-guest,
.comments-empty-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(14, 26, 47, 0.8), rgba(10, 20, 36, 0.68));
  border: 1px solid rgba(132, 196, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(0, 0, 0, 0.18);
}

.comments-guest {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.comments-guest-copy strong,
.comments-empty-card strong {
  display: block;
  color: var(--text);
  font-size: 1.06rem;
}

.comments-guest .button {
  min-width: 140px;
}

.comments-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

@media (max-width: 1280px) {
  .game-detail-hero {
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    min-height: 0;
  }

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

.comment-form {
  display: grid;
  gap: 12px;
}

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

.comment-device-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.comment-form textarea {
  min-height: 110px;
  padding: 14px 16px;
  resize: vertical;
}

.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
}

.star-rating input {
  position: absolute;
  opacity: 0;
}

.star-rating label {
  color: rgba(255, 255, 255, 0.26);
  font-size: 1.8rem;
  cursor: pointer;
}

.star-rating input:checked ~ label,
.star-rating label:hover,
.star-rating label:hover ~ label {
  color: #ffd166;
}

.comment-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 26, 47, 0.72), rgba(10, 20, 36, 0.54));
  border: 1px solid rgba(132, 196, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.comment-card:hover {
  transform: translateY(-2px);
  border-color: rgba(127, 231, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 18px 34px rgba(0, 0, 0, 0.18);
}

.comment-avatar {
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: rgba(127, 231, 255, 0.08);
  border: 1px solid rgba(127, 231, 255, 0.18);
  font-weight: 900;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.comment-content {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.comment-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.comment-head-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.comment-head strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

.comment-head time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.comment-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: #ffd166;
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.18);
  font-weight: 900;
}

.comment-rating b {
  line-height: 1;
}

.comment-content p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-device {
  display: grid;
  gap: 3px;
  justify-self: start;
  max-width: min(100%, 520px);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(127, 231, 255, 0.06);
  border: 1px solid rgba(127, 231, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.comment-device span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.comment-device strong {
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.35;
}

.comment-device em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.76rem;
  line-height: 1.45;
}

.text-toggle {
  margin-top: 12px;
  padding: 0;
  color: var(--cyan);
  background: transparent;
  border: 0;
  font-weight: 800;
}

.comment-actions,
.comment-edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-actions button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(127, 231, 255, 0.08);
  border: 1px solid rgba(127, 231, 255, 0.16);
  font-weight: 800;
}

.comment-card.is-editing {
  grid-template-columns: 48px minmax(0, 1fr);
}

.comment-edit-form {
  display: grid;
  gap: 12px;
}

.comment-edit-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  resize: vertical;
}

.comments-more,
.auth-toggle {
  justify-self: start;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(127, 231, 255, 0.08);
  border: 1px solid rgba(127, 231, 255, 0.16);
  font-weight: 800;
}

.auth-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: 24px;
  border-radius: 28px;
}

.auth-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.auth-modal-head h2 {
  font-size: 2rem;
}

.auth-modal-head p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-google {
  width: 100%;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.auth-error {
  min-height: 22px;
  color: #ff9f7d;
  font-size: 0.92rem;
}

@media (max-width: 1080px) {
  .games-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 780px) {
  .auth-actions {
    grid-area: auth;
    justify-content: stretch;
  }

  .auth-user-avatar {
    width: 40px;
    height: 40px;
  }

  .auth-button {
    flex: 1;
    min-height: 40px;
  }

  .games-toolbar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

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

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

  .game-detail-hero {
    min-height: 0;
    grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
    padding: 24px;
    gap: 18px;
  }

  .comments-guest {
    grid-template-columns: 1fr;
  }

  .comments-guest .button {
    width: fit-content;
    min-width: 0;
  }

  .comment-device-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .games-panel {
    padding: 14px;
    border-radius: 22px;
  }

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

  .game-card h3 {
    font-size: 0.96rem;
  }

  .game-card-body {
    padding: 12px;
  }

  .auth-modal {
    padding: 10px;
  }

  .game-detail-grid,
  .comments-panel {
    margin: 0;
    padding: 14px;
  }

  .comment-card,
  .comment-card.is-editing {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .comment-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .comment-head-side {
    width: 100%;
    justify-items: start;
  }

  .comment-device {
    max-width: 100%;
  }

  .game-detail-hero {
    border-radius: 24px 24px 0 0;
    grid-template-columns: 1fr;
  }

  .game-detail-copy h2 {
    font-size: clamp(1.7rem, 10vw, 2.5rem);
  }

  .game-detail-cover {
    width: min(58vw, 180px);
  }

  .comments-head {
    margin-bottom: 14px;
  }

  .comments-head p {
    font-size: 0.95rem;
  }

  .comments-guest,
  .comments-empty-card {
    padding: 16px;
    border-radius: 18px;
  }

  .screenshot-strip button {
    flex-basis: 96px;
    height: 56px;
  }

  .comment-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 14px;
  }

  .comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }
}
