/* ============================================================================
   4-game-shell.css
   ----------------------------------------------------------------------------
   Shell commun des mini-jeux (connect4, chess, uno, poker, monopoly, werewolf).

   ARCHITECTURE
   Trois couches superposées :
     1. TOKENS     : --gshell-*  (palette, rayons, motion, safe-area)
     2. PRIMITIVES : .gshell-*   (composants génériques sans couleur dure)
     3. THEMES     : .gshell-theme-<jeu>  (1 classe, overrides de tokens)

   IDENTITÉ PAR JEU
   Deux façons d'appliquer un thème, au choix (les deux coexistent) :
     A) classe helper : <main class="gshell-page gshell-theme-connect4">
        → applique tous les tokens du jeu en une classe.
     B) tokens inline : .connect4-page { --gshell-accent: #2563eb; }
        → pour les jeux qui ont déjà un conteneur préfixé ; permet un
        override plus fin (accent-2, board-bg, etc.) sans toucher le HTML.

   CONVENTIONS
     - État       : .is-active / .is-hidden / .is-disabled / .is-loading
                    (support legacy : .active sur les overlays)
     - Élément    : .gshell-<bloc>__<élément>
     - Variant    : .gshell-<bloc>--<modifier>

   ADOPTION PROGRESSIVE
   Ces classes coexistent avec les préfixes existants (.connect4-*, .chess-*…).
   Aucun jeu n'est forcé de migrer d'un coup. Spécificité faible → un override
   jeu reste toujours vainqueur.

   DÉPENDANCES
   1-base.css doit être chargé avant :
     --safe-area-* / --space-* / --radius-* / --bg-* / --text-* /
     --accent-*   / --ease-*  / --duration-* / --z-* / --shadow-*.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   Tokens — héritent du design system global, surchargables par jeu
---------------------------------------------------------------------------- */
:root {
  /* Palette — accent principal + secondaire + contraste + glow */
  --gshell-accent: var(--accent-primary);
  --gshell-accent-2: var(--accent-secondary, var(--accent-primary));
  --gshell-accent-fg: #fff;
  --gshell-accent-glow: var(--accent-glow, rgba(168, 197, 69, 0.35));

  /* Sémantique — surchargeables par jeu (ex. werewolf lose en rouge nuit) */
  --gshell-danger: var(--accent-danger, #ef4444);
  --gshell-success: var(--accent-success, #22c55e);
  --gshell-warning: var(--accent-warning, #f59e0b);
  --gshell-info: var(--accent-blue, #3b82f6);

  /* Surfaces */
  --gshell-surface: var(--bg-surface);
  --gshell-surface-alt: var(--bg-surface-alt);
  --gshell-surface-elevated: var(--bg-surface);
  --gshell-board-bg: var(--bg-surface-alt);
  --gshell-border: var(--border-color);

  /* Typographie */
  --gshell-text: var(--text-main);
  --gshell-text-muted: var(--text-muted);
  --gshell-title-size: 1rem;
  --gshell-body-size: 0.88rem;
  --gshell-meta-size: 0.78rem;

  /* Rayons */
  --gshell-radius-sm: var(--radius-sm, 6px);
  --gshell-radius-md: var(--radius-md, 10px);
  --gshell-radius-lg: var(--radius-lg, 16px);
  --gshell-radius-xl: var(--radius-xl, 24px);
  --gshell-radius-pill: 999px;

  /* Motion — 3 durées, 1 courbe principale, 1 courbe haptique */
  --gshell-motion-fast: 120ms;
  --gshell-motion-base: 220ms;
  --gshell-motion-slow: 420ms;
  --gshell-ease: var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
  --gshell-ease-haptic: var(--ease-haptic, cubic-bezier(0.2, 0, 0, 1));
  --gshell-transition: var(--gshell-motion-fast) var(--gshell-ease);

  /* Shadows cohérentes — inspirées de --shadow-* mais thémables */
  --gshell-shadow-card: var(--shadow-card, 0 2px 8px rgba(0, 0, 0, 0.04));
  --gshell-shadow-elevated: var(--shadow-elevated, 0 10px 30px rgba(0, 0, 0, 0.10));
  --gshell-shadow-accent: 0 8px 24px -8px var(--gshell-accent-glow);

  /* Focus ring unifié — accessibilité clavier */
  --gshell-focus-ring: 0 0 0 3px color-mix(in srgb, var(--gshell-accent) 45%, transparent);

  /* Cible tactile mini iOS HIG */
  --gshell-tap-min: 44px;

  /* Breakpoints (doc, utilisation via @media) :
     --gshell-bp-sm: 640px;  (mobile → tablette portrait)
     --gshell-bp-md: 768px;  (tablette → desktop)
     --gshell-bp-lg: 1024px; (desktop large) */
}

/* ---------------------------------------------------------------------------
   Page wrapper — safe-area unifiée
---------------------------------------------------------------------------- */
.gshell-page {
  min-height: 100vh;
  padding-top: calc(var(--space-md, 16px) + var(--safe-area-top, 0px));
  padding-bottom: calc(var(--space-md, 16px) + var(--safe-area-bottom, 0px));
  padding-left: calc(var(--space-md, 16px) + var(--safe-area-left, 0px));
  padding-right: calc(var(--space-md, 16px) + var(--safe-area-right, 0px));
}

.gshell-container {
  max-width: 1080px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------------------
   Layout grid — board/side, collapse en 1 colonne sur mobile
---------------------------------------------------------------------------- */
.gshell-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.gshell-layout__main {
  min-width: 0;
}

.gshell-layout__side {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.gshell-layout--equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

@media (max-width: 768px) {
  .gshell-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Section — titre + count badge, espace standardisé
---------------------------------------------------------------------------- */
.gshell-section {
  margin-bottom: 28px;
}

.gshell-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: var(--gshell-title-size);
  font-weight: 800;
  color: var(--gshell-text);
}

.gshell-count-badge {
  padding: 2px 8px;
  border-radius: var(--gshell-radius-pill);
  background: var(--gshell-surface-alt);
  color: var(--gshell-text-muted);
  font-size: 0.76rem;
  font-weight: 700;
}

/* Surface générique — remplace .{game}-panel, .{game}-card */
.gshell-surface {
  padding: 16px;
  border: 1px solid var(--gshell-border);
  border-radius: var(--gshell-radius-lg);
  background: var(--gshell-surface);
  box-shadow: var(--gshell-shadow-card);
}

.gshell-surface--flat {
  box-shadow: none;
}

.gshell-surface--alt {
  background: var(--gshell-surface-alt);
}

/* ---------------------------------------------------------------------------
   Game header — back + titre + turn/phase + timer
---------------------------------------------------------------------------- */
.gshell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--gshell-border);
  border-radius: var(--gshell-radius-lg);
  background: var(--gshell-surface);
}

.gshell-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.gshell-header__title {
  min-width: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--gshell-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gshell-header__info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gshell-header--sticky {
  position: sticky;
  top: var(--safe-area-top, 0px);
  z-index: var(--z-sticky, 1020);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
}

/* ---------------------------------------------------------------------------
   Pills — turn indicator, timer, phase badge
---------------------------------------------------------------------------- */
.gshell-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--gshell-radius-pill);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
  background: var(--gshell-surface-alt);
  color: var(--gshell-text-muted);
  white-space: nowrap;
}

.gshell-pill--accent {
  background: color-mix(in srgb, var(--gshell-accent) 14%, transparent);
  color: var(--gshell-accent);
}

.gshell-pill--urgent {
  color: var(--accent-danger, #ef4444);
  animation: gshell-pulse 0.6s infinite alternate;
}

@keyframes gshell-pulse {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

/* ---------------------------------------------------------------------------
   Stats bar — grille de stats du lobby (parties, victoires, etc.)
---------------------------------------------------------------------------- */
.gshell-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.gshell-stat {
  padding: 14px;
  border: 1px solid var(--gshell-border);
  border-radius: var(--gshell-radius-lg);
  background: var(--gshell-surface);
  text-align: center;
  box-shadow: var(--gshell-shadow-card);
}

.gshell-stat__value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gshell-text);
  line-height: 1.1;
}

.gshell-stat__label {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--gshell-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------------------
   Games grid — liste des parties en cours / dispos dans le lobby
---------------------------------------------------------------------------- */
.gshell-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.gshell-game-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--gshell-border);
  border-radius: var(--gshell-radius-lg);
  background: var(--gshell-surface);
  transition:
    border-color var(--gshell-motion-fast) var(--gshell-ease),
    box-shadow var(--gshell-motion-fast) var(--gshell-ease),
    transform var(--gshell-motion-fast) var(--gshell-ease);
}

.gshell-game-card:hover {
  border-color: color-mix(in srgb, var(--gshell-accent) 40%, var(--gshell-border));
  box-shadow: var(--gshell-shadow-elevated);
  transform: translateY(-1px);
}

.gshell-game-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--gshell-text);
}

