:root {
  --bg: #071014;
  --surface: #0d1a20;
  --surface-strong: #13262d;
  --text: #eefcff;
  --muted: #9db4bb;
  --cyan: #31f7ff;
  --green: #b8ff4d;
  --line: rgba(49, 247, 255, 0.22);
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.36);
  --move-hint-brightness: 0.4;
  --move-hint-color-r: 124;
  --move-hint-color-g: 255;
  --move-hint-color-b: 124;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 12%, rgba(49, 247, 255, 0.12), transparent 30%),
    radial-gradient(circle at 80% 28%, rgba(184, 255, 77, 0.1), transparent 28%),
    linear-gradient(135deg, #05090d 0%, var(--bg) 42%, #0a171b 100%);
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 18px;
}

.top-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: clamp(10px, 1.6vw, 24px);
  align-items: center;
  width: 100%;
  min-height: 78px;
  padding: 12px clamp(12px, 2vw, 34px);
  border-bottom: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(5, 12, 15, 0.92);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.top-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 12px);
  width: max-content;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-size: clamp(28px, 2.7vw, 48px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  z-index: 2;
}

.top-brand-mark {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border: 1px solid rgba(49, 247, 255, 0.68);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 24px rgba(49, 247, 255, 0.42);
}

.top-brand span {
  display: block;
  line-height: 1;
  transform: translateY(-1px);
}

.game-search {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(360px, 100%);
  z-index: 1;
}

.game-search input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(49, 247, 255, 0.34);
  background: rgba(8, 18, 23, 0.82);
  color: var(--text);
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  box-shadow: inset 0 0 22px rgba(49, 247, 255, 0.05);
}

.game-search input::placeholder {
  color: rgba(157, 180, 187, 0.82);
}

.game-search input:focus {
  outline: 2px solid rgba(49, 247, 255, 0.44);
  outline-offset: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(6px, 0.8vw, 10px);
  min-width: max-content;
  z-index: 2;
}

.top-menu-wrap {
  position: relative;
}

.top-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(49, 247, 255, 0.32);
  background: rgba(5, 12, 15, 0.78);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.top-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid rgba(49, 247, 255, 0.8);
  background: #ff315f;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 16px rgba(255, 49, 95, 0.42);
}

.top-badge[hidden] {
  display: none;
}

.top-icon:hover,
.top-icon:focus-visible {
  border-color: rgba(49, 247, 255, 0.88);
  background: rgba(49, 247, 255, 0.12);
  box-shadow: 0 0 22px rgba(49, 247, 255, 0.22);
  transform: translateY(-1px);
}

.top-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.top-avatar-button {
  overflow: hidden;
  padding: 2px;
}

.top-avatar-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-popover,
.avatar-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 8px;
  width: 244px;
  padding: 12px;
  border: 1px solid rgba(49, 247, 255, 0.36);
  background: rgba(5, 12, 15, 0.97);
  box-shadow:
    0 24px 58px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(49, 247, 255, 0.12);
}

.top-popover[hidden],
.avatar-dropdown[hidden] {
  display: none;
}

.top-popover::before,
.avatar-dropdown::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 16px;
  width: 12px;
  height: 12px;
  border-left: 1px solid rgba(49, 247, 255, 0.36);
  border-top: 1px solid rgba(49, 247, 255, 0.36);
  background: rgba(5, 12, 15, 0.97);
  transform: rotate(45deg);
}

.quick-dropdown {
  width: 260px;
}

.top-game-invite {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(49, 247, 255, 0.22);
  background: rgba(5, 12, 15, 0.62);
  padding: 10px;
}

.top-game-invite span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.friends-dropdown {
  width: min(380px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 96px));
  overflow-y: auto;
}

