/* Maneggio Virtuale — stili scoped. Tutto prefissato .gr-game-*. */

.gr-game-body {
  margin: 0;
  background: #1a1a1a;
  color: #fbf5e8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  height: 100vh;
}

.gr-game-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;
}

.gr-game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gr-game-loading {
  text-align: center;
}

.gr-game-loading-title {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  font-weight: 300;
}

.gr-game-loading-sub {
  font-size: 1rem;
  margin: 0;
  opacity: 0.7;
}

.gr-game-exit {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  color: #fbf5e8;
  text-decoration: none;
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.2);
}

.gr-game-exit:hover { background: rgba(0,0,0,0.7); }

/* ==== Touch controls ==== */
.gr-game-touch-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.gr-game-touch-overlay > * {
  pointer-events: auto;
}

.gr-game-joystick {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  border: 2px solid rgba(255,255,255,0.5);
  touch-action: none;
}

.gr-game-joystick-stick {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  pointer-events: none;
}

.gr-game-gait-buttons {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.gr-game-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.45);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.gr-game-btn:active {
  background: rgba(255,255,255,0.25);
}

.gr-game-btn-pause {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

/* Mostra touch overlay solo su pointer:coarse */
@media (pointer: fine) {
  .gr-game-touch-overlay { display: none; }
}

/* Orientation lock overlay */
.gr-game-orient {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  color: #fbf5e8;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  text-align: center;
  padding: 2rem;
  font-size: 1.1rem;
}

@media (orientation: portrait) and (pointer: coarse) {
  .gr-game-orient { display: flex; }
}

/* ==== Menu modalità ==== */
.gr-game-menu {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 8, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  z-index: 50;
}
.gr-game-menu h2 {
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
  font-weight: 300;
  letter-spacing: 0.05em;
}
.gr-game-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  max-width: 720px;
  width: 100%;
}
.gr-game-mode {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fbf5e8;
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: inherit;
}
.gr-game-mode:hover:not(:disabled) {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.4);
}
.gr-game-mode:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.gr-game-mode strong {
  font-size: 1.05rem;
  font-weight: 500;
}
.gr-game-mode span {
  font-size: 0.85rem;
  opacity: 0.75;
}
.gr-game-back {
  margin-top: 1.5rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fbf5e8;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
}

/* ==== Overlay (pause / risultati) ==== */
.gr-game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}
.gr-game-overlay-card {
  background: #2b1a12;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  text-align: center;
}
.gr-game-overlay-card h3 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  font-weight: 400;
}
.gr-game-overlay-score {
  font-size: 1.1rem;
  margin: 0.5rem 0;
}
.gr-game-overlay-best {
  color: #ffd166;
  margin: 0.5rem 0;
}
.gr-game-overlay-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.gr-game-overlay-btn {
  background: #c9311e;
  border: none;
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}
.gr-game-overlay-btn:hover { background: #a02416; }

/* ==== Scuderia ==== */
.gr-game-stable {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #2b1a12 0%, #4a2818 100%);
  overflow-y: auto;
  padding: 1.5rem;
  z-index: 30;
}
.gr-game-stable-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.gr-game-stable-header h2 {
  font-size: 1.8rem;
  font-weight: 300;
  margin: 0 0 0.3rem;
}
.gr-game-stable-header p {
  margin: 0;
  opacity: 0.7;
  font-size: 0.95rem;
}
.gr-game-stable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}
.gr-game-stable-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  gap: 0.9rem;
  align-items: center;
  text-align: left;
  color: #fbf5e8;
  font-family: inherit;
  transition: all 0.2s ease;
}
.gr-game-stable-card:hover {
  background: rgba(255,255,255,0.13);
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.35);
}
.gr-game-portrait {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gr-game-portrait svg { width: 48px; height: 48px; }
.gr-game-card-body { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.gr-game-card-body strong { font-size: 1.05rem; font-weight: 500; }
.gr-game-card-breed { font-size: 0.78rem; opacity: 0.75; }
.gr-game-card-temp { font-size: 0.78rem; color: #ffd166; }
.gr-game-stats {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  opacity: 0.85;
}

.gr-game-canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #1a1a1a;
}

/* === MP name dialog === */
.gr-mp-namedialog {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  font-family: system-ui, sans-serif;
}
.gr-mp-namedialog-box {
  background: #fbf5e8; color: #1a1a1a; padding: 1.5rem 1.75rem;
  border-radius: 10px; max-width: 380px; width: calc(100% - 2rem);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.gr-mp-namedialog-box h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.gr-mp-namedialog-box p { margin: 0.4rem 0; font-size: 0.9rem; }
.gr-mp-namedialog-box input[type="text"] {
  width: 100%; padding: 0.6rem 0.7rem; font-size: 1rem; box-sizing: border-box;
  border: 2px solid #c9311e; border-radius: 6px; background: #fff;
  margin-top: 0.5rem;
}
.gr-mp-namedialog-hint { font-size: 0.8rem; opacity: 0.7; }
.gr-mp-namedialog-error { color: #c9311e; font-size: 0.85rem; min-height: 1.2em; }
.gr-mp-namedialog-box button {
  margin-top: 0.7rem; width: 100%; padding: 0.7rem; font-size: 1rem;
  background: #c9311e; color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
.gr-mp-namedialog-box button:hover { background: #a8281a; }

/* === MP chat HUD === */
.gr-chat-hud {
  position: fixed; bottom: 0.5rem; left: 0.5rem; pointer-events: none;
  font-family: system-ui, sans-serif; max-width: 60vw; z-index: 100;
}
.gr-chat-list { list-style: none; margin: 0; padding: 0; }
.gr-chat-msg {
  background: rgba(0,0,0,0.55); color: #fbf5e8; padding: 0.3rem 0.6rem;
  margin-top: 0.2rem; border-radius: 4px; font-size: 0.85rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.7);
  transition: opacity 0.5s linear;
}
.gr-chat-msg.fade { opacity: 0; }
.gr-chat-msg strong { color: #ffd166; margin-right: 0.3rem; }
.gr-chat-input { pointer-events: auto; margin-top: 0.5rem; }
.gr-chat-input input {
  width: 320px; padding: 0.5rem 0.7rem;
  border: 2px solid #c9311e; border-radius: 4px;
  background: rgba(255,255,255,0.95); font-size: 0.9rem;
}

/* === MP emote wheel === */
.gr-emote-wheel {
  position: fixed; right: 0.5rem; bottom: 4rem; z-index: 100;
  display: flex; gap: 0.4rem;
  background: rgba(0,0,0,0.6); padding: 0.4rem; border-radius: 8px;
}
.gr-emote-wheel button {
  font-size: 1.5rem; padding: 0.4rem 0.6rem;
  background: #fbf5e8; border: 2px solid #c9311e; border-radius: 4px;
  cursor: pointer;
}
.gr-emote-wheel button:hover { background: #ffd166; }

.gr-mode-lb { display: block; font-size: 0.78rem; opacity: 0.85; color: #ffd166; margin-top: 0.3rem; }