.gshell-game-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--gshell-meta-size);
  color: var(--gshell-text-muted);
}

.gshell-game-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--gshell-border);
}

/* ---------------------------------------------------------------------------
   Seat list — sièges en attente de joueurs (connect4, chess, uno)
---------------------------------------------------------------------------- */
.gshell-seat-list {
  display: grid;
  gap: 10px;
}

.gshell-seat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--gshell-radius-md);
  background: var(--gshell-surface-alt);
  border: 1px dashed var(--gshell-border);
  color: var(--gshell-text-muted);
  font-size: var(--gshell-body-size);
}

.gshell-seat.is-filled {
  background: var(--gshell-surface);
  border-style: solid;
  border-color: color-mix(in srgb, var(--gshell-accent) 30%, transparent);
  color: var(--gshell-text);
}

.gshell-seat__token {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gshell-accent);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Player card — avatar + nom + meta + indicateur tour actif
---------------------------------------------------------------------------- */
.gshell-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--gshell-surface-alt);
  border: 1px solid transparent;
  transition:
    border-color var(--gshell-transition),
    box-shadow var(--gshell-transition);
}

.gshell-player__main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.gshell-player__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--gshell-surface);
}

.gshell-player__text {
  min-width: 0;
}

.gshell-player__name {
  font-weight: 800;
  color: var(--gshell-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gshell-player__meta {
  font-size: 0.78rem;
  color: var(--gshell-text-muted);
}

.gshell-player__status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gshell-player.is-active {
  border-color: color-mix(in srgb, var(--gshell-accent) 45%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--gshell-accent) 20%, transparent),
    0 4px 14px -6px var(--gshell-accent-glow);
}

.gshell-player.is-eliminated,
.gshell-player.is-dead {
  opacity: 0.45;
}

/* ---------------------------------------------------------------------------
   Metric — paire label/valeur (chips poker, money monopoly, score générique)
---------------------------------------------------------------------------- */
.gshell-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.gshell-metric__value {
  font-weight: 800;
  color: var(--gshell-accent);
  font-variant-numeric: tabular-nums;
}

.gshell-metric__label {
  font-size: var(--gshell-meta-size);
  color: var(--gshell-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------------
   Role badge — rôle ww, badge dealer/SB/BB poker, token monopoly
---------------------------------------------------------------------------- */
.gshell-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--gshell-radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--gshell-surface-alt);
  color: var(--gshell-text-muted);
  line-height: 1.4;
}

.gshell-role-badge--accent {
  background: color-mix(in srgb, var(--gshell-accent) 14%, transparent);
  color: var(--gshell-accent);
}

.gshell-role-badge--danger {
  background: color-mix(in srgb, var(--gshell-danger) 14%, transparent);
  color: var(--gshell-danger);
}

.gshell-role-badge--success {
  background: color-mix(in srgb, var(--gshell-success) 14%, transparent);
  color: var(--gshell-success);
}

/* ---------------------------------------------------------------------------
   Empty state — "pas de partie", "en attente..."
---------------------------------------------------------------------------- */
.gshell-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  text-align: center;
  color: var(--gshell-text-muted);
  background: var(--gshell-surface-alt);
  border-radius: var(--gshell-radius-lg);
  border: 1px dashed var(--gshell-border);
}