.quick-dropdown strong {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-dropdown p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.top-friends-body {
  display: grid;
  gap: 14px;
}

.top-friend-section {
  display: grid;
  gap: 8px;
}

.top-friend-section h3 {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.friend-toggle {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(49, 247, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.dropdown-user {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(49, 247, 255, 0.16);
}

.dropdown-user img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid rgba(49, 247, 255, 0.56);
}

.dropdown-user strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.15;
}

.dropdown-user span {
  display: block;
  margin-top: 3px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dropdown-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(49, 247, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.dropdown-link:hover,
.dropdown-link:focus-visible {
  border-color: rgba(49, 247, 255, 0.72);
  background: rgba(49, 247, 255, 0.1);
}

.site-toast {
  position: fixed;
  right: 24px;
  top: 94px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 16px;
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(5, 12, 15, 0.95);
  color: var(--text);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.42),
    0 0 24px rgba(49, 247, 255, 0.16);
  font-weight: 800;
}

.home-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: start;
  width: min(1180px, calc(100% - 40px));
  margin: 14px auto 20px;
  padding: 16px 20px;
  background: transparent;
}

.site-header-compact {
  padding-bottom: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  text-decoration: none;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(49, 247, 255, 0.72);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 22px rgba(49, 247, 255, 0.46);
}

.profile-card {
  display: grid;
  grid-template-columns: 86px minmax(180px, 1fr);
  gap: 16px;
  width: min(360px, 100%);
  padding: 14px;
  border: 1px solid rgba(49, 247, 255, 0.28);
  background: rgba(5, 12, 15, 0.82);
  box-shadow: 0 0 24px rgba(49, 247, 255, 0.08);
  backdrop-filter: blur(14px);
}

.profile-avatar {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border: 2px solid rgba(49, 247, 255, 0.62);
  box-shadow: 0 0 22px rgba(49, 247, 255, 0.28);
}

.profile-body {
  min-width: 0;
}

.profile-status,
.eyebrow,
.game-kicker {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-body h2 {
  margin: 4px 0 12px;
  font-size: 20px;
  line-height: 1.1;
}

.profile-actions {
  display: grid;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 800;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.profile-button {
  width: 100%;
  font: inherit;
  cursor: pointer;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--cyan);
  color: #031013;
  box-shadow: 0 0 18px rgba(49, 247, 255, 0.32);
}

.button-secondary {
  border-color: rgba(184, 255, 77, 0.45);
  background: rgba(184, 255, 77, 0.08);
  color: var(--text);
}

.button-danger {
  border-color: rgba(255, 82, 119, 0.52);
  background: rgba(255, 82, 119, 0.12);
  color: #ff8ba4;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  align-items: start;
  min-height: 0;
  padding: 0;
}

.hero-copy {
  width: min(620px, 100%);
}

.hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(48px, 6.4vw, 78px);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.45;
}

.games-section {
  padding: 8px 0 56px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: 0;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.game-card {
  overflow: hidden;
  border: 1px solid rgba(49, 247, 255, 0.2);
  background: rgba(13, 26, 32, 0.78);
  box-shadow: var(--shadow);
}

.snake-preview {
  position: relative;
  min-height: 220px;
  background:
    linear-gradient(rgba(49, 247, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 247, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 64% 36%, rgba(184, 255, 77, 0.18), transparent 24%),
    #081116;
  background-size: 28px 28px, 28px 28px, auto, auto;
}

.snake-cell,
.food-cell {
  position: absolute;
  width: 38px;
  height: 38px;
  box-shadow: 0 0 20px currentColor;
}

.snake-cell {
  color: var(--cyan);
  background: var(--cyan);
}

.snake-head {
  color: var(--green);
  background: var(--green);
}

.snake-cell:nth-child(1) {
  left: 120px;
  top: 82px;
}

.snake-cell:nth-child(2) {
  left: 82px;
  top: 82px;
}

.snake-cell:nth-child(3) {
  left: 44px;
  top: 82px;
}

.food-cell {
  right: 54px;
  bottom: 46px;
  color: #ff4fd8;
  background: #ff4fd8;
}

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

.game-card-body h3 {
  margin: 6px 0 10px;
  font-size: 28px;
}

.game-card-body p {
  max-width: 560px;
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.game-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(184, 255, 77, 0.42);
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.registration-page,
.account-page {
  padding: 34px 0 64px;
}

.registration-shell,
.auth-shell,
.account-shell {
  border: 1px solid var(--line);
  background: rgba(13, 26, 32, 0.78);
  box-shadow: var(--shadow);
}

.registration-heading {
  align-items: flex-start;
  padding: 24px 24px 0;
}

.registration-heading h1 {
  margin: 6px 0 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
}

.registration-form {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
  padding: 24px;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 24px;
  padding: 24px;
}

.account-tabs {
  display: flex;
  gap: 8px;
  padding: 20px 24px 0;
}

.account-tab {
  min-height: 38px;
  border: 1px solid rgba(49, 247, 255, 0.28);
  background: rgba(5, 12, 15, 0.54);
  color: var(--muted);
  padding: 8px 14px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.account-tab.is-active {
  border-color: rgba(49, 247, 255, 0.72);
  background: rgba(49, 247, 255, 0.14);
  color: var(--text);
}

.account-panel {
  display: none;
}

.account-panel.is-active {
  display: grid;
}

.applications-panel {
  padding: 24px;
  gap: 14px;
}

.friends-panel {
  padding: 24px;
  gap: 16px;
}

.friends-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.friend-block {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgba(49, 247, 255, 0.22);
  background: rgba(5, 12, 15, 0.42);
  padding: 16px;
}

.friend-block h2,
.game-invite-box h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.friend-list,
.friend-search-result {
  display: grid;
  gap: 10px;
}

.friend-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(49, 247, 255, 0.18);
  background: rgba(13, 26, 32, 0.62);
  padding: 10px;
}

.friend-avatar {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid rgba(49, 247, 255, 0.54);
}

.friend-info {
  min-width: 0;
}

.friend-info strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.friend-info small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.friend-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.friend-status::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #7d8b90;
  box-shadow: 0 0 10px rgba(125, 139, 144, 0.4);
}

.friend-status.is-online::before {
  background: #57ff73;
  box-shadow: 0 0 12px rgba(87, 255, 115, 0.62);
}

.friend-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.friend-action-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.friend-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.friend-search-form input {
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(5, 12, 15, 0.74);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.friend-empty,
.friend-note {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.game-invite-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.62);
}

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

.game-invite-box {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(5, 12, 15, 0.96);
  padding: 18px;
  box-shadow: var(--shadow);
}

.friend-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.applications-table-wrap {
  overflow-x: auto;
}

.applications-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.applications-table th,
.applications-table td {
  border-bottom: 1px solid rgba(49, 247, 255, 0.16);
  padding: 12px;
  text-align: left;
}

.applications-table th {
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
}

.application-actions {
  display: flex;
  gap: 8px;
}

.icon-action {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
}

.icon-action.approve {
  border-color: rgba(87, 255, 115, 0.45);
  color: #57ff73;
}

.icon-action.reject {
  border-color: rgba(255, 82, 119, 0.45);
  color: #ff5277;
}

.icon-action:disabled {
  opacity: 0.35;
  cursor: default;
}

.auth-page {
  display: grid;
  place-items: start center;
  padding: 34px 0 64px;
}

.auth-shell {
  width: min(520px, 100%);
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.auth-form input {
  min-height: 46px;
  width: 100%;
  border: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(5, 12, 15, 0.74);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.auth-form input:focus {
  outline: 2px solid rgba(49, 247, 255, 0.42);
  outline-offset: 2px;
}

.avatar-panel,
.fields-panel {
  min-width: 0;
}

.avatar-canvas {
  display: block;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border: 1px solid rgba(49, 247, 255, 0.34);
  touch-action: none;
  cursor: grab;
}

.avatar-canvas:active {
  cursor: grabbing;
}

.avatar-controls {
  display: grid;
  gap: 14px;
  max-width: 320px;
  margin-top: 14px;
}

.scale-control {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.fields-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.account-fields {
  align-content: start;
}

.fields-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.fields-panel input {
  min-height: 46px;
  width: 100%;
  border: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(5, 12, 15, 0.74);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.fields-panel input:focus {
  outline: 2px solid rgba(49, 247, 255, 0.42);
  outline-offset: 2px;
}

.submit-button,
.form-message {
  grid-column: 1 / -1;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.form-message[data-type="success"] {
  color: var(--green);
}

.form-message[data-type="error"] {
  color: #ff7b9c;
}

.auth-form .form-message[data-type="error"] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  border: 1px solid rgba(255, 82, 119, 0.46);
  background:
    radial-gradient(circle at 0% 50%, rgba(255, 82, 119, 0.18), transparent 42%),
    rgba(35, 8, 16, 0.62);
  padding: 10px 12px;
  color: #ff9ab1;
  box-shadow: 0 0 20px rgba(255, 82, 119, 0.12);
}

.auth-form .form-message[data-type="error"]::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 82, 119, 0.72);
  border-radius: 50%;
  color: #ff9ab1;
  font-weight: 1000;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.game-link {
  width: fit-content;
}

.snake-page-body {
  overflow: hidden;
}

.snake-game-page {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.snake-game-page .top-banner,
.snake-game-page .top-banner * {
  touch-action: manipulation;
}

.snake-game-page .snake-page,
.snake-game-page .snake-layout,
.snake-game-page .snake-board-wrap,
.snake-game-page .snake-field-overlay,
.snake-game-area,
.snake-game-canvas,
#snakeBoard {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.snake-touch-button,
.snake-game-page [data-snake-direction],
.snake-game-page .snake-field-button {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.snake-page {
  width: min(1500px, calc(100% - 32px));
  padding: 28px 0 60px;
}

.snake-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 800px minmax(220px, 1fr);
  gap: 20px;
  align-items: start;
}

.snake-center,
.snake-actions,
.snake-board {
  width: 800px;
}

.snake-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  justify-content: center;
  margin-bottom: 10px;
}

.snake-actions .button {
  min-height: 58px;
  padding: 12px 18px;
  font-size: 18px;
  letter-spacing: 0;
}

.snake-eaten-counter {
  display: grid;
  place-items: center;
  min-height: 38px;
  margin: 0 0 12px;
  border: 1px solid rgba(49, 247, 255, 0.28);
  background: rgba(5, 12, 15, 0.68);
  color: var(--green);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 0 18px rgba(49, 247, 255, 0.12);
}

.snake-board {
  display: block;
  height: 800px;
  border: 2px solid rgba(49, 247, 255, 0.72);
  background: #061014;
  box-shadow:
    0 0 32px rgba(49, 247, 255, 0.2),
    inset 0 0 42px rgba(49, 247, 255, 0.12);
}

.snake-board-wrap {
  position: relative;
  width: 800px;
  height: 800px;
}

.snake-field-overlay {
  position: absolute;
  inset: 2px;
  z-index: 2;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 48%, rgba(49, 247, 255, 0.12), transparent 34%),
    rgba(2, 8, 11, 0.28);
  pointer-events: auto;
}

.snake-field-overlay[hidden] {
  display: none;
}

.snake-field-button {
  display: grid;
  place-items: center;
  min-width: 168px;
  min-height: 112px;
  border: 2px solid rgba(49, 247, 255, 0.86);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(49, 247, 255, 0.18), rgba(184, 255, 77, 0.12)),
    rgba(4, 14, 18, 0.92);
  color: var(--text);
  font: inherit;
  font-size: 30px;
  font-weight: 1000;
  text-align: center;
  cursor: pointer;
  text-shadow:
    0 0 10px rgba(49, 247, 255, 0.88),
    0 0 18px rgba(184, 255, 77, 0.48);
  box-shadow:
    0 0 26px rgba(49, 247, 255, 0.42),
    inset 0 0 24px rgba(49, 247, 255, 0.16);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.snake-field-button:hover {
  border-color: var(--green);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 34px rgba(49, 247, 255, 0.58),
    0 0 28px rgba(184, 255, 77, 0.24),
    inset 0 0 28px rgba(184, 255, 77, 0.16);
}

.snake-start-field-button {
  width: 190px;
  height: 150px;
}

.snake-gameover-overlay {
  background:
    radial-gradient(circle at 50% 44%, rgba(184, 255, 77, 0.16), transparent 30%),
    radial-gradient(circle at 50% 56%, rgba(49, 247, 255, 0.14), transparent 38%),
    rgba(2, 8, 11, 0.48);
}

.snake-gameover-card {
  display: grid;
  justify-items: center;
  gap: 28px;
  padding: 28px;
}

.snake-gameover-title {
  color: var(--text);
  font-size: clamp(58px, 8vw, 86px);
  line-height: 0.95;
  text-align: center;
  text-shadow:
    0 0 14px rgba(49, 247, 255, 0.95),
    0 0 32px rgba(49, 247, 255, 0.5),
    0 0 22px rgba(184, 255, 77, 0.34);
}

.snake-gameover-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
}

.snake-mini-icon {
  position: relative;
  width: 190px;
  height: 150px;
  border: 2px solid rgba(49, 247, 255, 0.72);
  border-radius: 18px;
  background:
    linear-gradient(rgba(49, 247, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 247, 255, 0.08) 1px, transparent 1px),
    rgba(3, 11, 15, 0.78);
  background-size: 22px 22px;
  box-shadow:
    0 0 24px rgba(49, 247, 255, 0.18),
    inset 0 0 20px rgba(49, 247, 255, 0.1);
}

.snake-mini-cell {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--cyan);
  box-shadow: 0 0 15px currentColor;
  color: var(--cyan);
}

.snake-mini-food {
  left: 20px;
  top: 48px;
  background: #ffe74a;
  color: #ffe74a;
}

.snake-mini-1 {
  left: 56px;
  top: 48px;
}

.snake-mini-2 {
  left: 82px;
  top: 48px;
}

.snake-mini-3 {
  left: 108px;
  top: 48px;
}

.snake-mini-4 {
  left: 134px;
  top: 48px;
  background: var(--green);
  color: var(--green);
}

.snake-mini-5 {
  left: 134px;
  top: 76px;
  background: var(--green);
  color: var(--green);
}

.snake-mini-6 {
  left: 156px;
  top: 76px;
  background: var(--green);
  color: var(--green);
}

.snake-retry-button {
  width: 190px;
  height: 150px;
  min-width: 190px;
  min-height: 150px;
  font-size: 28px;
}

.snake-message {
  display: none;
}

.snake-side {
  display: grid;
  gap: 10px;
  min-height: 0;
  align-content: start;
}

.snake-info-block {
  border: 1px solid rgba(49, 247, 255, 0.2);
  background: rgba(13, 26, 32, 0.78);
  padding: 11px 12px;
  box-shadow: var(--shadow);
}

.snake-info-block h2 {
  margin: 4px 0 8px;
  font-size: 20px;
  line-height: 1.15;
}

.snake-info-block strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 29px;
}

.snake-top-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.snake-top-list li {
  color: var(--muted);
}

.snake-top-list li::marker {
  color: var(--green);
  font-weight: 900;
}

.snake-top-list li span {
  display: inline-block;
  min-width: 110px;
  color: var(--text);
  font-weight: 800;
}

.snake-top-list li strong {
  display: inline;
  margin: 0;
  color: var(--green);
  font-size: 16px;
}

.snake-player {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  align-items: center;
}

.snake-player img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border: 1px solid rgba(49, 247, 255, 0.62);
}

.snake-player h2 {
  margin: 0;
  font-size: 20px;
  word-break: break-word;
}

.tablet-controls {
  display: none;
  align-self: end;
  gap: 16px;
  margin-top: auto;
}

.tablet-left {
  grid-template-columns: repeat(2, 72px);
  justify-content: center;
}

.tablet-right {
  justify-content: center;
}

.round-control {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid rgba(49, 247, 255, 0.72);
  border-radius: 50%;
  background: rgba(49, 247, 255, 0.12);
  color: var(--text);
  font: inherit;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 0 22px rgba(49, 247, 255, 0.22);
}

.home-snake-section {
  display: grid;
  justify-items: center;
  min-height: 620px;
  width: 100vw;
  margin-left: calc((100% - 100vw) / 2);
  padding: 56px 0 70px;
  background: transparent;
}

.games-empty {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.is-hidden {
  display: none !important;
}

.games-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  max-width: min(1240px, calc(100vw - 40px));
  margin: 0 auto;
  overflow: visible;
}

.games-row [data-game-card] {
  order: 1;
}

.games-row [data-placeholder-card] {
  order: 2;
}

.games-row.is-filtering {
  justify-content: center;
}

.game-placeholder {
  display: grid;
  flex: 0 0 400px;
  place-items: center;
  width: 400px;
  min-height: 472px;
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(5, 12, 15, 0.24);
  color: var(--muted);
  text-align: center;
  font-size: 18px;
  font-weight: 800;
}

.snake-tile {
  position: relative;
  display: grid;
  flex: 0 0 400px;
  width: 400px;
  max-width: 100%;
  box-sizing: border-box;
  gap: 2px;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(5, 12, 15, 0.78);
  box-shadow:
    0 20px 55px rgba(0, 0, 0, 0.38),
    0 0 24px rgba(49, 247, 255, 0.1);
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.game-mode-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 64px;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid rgba(184, 255, 77, 0.72);
  background: rgba(5, 12, 15, 0.82);
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(184, 255, 77, 0.22);
}

.snake-tile:hover {
  border-color: rgba(49, 247, 255, 0.9);
  box-shadow:
    0 22px 62px rgba(0, 0, 0, 0.44),
    0 0 34px rgba(49, 247, 255, 0.36);
  transform: translateY(-2px);
}

.snake-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
}

.chess-tile img {
  object-position: center;
}

.checkers-tile img,
.battleship-tile img {
  background: #06131a;
}

.snake-tile-label {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 62px;
  padding: 8px 12px;
  border-top: 1px solid rgba(49, 247, 255, 0.32);
  background: rgba(3, 10, 13, 0.92);
  text-align: center;
}

.snake-tile-label strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.top-active-game {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: 4px;
  border: 1px solid rgba(184, 255, 77, 0.72);
  background: rgba(5, 12, 15, 0.82);
  color: var(--lime);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 0 18px rgba(184, 255, 77, 0.2);
}

.game-stub-page {
  display: grid;
  place-items: center;
  width: min(100% - 32px, 1100px);
  min-height: calc(100dvh - 84px);
  padding: 38px 0;
}

.game-stub-card {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(49, 247, 255, 0.36);
  background: rgba(3, 10, 13, 0.78);
  box-shadow: var(--shadow);
  padding: 24px;
}

.game-stub-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(49, 247, 255, 0.36);
}

