/* Flags, the account menu in the header, and game lists (Play page, My games, profile). */

/* ---- flags (24x18 images, a thin outline so white flags show on any background) ---- */
.flag {
  display: inline-block;
  inline-size: 1.5rem;
  block-size: auto;
  aspect-ratio: 4 / 3;
  vertical-align: -0.15em;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--border);
}
.flag.large { inline-size: 2.6rem; border-radius: 4px; }
/* Palestine: the watermelon badge beside the flag, and a name in a flag-colour gradient. */
.melon { inline-size: 1.2rem; block-size: 1.2rem; vertical-align: -0.25em; }
.melon.large { inline-size: 2rem; block-size: 2rem; vertical-align: middle; }
.pal-name {
  color: var(--pal-2);                                  /* fallback where background-clip: text is missing */
  background: linear-gradient(90deg, var(--pal-1), var(--pal-2) 50%, var(--pal-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.avatar-sm { inline-size: 2rem; block-size: 2rem; flex: none; }
.avatar-lg { inline-size: 5.5rem; block-size: 5.5rem; padding: 0.3rem; }

/* ---- the account menu: <details> in the header ---- */
.user-menu { position: relative; }
.user-button {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-block: 0.15rem;
  padding-inline: 0.2rem 0.8rem;
  max-inline-size: 13rem;
  list-style: none;
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.user-button::-webkit-details-marker { display: none; }
.user-button::after { content: "▾"; font-size: 0.75rem; color: var(--muted); }
.user-button:hover, .user-menu[open] .user-button { border-color: var(--accent); }
.user-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.user-button .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-list {
  position: absolute;
  inset-inline-end: 0;
  inset-block-start: calc(100% + 0.4rem);
  z-index: 20;
  min-inline-size: 14rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu-who { padding: 0.4rem 0.7rem 0.5rem; margin-block-end: 0.25rem; border-block-end: 1px solid var(--border); display: grid; line-height: 1.3; }
.menu-who .hint { margin: 0; }
.menu-list a, .menu-list button {
  display: block;
  inline-size: 100%;
  padding: 0.4rem 0.7rem;
  font: inherit;
  text-align: start;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover, .menu-list :focus-visible { background: var(--surface-2); outline: none; }
.menu-list form { margin: 0; border-block-start: 1px solid var(--border); margin-block-start: 0.25rem; padding-block-start: 0.25rem; }

/* ---- game lists ---- */
.game-list { list-style: none; margin: 0; padding: 0; display: grid; }
.game-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding-block: 0.65rem;
  border-block-end: 1px solid var(--border);
}
.game-row:last-child { border-block-end: 0; }
.game-row-main { display: grid; min-inline-size: 0; line-height: 1.35; }
.game-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-weight: 700; }
.game-row-title a { color: inherit; text-decoration: none; }
.game-row-title a:hover { text-decoration: underline; }
.game-row-meta { margin: 0; }
.your-turn { color: var(--accent-ink); }
.game-row-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.inline-form { display: inline; margin: 0; }
.cancel-invite { margin-block-start: 0.6rem; }
.button.small { padding-block: 0.2rem; padding-inline: 0.8rem; font-size: 0.9rem; }
.tag.outcome.win { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.tag.outcome.loss { color: var(--danger); border-color: var(--danger); }

@media (max-width: 34rem) {
  .game-row { grid-template-columns: auto minmax(0, 1fr); }
  .game-row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* "Continue playing" above the Play page's forms. */
.continue { margin-block-end: 1rem; }
.continue h2 { margin-block: 0 0.4rem; font-size: 1.15rem; }
.continue .hint { margin-block-end: 0; }