.gshell-empty__icon {
  font-size: 2rem;
  opacity: 0.6;
}

.gshell-empty__text {
  font-size: var(--gshell-body-size);
}

/* ---------------------------------------------------------------------------
   Tabs — switcher (werewolf chat/events, potentiellement monopoly log/rules)
---------------------------------------------------------------------------- */
.gshell-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--gshell-radius-md);
  background: var(--gshell-surface-alt);
  border: 1px solid var(--gshell-border);
}

.gshell-tab {
  flex: 1 1 auto;
  padding: 8px 12px;
  border: 0;
  border-radius: calc(var(--gshell-radius-md) - 2px);
  background: transparent;
  color: var(--gshell-text-muted);
  font-size: var(--gshell-body-size);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition:
    background-color var(--gshell-motion-fast) var(--gshell-ease),
    color var(--gshell-motion-fast) var(--gshell-ease);
}

.gshell-tab:hover:not(.is-active) {
  color: var(--gshell-text);
}

.gshell-tab.is-active {
  background: var(--gshell-surface);
  color: var(--gshell-accent);
  box-shadow: var(--gshell-shadow-card);
}

/* ---------------------------------------------------------------------------
   Status banner — win / draw / lose / info
---------------------------------------------------------------------------- */
.gshell-banner {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: var(--gshell-radius-lg);
  border: 1px solid transparent;
  font-weight: 700;
  color: var(--gshell-text);
  text-align: center;
}