.game-stub-card h1 {
  margin: 8px 0 12px;
  color: var(--text);
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.95;
}

.game-stub-card p:not(.eyebrow) {
  max-width: 560px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .game-stub-card {
    grid-template-columns: 1fr;
  }
}

.chess-page {
  width: min(100% - 24px, 1320px);
  padding: 18px 0 28px;
}

.chess-page.is-game-view {
  width: calc(100% - 16px);
  padding: 8px 0 12px;
}

.chess-shell {
  display: grid;
  gap: 18px;
  border: 1px solid rgba(49, 247, 255, 0.28);
  background: rgba(13, 26, 32, 0.78);
  box-shadow: var(--shadow);
  padding: 18px;
}

.chess-page.is-game-view .chess-shell {
  gap: 8px;
  padding: 8px;
}

.chess-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.chess-hero img {
  width: 220px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(49, 247, 255, 0.36);
  box-shadow: 0 0 24px rgba(49, 247, 255, 0.16);
}

.chess-hero h1 {
  margin: 4px 0 10px;
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.95;
}

.chess-hero p:not(.eyebrow),
.chess-panel p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.chess-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.chess-mode-card {
  display: grid;
  gap: 8px;
  min-height: 120px;
  border: 1px solid rgba(49, 247, 255, 0.38);
  background: rgba(5, 12, 15, 0.74);
  color: var(--text);
  padding: 18px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 22px rgba(49, 247, 255, 0.08);
}

.chess-mode-card:hover {
  border-color: rgba(49, 247, 255, 0.86);
  box-shadow:
    0 0 28px rgba(49, 247, 255, 0.2),
    inset 0 0 22px rgba(49, 247, 255, 0.12);
}

.chess-mode-card span {
  font-size: 26px;
  font-weight: 1000;
}

.chess-mode-card small {
  color: var(--muted);
  font-weight: 800;
}

.chess-panel {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(184, 255, 77, 0.28);
  background: rgba(5, 12, 15, 0.58);
  padding: 18px;
}

.chess-panel[hidden] {
  display: none;
}

.chess-panel h2 {
  margin: 0;
}

.chess-side-title {
  color: var(--text);
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
  text-align: center;
  text-shadow:
    0 0 16px rgba(255, 255, 255, 0.18),
    0 0 26px rgba(49, 247, 255, 0.18);
}

.chess-color-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  padding: 22px 0 10px;
}

.chess-side-button {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  align-items: center;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 20px;
  padding: 18px 16px 20px;
  font: inherit;
  cursor: pointer;
  opacity: 1;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.chess-side-button:hover,
.chess-side-button:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.chess-side-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
  filter: grayscale(0.55);
  transform: none;
  box-shadow: none;
}

.chess-side-button:disabled:hover,
.chess-side-button:disabled:focus-visible {
  transform: none;
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: none;
}

.chess-side-button.is-active {
  border-color: var(--cyan);
  box-shadow:
    0 0 0 3px rgba(49, 247, 255, 0.24),
    0 0 34px rgba(49, 247, 255, 0.38);
}

.chess-side-white {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.12), transparent 38%),
    #030608;
  color: #fff6dc;
}

.chess-side-black {
  border-color: rgba(0, 0, 0, 0.7);
  background:
    radial-gradient(circle at 50% 28%, rgba(0, 0, 0, 0.08), transparent 38%),
    #f5f3ec;
  color: #0b0908;
}

.chess-side-piece {
  display: block;
  font-size: 82px;
  line-height: 1;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  text-shadow: 0 5px 16px rgba(0, 0, 0, 0.34);
}

.chess-side-black .chess-side-piece {
  text-shadow: 0 5px 16px rgba(0, 0, 0, 0.24);
}

.chess-side-text {
  display: block;
  font-size: 26px;
  font-weight: 1000;
  line-height: 1.12;
  text-align: center;
}

.chess-time-setup {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding-top: 12px;
}

.chess-time-setup h3 {
  margin: 0;
  color: var(--green);
  font-size: 20px;
  text-align: center;
}

