.games-nav-compact { display: none; }

.games-view {
  --game-x: var(--theme-accent, #c291f6);
  --game-o: color-mix(in srgb, var(--theme-text, #f8f3ff) 62%, #45c6cc);
  min-width: 0;
  padding: clamp(14px, 2.5vw, 32px);
  color: var(--theme-text, #f8f3ff);
}

.profile-layout > #games-view { border-radius: clamp(16px, 2vw, 24px); }

.games-wrap { width: min(100%, 1024px); margin-inline: auto; }
.games-view .games-kicker {
  margin: 0 0 5px;
  color: var(--theme-accent, #c291f6);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: .17em;
}
.games-view .mark-x { color: var(--game-x); }
.games-view .mark-o { color: var(--game-o); }
.games-columns { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(250px, 1fr); align-items: start; gap: 16px; }
.games-lobby { display: grid; min-width: 0; gap: 16px; }
.games-card {
  min-width: 0;
  padding: clamp(15px, 2.6vw, 23px);
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 19px;
  background: var(--theme-panel, #121022);
}
.games-card h3 { margin: 0; color: inherit; font-size: clamp(17px, 2.6vw, 22px); line-height: 1.2; letter-spacing: -.025em; }
.games-match-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.games-tag {
  flex-shrink: 0;
  padding: 5px 8px;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 8px;
  color: var(--theme-muted, #bdb1cf);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.games-muted, .games-idle p {
  margin: 8px 0 0;
  color: var(--theme-muted, #bdb1cf);
  font-size: 13px;
  line-height: 1.5;
}
.games-idle {
  display: grid;
  justify-items: center;
  margin-top: 15px;
  padding: clamp(15px, 4vw, 30px) 12px;
  border: 1px dashed var(--theme-border, #59496e);
  border-radius: 14px;
  background: var(--theme-canvas, #0c0b1d);
  text-align: center;
}
.games-idle-mark { display: flex; gap: 12px; font-size: 32px; line-height: 1; font-weight: 720; }
.games-view #games-invite-form { display: grid; min-width: 0; gap: 7px; margin-top: 14px; }
.games-friend-label { font-size: 13px; font-weight: 650; }
.games-friend-picker { min-width: 0; }
.games-friend-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  text-align: start;
}
.games-friend-toggle > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.games-friend-chevron {
  flex: 0 0 7px;
  height: 7px;
  margin-inline-end: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.games-friend-toggle[aria-expanded="true"] .games-friend-chevron {
  transform: translateY(2px) rotate(225deg);
}
.games-friend-options {
  display: grid;
  gap: 3px;
  max-height: min(265px, 42vh);
  margin: 5px 0 0;
  padding: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 10px;
  background: var(--theme-panel, #121022);
}
.games-friend-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 45px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: start;
  cursor: pointer;
}
.games-friend-option:is(:hover, :focus-visible, [aria-pressed="true"]) {
  background: var(--theme-tint, #37204d);
}
.games-view .games-friend-option:focus-visible { outline-offset: -2px; }
.games-friend-avatar { flex: 0 0 30px; }
.games-friend-avatar :is(.friend-avatar, .friend-avatar-placeholder) { width: 30px; height: 30px; }
.games-friend-name { min-width: 0; overflow-wrap: anywhere; }
.games-friend-name small {
  display: block;
  color: var(--theme-muted, #bdb1cf);
  font-size: 12px;
  line-height: 1.3;
}
.games-button {
  min-height: 41px;
  padding: 8px 13px;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 10px;
  color: var(--theme-text, #f8f3ff);
  background: var(--theme-surface, #21192f);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.games-button.primary { border-color: transparent; background: var(--theme-action, #7631bd); color: #fff; }
.games-button:disabled { opacity: .55; cursor: default; }
.games-button:hover:not(:disabled) { filter: brightness(1.12); }
.games-view :is(button, select):focus-visible { outline: 2px solid var(--theme-accent, #c291f6); outline-offset: 2px; }
.games-feedback { margin: 9px 0 0; color: var(--theme-muted, #bdb1cf); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.games-feedback:empty { display: none; }
.games-feedback[data-error="true"] { color: var(--theme-text, #f8f3ff); }
.games-list { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.games-list:empty { display: none; }
.games-list button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 10px;
  color: inherit;
  background: var(--theme-surface, #21192f);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.games-list button:is(:hover, [aria-current="true"]) { background: var(--theme-tint, #37204d); border-color: var(--theme-accent, #c291f6); }
.games-list-icon {
  display: grid;
  place-items: center;
  flex: 0 0 33px;
  height: 33px;
  border-radius: 8px;
  background: var(--theme-canvas, #0c0b1d);
  font-size: 22px;
  font-weight: 730;
}
.games-list button > span:last-child { min-width: 0; }
.games-list strong, .games-list small, .games-players strong, .games-players small { display: block; overflow-wrap: anywhere; }
.games-list strong, .games-players strong { font-size: 13px; line-height: 1.3; }
.games-list small, .games-players small { margin-top: 2px; color: var(--theme-muted, #bdb1cf); font-size: 12px; line-height: 1.25; }
.games-table { margin-top: 14px; }
.games-players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.games-players > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 10px;
  background: var(--theme-surface, #21192f);
}
.games-players .is-turn { border-color: var(--theme-accent, #c291f6); background: var(--theme-tint, #37204d); }
.games-player-mark { flex: 0 0 24px; text-align: center; font-size: 25px; font-weight: 800; line-height: 1; }
.games-status { margin: 13px 0; color: inherit; font-size: 14px; font-weight: 700; line-height: 1.45; text-align: center; }
.games-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: min(100%, 260px);
  margin: 0 auto;
  padding: 6px;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 13px;
  background: var(--theme-canvas, #0c0b1d);
}
.games-board button {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--theme-border, #59496e);
  border-radius: 8px;
  color: inherit;
  background: var(--theme-surface, #21192f);
  font: inherit;
  font-size: clamp(27px, 6vw, 45px);
  font-weight: 720;
  line-height: 1;
}
.games-board button:not([aria-disabled="true"]) { cursor: pointer; }
.games-board button:not([aria-disabled="true"]):hover, .games-board .is-winning {
  border-color: var(--theme-accent, #c291f6);
  background: var(--theme-tint, #37204d);
}
.games-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.games-actions:has(.games-button:not([hidden])) { margin-top: 12px; }

@media (max-width: 700px) {
  .games-columns { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .games-lobby { gap: 12px; }
}
@media (max-width: 490px) {
  #settings-nav .profile-nav-label { display: none; }
  #settings-nav .games-nav-compact { display: block; }
  .games-view .games-card { padding: 14px; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .welcome-screen > .profile-nav .profile-nav-button { gap: 6px; padding-inline: 3px; font-size: 12px; }
  .welcome-screen > .profile-nav .profile-nav-icon { flex: 0 0 26px; width: 26px; height: 26px; }
}
.game-invite-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.game-invite-actions .games-button { min-height: 32px; padding: 4px 9px; font-size: 12px; }