.gshell-banner[hidden],
.gshell-banner.is-hidden {
  display: none;
}

.gshell-banner--win {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.22);
}

.gshell-banner--draw {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.22);
}

.gshell-banner--lose {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.22);
}

.gshell-banner--info {
  background: color-mix(in srgb, var(--gshell-accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--gshell-accent) 22%, transparent);
}

.gshell-banner__title {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.gshell-banner__detail {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gshell-text-muted);
}

/* ---------------------------------------------------------------------------
   Action bar — flex / sticky / fixed, safe-area côté bas
---------------------------------------------------------------------------- */
.gshell-action-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  min-height: var(--gshell-tap-min);
  border-radius: var(--gshell-radius-lg);
  background: var(--gshell-surface);
  border: 1px solid var(--gshell-border);
}

.gshell-action-bar--sticky {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky, 1020);
  padding-bottom: max(10px, var(--safe-area-bottom, 0px));
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  background: color-mix(in srgb, var(--gshell-surface) 92%, transparent);
}

.gshell-action-bar--fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-fixed, 1030);
  border-radius: 0;
  padding-left: max(12px, var(--safe-area-left, 0px));
  padding-right: max(12px, var(--safe-area-right, 0px));
  padding-bottom: max(10px, var(--safe-area-bottom, 0px));
}

/* ---------------------------------------------------------------------------
   Buttons — primitives minimales, thémables via --gshell-accent
---------------------------------------------------------------------------- */
.gshell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  background: transparent;
  transition:
    transform 0.1s var(--ease-haptic, cubic-bezier(0.2, 0, 0, 1)),
    box-shadow 0.2s ease,
    opacity 0.2s ease,
    background-color 0.2s ease;
}

.gshell-btn:active:not([disabled]):not(.is-disabled) {
  transform: scale(0.97);
}

.gshell-btn--primary {
  color: var(--gshell-accent-fg);
  background: var(--gshell-accent);
  box-shadow: 0 8px 18px -8px var(--gshell-accent-glow);
}

.gshell-btn--secondary {
  color: var(--gshell-text);
  background: var(--gshell-surface-alt);
  border: 1px solid var(--gshell-border);
}

.gshell-btn--danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.gshell-btn--ghost {
  color: var(--gshell-text);
  background: transparent;
}

.gshell-btn--ghost:hover {
  background: var(--gshell-surface-alt);
}

.gshell-btn--block {
  width: 100%;
}

.gshell-btn[disabled],
.gshell-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------------------------------------------------------------------------
   Modal — overlay + surface + close + animation scale/slide
---------------------------------------------------------------------------- */
.gshell-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  padding-bottom: max(18px, var(--safe-area-bottom, 0px));
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal, 1050);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.gshell-modal-overlay.is-active,
.gshell-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.gshell-modal {
  position: relative;
  width: min(100%, 430px);
  max-height: calc(100vh - 40px);
  padding: 24px;
  background: var(--gshell-surface);
  border-radius: var(--gshell-radius-lg);
  box-shadow: var(--shadow-elevated, 0 20px 60px rgba(0, 0, 0, 0.3));
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}