.chess-time-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.chess-time-actions button {
  min-width: 86px;
  min-height: 44px;
  border: 1px solid rgba(49, 247, 255, 0.34);
  border-radius: 12px;
  background: rgba(5, 12, 15, 0.7);
  color: var(--text);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.chess-time-actions button:hover,
.chess-time-actions button:focus-visible,
.chess-time-actions button.is-active {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(49, 247, 255, 0.26);
  transform: translateY(-1px);
  outline: none;
}

.chess-game-panel {
  position: relative;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(49, 247, 255, 0.3);
  background: rgba(3, 10, 13, 0.7);
  padding: 14px;
}

.chess-page.is-game-view .chess-game-panel {
  gap: 8px;
  padding: 8px;
}

.chess-game-panel[hidden] {
  display: none;
}

.chess-game-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.chess-game-head h2 {
  margin: 0;
  font-size: 30px;
}

.chess-page.is-game-view .chess-game-head h2 {
  font-size: 24px;
}

.chess-game-head strong {
  color: var(--green);
  font-size: 18px;
}

.chess-game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.chess-game-actions .button {
  min-height: 36px;
}

.chess-page.is-game-view .chess-game-actions .button {
  min-height: 32px;
  padding: 6px 12px;
}

.chess-player-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.chess-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  border: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(5, 12, 15, 0.64);
  padding: 2px 8px 4px;
}

.chess-page.is-game-view .chess-player-bar {
  min-height: 36px;
  padding: 6px 10px;
}

.chess-player-bar span {
  color: var(--muted);
  font-weight: 900;
}

.chess-player-bar strong {
  color: var(--text);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.chess-player-bar.is-active {
  border-color: rgba(184, 255, 77, 0.62);
  box-shadow: 0 0 20px rgba(184, 255, 77, 0.16);
}

.chess-ready-overlay,
.chess-rematch-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 44%, rgba(49, 247, 255, 0.12), transparent 34%),
    rgba(3, 10, 13, 0.86);
}

.chess-ready-overlay[hidden],
.chess-rematch-overlay[hidden] {
  display: none;
}

.chess-countdown {
  display: grid;
  place-items: center;
  width: 220px;
  height: 180px;
  border: 2px solid rgba(49, 247, 255, 0.78);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 30%, rgba(184, 255, 77, 0.16), transparent 42%),
    rgba(5, 12, 15, 0.94);
  color: var(--text);
  font: inherit;
  font-size: 38px;
  font-weight: 1000;
  cursor: pointer;
  box-shadow:
    0 0 36px rgba(49, 247, 255, 0.28),
    inset 0 0 24px rgba(49, 247, 255, 0.12);
}

.chess-countdown {
  cursor: default;
  font-size: 66px;
}

.chess-rematch-window {
  display: grid;
  gap: 20px;
  place-items: center;
  width: min(520px, 92%);
  min-height: 230px;
  border: 2px solid rgba(49, 247, 255, 0.78);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 30%, rgba(184, 255, 77, 0.18), transparent 42%),
    rgba(4, 12, 18, 0.92);
  box-shadow:
    0 0 34px rgba(49, 247, 255, 0.22),
    inset 0 0 28px rgba(49, 247, 255, 0.1);
  padding: 28px;
}

.chess-rematch-window h3 {
  margin: 0;
  color: var(--text);
  font-size: clamp(42px, 6vw, 78px);
  line-height: 1;
  text-align: center;
  text-shadow:
    0 0 18px rgba(49, 247, 255, 0.36),
    0 0 28px rgba(184, 255, 77, 0.16);
}

.chess-rematch-window p {
  margin: -6px 0 0;
  color: var(--lime);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 1000;
  text-align: center;
}

.chess-rematch-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: min(340px, 100%);
}

.chess-board-layout {
  display: grid;
  grid-template-columns: calc(var(--board-size, 800px) + var(--coord-size, 28px)) minmax(240px, 320px);
  gap: 18px;
  align-items: start;
  justify-content: center;
  overflow: visible;
}

.chess-board-frame {
  --board-size: 800px;
  --cell-size: calc(var(--board-size) / 8);
  --coord-size: clamp(20px, calc(var(--cell-size) * 0.28), 30px);
  display: grid;
  grid-template-columns: var(--coord-size) var(--board-size);
  grid-template-rows: var(--board-size) var(--coord-size);
  width: calc(var(--board-size) + var(--coord-size));
  height: calc(var(--board-size) + var(--coord-size));
}

.chess-rank-labels {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
  color: var(--green);
  font-size: clamp(12px, calc(var(--cell-size) * 0.2), 18px);
  font-weight: 1000;
}

.chess-file-labels {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
  color: var(--green);
  font-size: clamp(12px, calc(var(--cell-size) * 0.2), 18px);
  font-weight: 1000;
  letter-spacing: 0;
}

.chess-board {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 0;
  width: var(--board-size);
  height: var(--board-size);
  min-width: var(--board-size);
  min-height: var(--board-size);
  max-width: var(--board-size);
  max-height: var(--board-size);
  border: 0;
  outline: 2px solid rgba(49, 247, 255, 0.7);
  box-sizing: border-box;
  box-shadow:
    0 0 34px rgba(49, 247, 255, 0.2),
    inset 0 0 38px rgba(49, 247, 255, 0.1);
}

.chess-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cell-size);
  height: var(--cell-size);
  min-width: var(--cell-size);
  min-height: var(--cell-size);
  max-width: var(--cell-size);
  max-height: var(--cell-size);
  box-sizing: border-box;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: calc(var(--cell-size) * 0.82);
  line-height: var(--cell-size);
  text-align: center;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  cursor: pointer;
}

.chess-square.is-selected {
  box-shadow:
    inset 0 0 0 5px rgba(184, 255, 77, 0.86),
    inset 0 0 28px rgba(184, 255, 77, 0.32);
}

.chess-square.is-legal-target::after,
.chess-square.is-capture-target::after {
  content: "";
  position: absolute;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(49, 247, 255, 0.86);
  box-shadow:
    0 0 12px rgba(49, 247, 255, 0.95),
    0 0 26px rgba(49, 247, 255, 0.42);
}

.chess-square.is-capture-target::after {
  width: 68%;
  box-sizing: border-box;
  border: 5px solid rgba(184, 255, 77, 0.78);
  background: transparent;
  box-shadow:
    0 0 16px rgba(184, 255, 77, 0.72),
    inset 0 0 16px rgba(184, 255, 77, 0.22);
}

.chess-square.is-legal-cell-target {
  box-shadow:
    inset 0 0 0 calc(var(--cell-size) * 0.045) rgba(var(--move-hint-color-r), var(--move-hint-color-g), var(--move-hint-color-b), calc(var(--move-hint-brightness, 0.4) * 0.58)),
    inset 0 0 calc(var(--cell-size) * 0.34) rgba(var(--move-hint-color-r), var(--move-hint-color-g), var(--move-hint-color-b), calc(var(--move-hint-brightness, 0.4) * 0.34));
}

.chess-square.is-capture-cell-target {
  box-shadow:
    inset 0 0 0 calc(var(--cell-size) * 0.075) rgba(255, 92, 60, 0.74),
    inset 0 0 0 calc(var(--cell-size) * 0.045) rgba(var(--move-hint-color-r), var(--move-hint-color-g), var(--move-hint-color-b), calc(var(--move-hint-brightness, 0.4) * 0.58)),
    inset 0 0 calc(var(--cell-size) * 0.34) rgba(var(--move-hint-color-r), var(--move-hint-color-g), var(--move-hint-color-b), calc(var(--move-hint-brightness, 0.4) * 0.34)),
    0 0 calc(var(--cell-size) * 0.12) rgba(255, 174, 64, calc(var(--move-hint-brightness, 0.4) * 0.28));
}

.chess-square.is-check-king {
  box-shadow:
    inset 0 0 0 5px rgba(255, 72, 105, 0.92),
    inset 0 0 34px rgba(255, 72, 105, 0.36),
    0 0 18px rgba(255, 72, 105, 0.42);
}

.chess-square.is-check-attacker {
  box-shadow:
    inset 0 0 0 4px rgba(255, 220, 95, 0.88),
    inset 0 0 26px rgba(255, 220, 95, 0.26);
}

.chess-square.is-check-path-dot::before {
  content: "";
  position: absolute;
  width: 18%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.76),
    0 0 18px rgba(49, 247, 255, 0.35);
  pointer-events: none;
}

.chess-square.is-check-path-cell {
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.64),
    inset 0 0 24px rgba(49, 247, 255, 0.22);
}

.chess-square.is-light {
  background: #d8bd8a;
}

.chess-square.is-dark {
  background: #5e341e;
}