.gshell-modal-overlay.is-active .gshell-modal,
.gshell-modal-overlay.active .gshell-modal {
  transform: scale(1) translateY(0);
}

.gshell-modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: 0;
  background: transparent;
  color: var(--gshell-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
}

.gshell-modal__close:hover {
  background: var(--gshell-surface-alt);
}

.gshell-modal__title {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gshell-text);
  padding-right: 32px;
}

/* Bottom-sheet variant (opt-in via .gshell-modal--sheet sur mobile) */
@media (max-width: 640px) {
  .gshell-modal--sheet {
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    padding-bottom: max(24px, var(--safe-area-bottom, 0px));
    transform: translateY(100%);
  }

  .gshell-modal-overlay--sheet {
    align-items: flex-end;
    padding: 0;
    padding-bottom: 0;
  }

  .gshell-modal-overlay--sheet.is-active .gshell-modal--sheet,
  .gshell-modal-overlay--sheet.active .gshell-modal--sheet {
    transform: translateY(0);
  }
}

/* ---------------------------------------------------------------------------
   Form primitives — utilisés dans modales, lobbies, formulaires de jeu
---------------------------------------------------------------------------- */
.gshell-form-group {
  margin-bottom: 16px;
}

.gshell-form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--gshell-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gshell-form-input,
.gshell-form-select,
.gshell-form-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--gshell-tap-min);
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--gshell-border);
  background: var(--gshell-surface-alt);
  color: var(--gshell-text);
  font-size: 0.92rem;
  font-family: inherit;
  transition:
    border-color var(--gshell-transition),
    box-shadow var(--gshell-transition);
}

.gshell-form-input:focus-visible,
.gshell-form-select:focus-visible,
.gshell-form-textarea:focus-visible {
  outline: none;
  border-color: var(--gshell-accent);
  box-shadow: var(--gshell-focus-ring);
}

.gshell-form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gshell-text);
  cursor: pointer;
  user-select: none;
}

/* ---------------------------------------------------------------------------
   Log panel — moves (grille), events (liste), collapsible
---------------------------------------------------------------------------- */
.gshell-log {
  padding: 12px;
  border-radius: var(--gshell-radius-lg);
  background: var(--gshell-surface);
  border: 1px solid var(--gshell-border);
  max-height: 260px;
  overflow-y: auto;
  font-size: 0.82rem;
  color: var(--gshell-text);
}

.gshell-log__item {
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: var(--gshell-surface-alt);
}

.gshell-log__item:last-child {
  margin-bottom: 0;
}

.gshell-log--moves {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 4px 10px;
  align-content: start;
}

.gshell-log__entry--system {
  color: var(--gshell-text-muted);
  font-style: italic;
}

.gshell-log__entry--highlight {
  color: var(--gshell-accent);
  font-weight: 700;
}

.gshell-log--collapsible[data-collapsed="true"] {
  max-height: 48px;
  overflow: hidden;
}

.gshell-log__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: 0;
  color: var(--gshell-text);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 768px) {
  .gshell-log {
    max-height: 160px;
  }
}

/* ---------------------------------------------------------------------------
   Tap feedback utility — applicable à toute cible tactile custom
---------------------------------------------------------------------------- */
.gshell-tap {
  transition: transform 0.1s var(--gshell-ease-haptic);
  -webkit-tap-highlight-color: transparent;
}

.gshell-tap:active:not([disabled]):not(.is-disabled) {
  transform: scale(0.96);
}

/* ---------------------------------------------------------------------------
   Focus-visible — anneau unifié clavier (tous les interactifs gshell)
---------------------------------------------------------------------------- */
.gshell-btn:focus-visible,
.gshell-tab:focus-visible,
.gshell-tap:focus-visible,
.gshell-modal__close:focus-visible,
.gshell-log__toggle:focus-visible,
.gshell-game-card:focus-visible {
  outline: none;
  box-shadow: var(--gshell-focus-ring);
}

/* ---------------------------------------------------------------------------
   States — génériques, combinables avec toute primitive
---------------------------------------------------------------------------- */
.is-hidden { display: none !important; }