.chess-square.is-white-piece {
  color: #f9f0d2;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  text-shadow:
    0 0 1px #fff7dc,
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.chess-square.is-black-piece {
  color: #120806;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  text-shadow:
    0 0 1px #000,
    0 1px 8px rgba(255, 255, 255, 0.22);
}

.chess-square.is-animation-source {
  color: transparent !important;
  text-shadow: none !important;
}

.chess-moving-piece {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  transition: transform 250ms ease-in-out;
  will-change: transform;
}

body.is-chess-game-view,
body.chess-game-page {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.is-chess-game-view .chess-page {
  height: calc(100dvh - 58px);
  overflow: hidden;
}

body.is-chess-game-view .chess-shell,
body.is-chess-game-view .chess-game-panel {
  height: 100%;
  overflow: hidden;
}

.chess-hero {
  display: none;
}

.chess-moving-piece.is-white-piece {
  color: #f9f0d2;
  text-shadow:
    0 0 1px #fff7dc,
    0 2px 8px rgba(0, 0, 0, 0.55);
}

.chess-moving-piece.is-black-piece {
  color: #120806;
  text-shadow:
    0 0 1px #000,
    0 1px 8px rgba(255, 255, 255, 0.22);
}

.chess-moves-panel {
  min-height: 240px;
  height: calc(var(--board-size, 800px) + var(--coord-size, 28px));
  overflow: auto;
  border: 1px solid rgba(184, 255, 77, 0.24);
  background: rgba(5, 12, 15, 0.62);
  padding: 14px;
}

.chess-moves-panel h3 {
  margin: 0 0 12px;
}

.chess-moves-panel ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-weight: 800;
}

.chess-friends-list {
  display: grid;
  gap: 10px;
}

.chess-friend-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(49, 247, 255, 0.22);
  background: rgba(5, 12, 15, 0.6);
  padding: 10px;
}

.is-chess-game-view .top-banner {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  width: 100%;
  min-height: 78px;
  padding: 12px clamp(12px, 2vw, 34px);
  border-bottom: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(5, 12, 15, 0.92);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.is-chess-game-view .top-brand {
  justify-self: start;
}

.is-chess-game-view .top-brand span,
.is-chess-game-view .game-search {
  display: flex;
}

.is-chess-game-view .top-brand-mark,
.is-chess-game-view .top-icon {
  width: 44px;
  height: 44px;
}

.is-chess-game-view .top-actions {
  gap: 10px;
  justify-self: end;
}

.is-chess-game-view .top-popover,
.is-chess-game-view .avatar-dropdown {
  right: 0;
  left: auto;
  transform: none;
}

.chess-page.is-game-view {
  width: 100%;
  max-width: none;
  margin: 0;
  height: calc(100dvh - 78px);
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  overflow: hidden;
}

.chess-page.is-game-view .chess-shell {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  border-color: rgba(0, 0, 0, 0.72);
  background: rgba(2, 5, 8, 0.88);
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.44);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.chess-page.is-game-view .chess-game-panel {
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  max-width: 100%;
  overflow: hidden;
}

.chess-page.is-game-view #chessStatus,
.chess-page.is-game-view .chess-game-head {
  display: none;
}

.chess-page.is-game-view .chess-board-layout {
  --side-panel-width: 320px;
  grid-template-columns:
    var(--side-panel-width)
    calc(var(--board-size, 800px) + var(--coord-size, 28px) + 28px)
    var(--side-panel-width);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  justify-content: center;
  min-height: calc(var(--board-size, 800px) + var(--coord-size, 28px) + 28px);
  height: min(100%, calc(var(--board-size, 800px) + var(--coord-size, 28px) + 28px));
  max-height: 100%;
  overflow: hidden;
}

.chess-page.is-game-view .chess-board-frame {
  grid-column: 2;
  grid-row: 1 / 5;
}

.chess-page.is-game-view .chess-board-frame {
  --coord-size: clamp(20px, calc(var(--cell-size) * 0.24), 28px);
  box-sizing: content-box;
  padding: 12px;
  border: 2px solid #2a1207;
  background:
    linear-gradient(135deg, rgba(255, 174, 77, 0.22), rgba(65, 24, 5, 0.28)),
    repeating-linear-gradient(90deg, #6b2c0c 0 14px, #9a4c17 14px 26px, #4a1b08 26px 38px);
  box-shadow:
    inset 0 0 0 7px rgba(62, 24, 5, 0.9),
    inset 0 0 0 12px rgba(189, 94, 26, 0.44),
    0 0 0 1px rgba(255, 202, 126, 0.35),
    0 20px 46px rgba(0, 0, 0, 0.7);
}

.chess-page.is-game-view .chess-rank-labels,
.chess-page.is-game-view .chess-file-labels {
  color: #ffe2a0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, calc(var(--cell-size) * 0.25), 27px);
  text-shadow:
    0 1px 0 #2a1105,
    0 0 7px rgba(255, 226, 160, 0.62);
}

.chess-page.is-game-view .chess-board {
  outline: 3px solid #3b1808;
  box-shadow:
    inset 0 0 0 2px rgba(255, 216, 149, 0.34),
    0 0 0 1px rgba(0, 0, 0, 0.65);
}

.chess-page.is-game-view .chess-square {
  font-family: Georgia, "Times New Roman", serif;
  font-size: calc(var(--cell-size) * 0.76);
}

.chess-page.is-game-view .chess-square.is-light {
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 231, 178, 0.34), transparent 38%),
    linear-gradient(135deg, #f2b36a, #cf782c 48%, #f5c080);
}

.chess-page.is-game-view .chess-square.is-dark {
  background:
    radial-gradient(circle at 42% 22%, rgba(208, 111, 34, 0.3), transparent 38%),
    linear-gradient(135deg, #8b3a0d, #5a2107 52%, #9a4512);
}

.chess-page.is-game-view .chess-square.is-white-piece,
.chess-page.is-game-view .chess-moving-piece.is-white-piece {
  color: #fff1c7;
  text-shadow:
    0 2px 0 #7a4a1d,
    0 4px 8px rgba(35, 13, 3, 0.8),
    0 0 9px rgba(255, 241, 199, 0.55);
}

.chess-page.is-game-view .chess-square.is-black-piece,
.chess-page.is-game-view .chess-moving-piece.is-black-piece {
  color: #18110c;
  text-shadow:
    0 1px 0 #6b4c34,
    0 4px 8px rgba(0, 0, 0, 0.84),
    0 0 5px rgba(255, 223, 168, 0.25);
}

.chess-side-panel {
  display: contents;
}

.chess-page.is-game-view .chess-player-bars {
  display: contents;
}

.chess-page.is-game-view .chess-opponent-bar {
  grid-column: 1;
  grid-row: 1;
}

.chess-page.is-game-view .chess-ai-panel-actions {
  grid-column: 1;
  grid-row: 2;
}

.chess-page.is-game-view .chess-ai-thought {
  grid-column: 1;
  grid-row: 3 / 5;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  max-height: none;
  box-sizing: border-box;
  overflow: hidden;
}

.chess-page.is-game-view .chess-user-bar {
  grid-column: 3;
  grid-row: 1;
}

.chess-page.is-game-view .chess-captured-panel {
  grid-column: 3;
  grid-row: 2;
}

.chess-page.is-game-view .chess-moves-panel {
  grid-column: 3;
  grid-row: 3;
}

.chess-page.is-game-view .chess-game-actions {
  grid-column: 3;
  grid-row: 4;
}

.chess-ai-thought {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  min-width: 0;
  gap: 8px;
  min-height: 82px;
  max-height: 104px;
  padding: 12px 14px;
  border: 1px solid rgba(184, 255, 77, 0.42);
  background:
    radial-gradient(circle at 18% 0%, rgba(184, 255, 77, 0.16), transparent 42%),
    rgba(2, 10, 13, 0.84);
  box-shadow: 0 0 18px rgba(184, 255, 77, 0.12);
  overflow-x: hidden;
}

.chess-ai-thought[hidden] {
  display: none;
}

.chess-ai-thought-label {
  color: var(--lime);
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
}

.chess-ai-thought-log {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 255, 77, 0.72) rgba(2, 10, 13, 0.72);
}

.chess-ai-thought-log::-webkit-scrollbar {
  width: 6px;
}

.chess-ai-thought-log::-webkit-scrollbar-thumb {
  background: rgba(184, 255, 77, 0.72);
}

.chess-ai-thought-log p {
  margin: 0;
  max-width: 100%;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  animation: aiThoughtRise 180ms ease-out both;
}

.chess-ai-panel-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.chess-ai-panel-button,
.chess-ai-settings-button {
  display: grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid rgba(184, 255, 77, 0.54);
  background: rgba(2, 12, 20, 0.92);
  color: var(--lime);
  font-size: 19px;
  font-weight: 1000;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 0 0 16px rgba(184, 255, 77, 0.08),
    0 0 14px rgba(184, 255, 77, 0.08);
}

.chess-ai-panel-button:hover,
.chess-ai-panel-button:focus-visible,
.chess-ai-settings-button:hover,
.chess-ai-settings-button:focus-visible {
  border-color: rgba(184, 255, 77, 0.95);
  outline: none;
  box-shadow:
    inset 0 0 18px rgba(184, 255, 77, 0.16),
    0 0 18px rgba(184, 255, 77, 0.18);
}

.chess-captured-panel {
  display: grid;
  gap: 6px;
  min-height: 0;
  border: 1px solid rgba(0, 214, 224, 0.34);
  background: rgba(2, 8, 14, 0.84);
  padding: 8px 10px;
  overflow: hidden;
}

.chess-captured-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.chess-captured-row strong {
  min-width: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
}

@keyframes aiThoughtRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chess-page.is-game-view .chess-player-bar {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 84px;
  border: 1px solid rgba(0, 214, 224, 0.38);
  background:
    linear-gradient(90deg, rgba(0, 187, 202, 0.08), rgba(1, 10, 17, 0.86)),
    rgba(3, 10, 15, 0.94);
  padding: 8px 12px;
  box-shadow:
    inset 0 0 28px rgba(0, 214, 224, 0.07),
    0 0 18px rgba(0, 214, 224, 0.08);
}

.chess-player-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 2px solid rgba(0, 225, 214, 0.75);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 225, 214, 0.22), rgba(4, 18, 24, 0.95));
  color: #dff9ff;
  font-size: 30px;
  box-shadow: 0 0 22px rgba(0, 225, 214, 0.22);
}

.chess-player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chess-player-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.chess-player-info span:not(.chess-player-role) {
  color: var(--text);
  font-size: 18px;
  font-weight: 1000;
  overflow-wrap: anywhere;
}

.chess-player-role {
  color: var(--cyan);
  font-size: 13px;
  font-weight: 1000;
}

.chess-player-info small {
  color: var(--muted);
  font-weight: 900;
}

.chess-player-info small::first-letter {
  color: #15e95f;
}

.chess-page.is-game-view .chess-player-bar strong {
  color: #fff;
  font-size: 28px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.18);
}

.chess-page.is-game-view .chess-moves-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(0, 214, 224, 0.38);
  background: rgba(2, 8, 14, 0.92);
  padding: 14px;
  overflow: hidden;
}

.chess-page.is-game-view .chess-moves-panel h3 {
  color: var(--text);
  font-size: 18px;
}

.chess-page.is-game-view .chess-moves-panel ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  background: rgba(1, 6, 12, 0.72);
  color: #dfeefa;
  font-size: 16px;
  list-style: none;
}

.chess-page.is-game-view .chess-moves-panel li {
  padding: 0;
}

.chess-page.is-game-view .chess-moves-panel li:nth-child(odd) button {
  background: rgba(255, 255, 255, 0.12);
}

.chess-page.is-game-view .chess-moves-panel li.is-active button {
  border-color: rgba(184, 255, 77, 0.82);
  background:
    linear-gradient(90deg, rgba(184, 255, 77, 0.22), rgba(49, 247, 255, 0.08)),
    rgba(5, 14, 18, 0.95);
  color: #ffffff;
  box-shadow:
    inset 0 0 18px rgba(184, 255, 77, 0.12),
    0 0 14px rgba(184, 255, 77, 0.1);
}

.chess-page.is-game-view .chess-moves-panel button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(49, 247, 255, 0.18);
  background: rgba(1, 8, 13, 0.72);
  color: inherit;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
}

.chess-page.is-game-view .chess-moves-panel button:hover,
.chess-page.is-game-view .chess-moves-panel button:focus-visible {
  border-color: rgba(49, 247, 255, 0.62);
  outline: none;
}

.chess-page.is-game-view .chess-moves-panel button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chess-page.is-game-view .chess-game-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chess-page.is-game-view .chess-game-actions .button,
.chess-replay-actions button {
  min-height: 38px;
  border: 1px solid rgba(0, 214, 224, 0.55);
  border-radius: 0;
  background: rgba(2, 12, 20, 0.92);
  color: var(--text);
  box-shadow: inset 0 0 16px rgba(0, 214, 224, 0.06);
}

.chess-page.is-game-view .chess-game-actions .button-danger {
  border-color: rgba(255, 67, 136, 0.62);
  color: #ff84b5;
}

.chess-ai-tools,
.chess-replay-actions {
  grid-column: 1 / -1;
}

.chess-ai-tools {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.chess-ai-tools .chess-ai-settings-button {
  min-height: 38px;
  font-size: 15px;
}

.chess-sound-toggle,
.chess-analysis-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 38px;
  min-width: 42px;
  border: 1px solid rgba(184, 255, 77, 0.62);
  border-radius: 0;
  background: rgba(2, 12, 20, 0.92);
  color: var(--lime);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 0 0 16px rgba(184, 255, 77, 0.08),
    0 0 14px rgba(184, 255, 77, 0.08);
}

.chess-sound-toggle:hover,
.chess-sound-toggle:focus-visible,
.chess-analysis-button:hover,
.chess-analysis-button:focus-visible {
  border-color: rgba(184, 255, 77, 0.95);
  outline: none;
  box-shadow:
    inset 0 0 18px rgba(184, 255, 77, 0.16),
    0 0 18px rgba(184, 255, 77, 0.18);
}

.chess-analysis-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 6, 9, 0.72);
  backdrop-filter: blur(2px);
}

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

.chess-analysis-window {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(1120px, 100%);
  max-height: min(780px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid rgba(184, 255, 77, 0.46);
  background:
    radial-gradient(circle at 10% 0%, rgba(184, 255, 77, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(2, 12, 17, 0.98), rgba(0, 5, 9, 0.98));
  padding: 20px;
  box-shadow:
    0 0 36px rgba(184, 255, 77, 0.16),
    0 22px 70px rgba(0, 0, 0, 0.52);
}

.chess-analysis-window h3 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
}

.chess-analysis-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(1, 10, 16, 0.94);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.chess-analysis-content {
  display: grid;
  gap: 10px;
  max-height: min(660px, calc(100vh - 190px));
  overflow: hidden;
}

.chess-analysis-layout {
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(170px, 220px) minmax(260px, 1fr);
  gap: 14px;
  min-height: 0;
  height: min(660px, calc(100vh - 190px));
}

.chess-analysis-board-panel,
.chess-analysis-moves-panel,
.chess-analysis-comments-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.chess-analysis-board-panel h4,
.chess-analysis-moves-panel h4,
.chess-analysis-comments-panel h4 {
  margin: 0;
  border: 1px solid rgba(184, 255, 77, 0.38);
  background:
    linear-gradient(90deg, rgba(184, 255, 77, 0.14), rgba(1, 8, 13, 0.72)),
    rgba(1, 8, 13, 0.86);
  color: var(--lime);
  padding: 9px 10px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chess-analysis-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  width: min(100%, 430px);
  aspect-ratio: 1;
  border: 4px solid #5d2a0c;
  background: #4b1d07;
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.chess-analysis-square {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 4vw, 44px);
  line-height: 1;
}

.chess-analysis-square.is-move-from,
.chess-analysis-square.is-move-to {
  z-index: 1;
}

.chess-analysis-square.is-move-trail::after {
  content: "";
  position: absolute;
  inset: 31%;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.26);
  pointer-events: none;
}

.chess-analysis-square.is-move-from {
  box-shadow:
    inset 0 0 0 3px rgba(255, 237, 160, 0.62),
    inset 0 0 18px rgba(255, 213, 79, 0.22);
}

.chess-analysis-square.is-move-to {
  box-shadow:
    inset 0 0 0 4px rgba(49, 247, 255, 0.78),
    inset 0 0 26px rgba(49, 247, 255, 0.3),
    0 0 14px rgba(49, 247, 255, 0.16);
}

.chess-analysis-arrow {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  pointer-events: none;
}

.chess-analysis-arrow line {
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 2.1;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.32));
}

.chess-analysis-arrow path {
  fill: rgba(255, 255, 255, 0.96);
}