.gshell-loading,
.is-loading {
  pointer-events: none;
  position: relative;
}

.gshell-loading::after,
.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--gshell-surface) 70%, transparent);
  border-radius: inherit;
  z-index: 1;
}

.gshell-busy {
  cursor: progress;
  opacity: 0.7;
}

/* ---------------------------------------------------------------------------
   Motion library — animations partagées (invalid move, win, slide-in, glow)
   Usage : ajouter la classe .gshell-anim-<nom>, éventuellement via JS
---------------------------------------------------------------------------- */
.gshell-anim-shake {
  animation: gshell-shake 0.35s var(--gshell-ease-haptic);
}

.gshell-anim-bounce {
  animation: gshell-bounce 0.5s var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
}

.gshell-anim-slide-up {
  animation: gshell-slide-up var(--gshell-motion-base) var(--gshell-ease) both;
}

.gshell-anim-fade-in {
  animation: gshell-fade-in var(--gshell-motion-base) var(--gshell-ease) both;
}

.gshell-anim-glow {
  animation: gshell-glow 1.2s var(--gshell-ease) infinite alternate;
}

.gshell-anim-flash {
  animation: gshell-flash 0.6s var(--gshell-ease);
}

@keyframes gshell-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes gshell-bounce {
  0% { transform: scale(0.9); opacity: 0; }
  60% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes gshell-slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes gshell-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes gshell-glow {
  from { box-shadow: 0 0 0 0 var(--gshell-accent-glow); }
  to { box-shadow: 0 0 0 8px color-mix(in srgb, var(--gshell-accent) 0%, transparent); }
}

@keyframes gshell-flash {
  0%, 100% { background-color: transparent; }
  50% { background-color: color-mix(in srgb, var(--gshell-accent) 25%, transparent); }
}

/* ---------------------------------------------------------------------------
   Theme helpers — 1 classe racine suffit pour habiller un jeu
   Usage  : <main class="gshell-page gshell-theme-connect4">
   Override fin : le {game}.css peut toujours surcharger les tokens ensuite.
---------------------------------------------------------------------------- */
.gshell-theme-connect4 {
  --gshell-accent: #2563eb;
  --gshell-accent-2: #1d4ed8;
  --gshell-accent-glow: rgba(37, 99, 235, 0.35);
}

.gshell-theme-chess {
  --gshell-accent: #daa520;
  --gshell-accent-2: #b8860b;
  --gshell-accent-glow: rgba(218, 165, 32, 0.35);
}

.gshell-theme-uno {
  --gshell-accent: #f59e0b;
  --gshell-accent-2: #d97706;
  --gshell-accent-glow: rgba(245, 158, 11, 0.35);
}

.gshell-theme-poker {
  --gshell-accent: #f1c40f;
  --gshell-accent-2: #d4a206;
  --gshell-accent-glow: rgba(241, 196, 15, 0.4);
}

.gshell-theme-monopoly {
  --gshell-accent: #2ecc71;
  --gshell-accent-2: #27ae60;
  --gshell-accent-glow: rgba(46, 204, 113, 0.35);
}

.gshell-theme-werewolf {
  --gshell-accent: #8b5cf6;
  --gshell-accent-2: #6d28d9;
  --gshell-accent-glow: rgba(139, 92, 246, 0.4);
  --gshell-board-bg: #0f0c1d;
}

/* ---------------------------------------------------------------------------
   A11y — sr-only + reduced motion blanket
---------------------------------------------------------------------------- */
.gshell-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .gshell-btn,
  .gshell-player,
  .gshell-modal,
  .gshell-modal-overlay,
  .gshell-tap,
  .gshell-tab,
  .gshell-game-card,
  .gshell-form-input,
  .gshell-form-select,
  .gshell-form-textarea {
    transition: none;
  }
  .gshell-pill--urgent,
  .gshell-anim-shake,
  .gshell-anim-bounce,
  .gshell-anim-slide-up,
  .gshell-anim-fade-in,
  .gshell-anim-glow,
  .gshell-anim-flash {
    animation: none;
  }
  .gshell-game-card:hover {
    transform: none;
  }
}