.chess-analysis-square.is-light {
  background: linear-gradient(135deg, #f2b36a, #cf782c 48%, #f5c080);
}

.chess-analysis-square.is-dark {
  background: linear-gradient(135deg, #8b3a0d, #5a2107 52%, #9a4512);
}

.chess-analysis-square.is-white-piece {
  color: #fff1c7;
  text-shadow: 0 2px 0 #7a4a1d, 0 4px 8px rgba(35, 13, 3, 0.8);
}

.chess-analysis-square.is-black-piece {
  color: #18110c;
  text-shadow: 0 1px 0 #6b4c34, 0 4px 8px rgba(0, 0, 0, 0.84);
}

.chess-analysis-moves {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.chess-analysis-move {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  border: 1px solid rgba(49, 247, 255, 0.22);
  background: rgba(1, 8, 13, 0.72);
  color: var(--text);
  padding: 7px 8px;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.chess-analysis-move strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chess-analysis-move.is-active,
.chess-analysis-move:hover {
  border-color: rgba(184, 255, 77, 0.72);
  box-shadow: inset 0 0 14px rgba(184, 255, 77, 0.1);
}

.chess-analysis-chat {
  border: 1px solid rgba(184, 255, 77, 0.28);
  background: rgba(1, 8, 13, 0.78);
  padding: 12px;
  min-width: 0;
  overflow-x: hidden;
}

.chess-analysis-comments-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow-x: hidden;
}

.chess-analysis-sections {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.chess-analysis-chat strong {
  display: block;
  color: var(--lime);
  margin-bottom: 6px;
}

.chess-analysis-chat p,
.chess-analysis-empty {
  margin: 0;
  max-width: 100%;
  color: var(--text);
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .chess-analysis-layout {
    grid-template-columns: 1fr;
  }
}

.chess-analysis-section {
  border: 1px solid rgba(49, 247, 255, 0.2);
  background: rgba(1, 8, 13, 0.72);
  padding: 12px;
}

.chess-analysis-section strong {
  display: block;
  color: var(--lime);
  margin-bottom: 5px;
}

.chess-analysis-section p {
  margin: 0;
  max-width: 100%;
  color: var(--text);
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chess-journal-modal {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 6, 9, 0.72);
  backdrop-filter: blur(2px);
}

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

.chess-journal-window {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
  max-height: min(620px, calc(100vh - 120px));
  border: 1px solid rgba(184, 255, 77, 0.46);
  background:
    radial-gradient(circle at 12% 0%, rgba(184, 255, 77, 0.12), transparent 38%),
    rgba(1, 9, 13, 0.96);
  padding: 20px;
  box-shadow:
    0 0 34px rgba(184, 255, 77, 0.14),
    0 22px 70px rgba(0, 0, 0, 0.52);
}

.chess-journal-window h3 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
}

.chess-journal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(1, 10, 16, 0.94);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.chess-journal-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  max-height: min(470px, calc(100vh - 230px));
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.chess-journal-item {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(49, 247, 255, 0.24);
  background: rgba(1, 8, 13, 0.78);
  color: var(--text);
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.chess-journal-item:hover,
.chess-journal-item:focus-visible {
  border-color: rgba(184, 255, 77, 0.78);
  outline: none;
  box-shadow: inset 0 0 16px rgba(184, 255, 77, 0.12);
}

.chess-journal-item span,
.chess-journal-empty {
  color: var(--muted);
  font-weight: 800;
}

.chess-ai-settings-modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 6, 9, 0.72);
  backdrop-filter: blur(2px);
}

.chess-ai-settings-modal[hidden] {
  display: none;
}

.chess-ai-settings-window {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  border: 1px solid rgba(184, 255, 77, 0.48);
  background:
    radial-gradient(circle at 18% 0%, rgba(184, 255, 77, 0.14), transparent 38%),
    rgba(1, 9, 13, 0.96);
  padding: 22px;
  box-shadow:
    0 0 34px rgba(184, 255, 77, 0.14),
    0 22px 70px rgba(0, 0, 0, 0.52);
}

.chess-ai-settings-window h3 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
}

.chess-ai-settings-window label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 900;
}

.chess-ai-settings-window select,
.chess-ai-settings-window input[type="range"] {
  width: 100%;
}

.chess-ai-settings-window select,
.chess-ai-settings-window input[type="color"] {
  min-height: 40px;
  border: 1px solid rgba(49, 247, 255, 0.36);
  background: rgba(2, 12, 20, 0.96);
  color: var(--text);
  padding: 8px 10px;
  font-weight: 800;
}

.chess-ai-settings-fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 1px solid rgba(49, 247, 255, 0.28);
  padding: 12px;
}

.chess-ai-settings-fieldset legend {
  padding: 0 8px;
  color: var(--lime);
  font-weight: 900;
}

.chess-ai-settings-check,
.chess-ai-settings-radios label,
.chess-ai-settings-brightness,
.chess-ai-settings-color {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chess-ai-settings-brightness,
.chess-ai-settings-color {
  display: grid;
  align-items: stretch;
}

.chess-ai-settings-check input,
.chess-ai-settings-radios input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.chess-ai-settings-radios {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.chess-ai-settings-radios strong,
.chess-ai-settings-brightness strong,
.chess-ai-settings-color strong {
  color: var(--text);
}

.chess-ai-settings-brightness small,
.chess-ai-settings-color small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.chess-ai-settings-window select:disabled,
.chess-ai-settings-window input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chess-ai-settings-window input[type="color"] {
  width: 100%;
  padding: 4px;
  cursor: pointer;
}

.chess-ai-settings-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(49, 247, 255, 0.42);
  background: rgba(1, 10, 16, 0.94);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.chess-ai-settings-message {
  min-height: 18px;
  margin: 0;
  color: var(--lime);
  font-weight: 900;
}

.chess-leave-modal {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 6, 9, 0.7);
  backdrop-filter: blur(2px);
}

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

.chess-leave-window {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid rgba(49, 247, 255, 0.54);
  background:
    radial-gradient(circle at 18% 0%, rgba(49, 247, 255, 0.18), transparent 38%),
    rgba(1, 9, 13, 0.94);
  padding: 22px;
  box-shadow:
    0 0 30px rgba(49, 247, 255, 0.18),
    inset 0 0 22px rgba(49, 247, 255, 0.08);
}

.chess-leave-window h3,
.chess-leave-window p {
  margin: 0;
}

.chess-leave-window h3 {
  color: var(--text);
  font-size: 30px;
  text-shadow: 0 0 14px rgba(49, 247, 255, 0.32);
}

.chess-leave-window p {
  color: var(--muted);
  line-height: 1.35;
}

.chess-leave-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chess-replay-actions {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.chess-friend-card img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border: 1px solid rgba(49, 247, 255, 0.4);
}

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

  .chess-page.is-game-view .chess-board-layout {
    grid-template-columns: minmax(0, calc(var(--board-size, 800px) + var(--coord-size, 28px) + 36px));
    grid-template-rows: auto auto auto auto auto auto auto auto;
    --side-panel-width: min(100%, calc(var(--board-size, 800px) + var(--coord-size, 28px) + 36px));
    justify-content: center;
    height: auto;
    max-height: none;
  }

  .chess-page.is-game-view .chess-board-frame,
  .chess-page.is-game-view .chess-opponent-bar,
  .chess-page.is-game-view .chess-ai-panel-actions,
  .chess-page.is-game-view .chess-ai-thought,
  .chess-page.is-game-view .chess-user-bar,
  .chess-page.is-game-view .chess-captured-panel,
  .chess-page.is-game-view .chess-moves-panel,
  .chess-page.is-game-view .chess-game-actions {
    grid-column: 1;
  }

  .chess-page.is-game-view .chess-opponent-bar {
    grid-row: 1;
  }

  .chess-page.is-game-view .chess-ai-panel-actions {
    grid-row: 2;
  }

  .chess-page.is-game-view .chess-ai-thought {
    grid-row: 3;
    height: 150px;
  }

  .chess-page.is-game-view .chess-board-frame {
    grid-row: 4;
  }

  .chess-page.is-game-view .chess-user-bar {
    grid-row: 5;
  }

  .chess-page.is-game-view .chess-captured-panel {
    grid-row: 6;
  }

  .chess-page.is-game-view .chess-moves-panel,
  .chess-page.is-game-view .chess-game-actions {
    width: min(100%, calc(var(--board-size, 800px) + var(--coord-size, 28px) + 36px));
    justify-self: center;
  }

  .chess-page.is-game-view .chess-moves-panel {
    grid-row: 7;
    min-height: 220px;
  }

  .chess-page.is-game-view .chess-game-actions {
    grid-row: 8;
  }

  .chess-hero img {
    width: min(220px, 100%);
  }
}

@media (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
  .is-chess-game-view .top-banner {
    min-height: 54px;
    padding-block: 6px;
  }

  .is-chess-game-view .top-brand-mark,
  .is-chess-game-view .top-icon {
    width: 36px;
    height: 36px;
  }

  body.is-chess-game-view .chess-page {
    height: calc(100dvh - 54px);
  }

  .chess-page.is-game-view {
    padding: 8px;
  }

  .chess-page.is-game-view .chess-shell {
    width: 100%;
  }

  .chess-page.is-game-view .chess-board-layout {
    grid-template-columns:
      var(--side-panel-width)
      calc(var(--board-size, 800px) + var(--coord-size, 24px) + 32px)
      var(--side-panel-width);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 10px;
    height: calc(var(--board-size, 800px) + var(--coord-size, 24px) + 32px);
    max-height: calc(var(--board-size, 800px) + var(--coord-size, 24px) + 32px);
    justify-content: center;
  }

  .chess-page.is-game-view .chess-board-frame {
    grid-column: 2;
    grid-row: 1 / 5;
    padding: 14px;
  }

  .chess-page.is-game-view .chess-opponent-bar {
    grid-column: 1;
    grid-row: 1;
  }

  .chess-page.is-game-view .chess-ai-panel-actions {
    grid-column: 1;
    grid-row: 2;
  }

  .chess-page.is-game-view .chess-ai-thought {
    grid-column: 1;
    grid-row: 3 / 5;
    height: 100%;
  }

  .chess-page.is-game-view .chess-user-bar {
    grid-column: 3;
    grid-row: 1;
  }

  .chess-page.is-game-view .chess-captured-panel {
    grid-column: 3;
    grid-row: 2;
  }

  .chess-page.is-game-view .chess-moves-panel {
    grid-column: 3;
    grid-row: 3;
    width: auto;
    min-height: 0;
  }

  .chess-page.is-game-view .chess-game-actions {
    grid-column: 3;
    grid-row: 4;
    width: auto;
  }

  .chess-page.is-game-view .chess-player-bar {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    min-height: 62px;
    gap: 8px;
    padding: 6px 8px;
  }

  .chess-player-avatar {
    width: 42px;
    height: 42px;
    font-size: 23px;
  }

  .chess-player-info span:not(.chess-player-role) {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chess-page.is-game-view .chess-player-bar strong {
    font-size: 21px;
  }

  .chess-ai-thought-log p {
    font-size: 14px;
  }

  .chess-page.is-game-view .chess-moves-panel ol {
    grid-template-columns: 1fr;
    font-size: 13px;
  }

  .chess-replay-actions {
    gap: 5px;
  }

  .chess-page.is-game-view .chess-game-actions .button,
  .chess-replay-actions button {
    min-height: 32px;
    padding: 5px 7px;
  }
}

body.is-tablet-portrait-warning::after {
  content: "Поверните планшет горизонтально, чтобы доска и панели поместились на экране.";
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 50;
  width: min(520px, calc(100vw - 28px));
  transform: translateX(-50%);
  border: 1px solid rgba(184, 255, 77, 0.62);
  background: rgba(1, 9, 13, 0.96);
  color: var(--text);
  padding: 10px 12px;
  text-align: center;
  font-weight: 900;
  box-shadow: 0 0 24px rgba(184, 255, 77, 0.18);
}

@media (max-width: 1320px) {
  .snake-page {
    width: min(1260px, calc(100vw - 24px));
  }

  .snake-layout {
    grid-template-columns: 200px 800px 200px;
  }

  .tablet-controls {
    display: grid;
  }
}

.snake-right .snake-info-block {
  text-align: center;
}

.snake-right .snake-info-block strong {
  text-align: center;
}

.snake-right .player-block {
  text-align: center;
}

.snake-right .snake-player {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}

.snake-left .snake-info-block {
  text-align: center;
}

.snake-left .snake-info-block h2 {
  margin-top: 0;
  text-align: center;
}

.snake-top-list {
  justify-items: stretch;
  padding-left: 0;
  list-style-position: inside;
  text-align: center;
}

.snake-top-list li span {
  min-width: 0;
}

#snakeStartOverlay {
  align-items: end;
  padding-bottom: 10%;
  box-sizing: border-box;
}

@media (min-width: 761px) and (max-width: 1320px) {
  .snake-game-page {
    height: 100dvh;
  }

  .snake-game-page .top-banner {
    min-height: 52px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .snake-game-page .top-brand span {
    font-size: 28px;
  }

  .snake-game-page .top-icon {
    width: 36px;
    height: 36px;
  }

  .snake-page {
    --snake-board-size: min(68dvh, calc(100vw - 440px), 760px);
    display: grid;
    align-items: center;
    width: 100vw;
    height: calc(100dvh - 56px);
    margin: 0;
    padding: 6px 12px;
    box-sizing: border-box;
  }

  .snake-layout {
    grid-template-columns: minmax(150px, 190px) var(--snake-board-size) minmax(150px, 190px);
    justify-content: center;
    align-items: stretch;
    gap: 10px;
    height: 100%;
    max-height: calc(100dvh - 68px);
  }

  .snake-center,
  .snake-board,
  .snake-board-wrap {
    width: var(--snake-board-size);
  }

  .snake-board,
  .snake-board-wrap {
    height: var(--snake-board-size);
  }

  .snake-eaten-counter {
    min-height: 30px;
    margin-bottom: 6px;
    font-size: 18px;
  }

  .snake-side {
    grid-template-rows: auto 1fr auto;
    align-content: stretch;
    max-height: 100%;
    overflow: hidden;
  }

  .snake-info-block {
    padding: 8px;
  }

  .snake-info-block h2 {
    font-size: 16px;
  }

  .snake-info-block strong {
    font-size: 24px;
  }

  .snake-top-list {
    gap: 5px;
    font-size: 13px;
  }

  .tablet-controls {
    position: fixed;
    z-index: 12;
    display: grid;
    gap: 10px;
    margin: 0;
    pointer-events: auto;
  }

  .tablet-left {
    left: 18px;
    bottom: 18px;
    grid-template-columns: repeat(2, 78px);
  }

  .tablet-right {
    right: 18px;
    bottom: 18px;
    grid-template-columns: repeat(2, 78px);
  }

  .round-control {
    width: 78px;
    height: 78px;
    border-radius: 14px;
    background:
      radial-gradient(circle at 50% 30%, rgba(49, 247, 255, 0.22), transparent 62%),
      rgba(2, 12, 20, 0.9);
    box-shadow:
      0 0 24px rgba(49, 247, 255, 0.26),
      inset 0 0 18px rgba(49, 247, 255, 0.1);
  }

  .snake-field-button {
    min-width: 146px;
    min-height: 92px;
    font-size: 26px;
  }
}

@media (max-width: 760px) {
  .top-banner {
    grid-template-columns: 1fr auto;
    gap: 14px;
    justify-items: stretch;
  }

  .top-brand {
    justify-self: start;
  }

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

  .game-search {
    position: static;
    transform: none;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .top-popover,
  .avatar-dropdown {
    left: auto;
    right: 0;
    transform: none;
  }

  .top-popover::before,
  .avatar-dropdown::before {
    right: 16px;
  }

  .home-banner {
    grid-template-columns: 1fr;
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    flex-direction: column;
    width: min(100% - 28px, 1180px);
    padding-top: 18px;
  }

  main {
    width: min(100% - 28px, 1180px);
  }

  .profile-card {
    width: 100%;
  }

  .hero {
    min-height: 260px;
    padding-top: 28px;
  }

  .registration-form,
  .account-form {
    grid-template-columns: 1fr;
  }

  .friends-layout {
    grid-template-columns: 1fr;
  }

  .avatar-canvas,
  .avatar-controls {
    max-width: none;
  }

  .snake-tile {
    width: min(400px, 100%);
  }

  .games-row {
    width: 100%;
    max-width: calc(100vw - 24px);
  }

  .game-placeholder,
  .snake-tile {
    flex-basis: min(400px, 100%);
    width: min(400px, 100%);
  }
}

@media (max-width: 430px) {
  .profile-card {
    grid-template-columns: 72px 1fr;
  }

  .profile-avatar {
    width: 72px;
    height: 72px;
  }

  .profile-body h2 {
    font-size: 18px;
  }

  .fields-panel {
    grid-template-columns: 1fr;
  }
}

.settings-window,
.admin-users-card {
  position: relative;
  padding: 24px;
  border: 1px solid rgba(49, 247, 255, 0.32);
  background: rgba(5, 12, 15, 0.7);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.32);
}

.settings-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(49, 247, 255, 0.38);
  background: rgba(5, 12, 15, 0.86);
  color: var(--text);
  font: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.settings-close:hover,
.settings-tab:hover {
  border-color: rgba(49, 247, 255, 0.72);
  box-shadow: 0 0 18px rgba(49, 247, 255, 0.18);
}

.settings-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings-nav {
  display: grid;
  gap: 8px;
}

.settings-tab {
  min-height: 46px;
  border: 1px solid rgba(49, 247, 255, 0.28);
  background: rgba(13, 26, 32, 0.84);
  color: var(--muted);
  padding: 10px 14px;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.settings-tab.is-active {
  border-color: var(--cyan);
  background: rgba(49, 247, 255, 0.14);
  color: var(--text);
}

.settings-content {
  min-width: 0;
  padding-right: 48px;
}

.settings-panel {
  display: none;
}

.settings-panel.is-active {
  display: block;
}

.settings-panel-head {
  margin-bottom: 18px;
}

.settings-panel-head h2 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 34px);
}

.settings-panel-head p,
.settings-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.settings-grid {
  display: grid;
  grid-template-columns: 190px minmax(260px, 420px);
  gap: 22px;
  align-items: start;
}

.compact-avatar-panel {
  display: grid;
  gap: 12px;
}

.settings-avatar-canvas {
  width: 160px;
  max-width: 160px;
}

.security-fields {
  display: grid;
  gap: 16px;
  max-width: 460px;
}

.admin-panel {
  padding: 24px;
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-user-cell img {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(49, 247, 255, 0.34);
  object-fit: cover;
}

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

  .settings-content {
    padding-right: 0;
  }

  .settings-nav {
    grid-template-columns: 1fr 1fr;
  }
}
