/* ==========================================================================
   WRDL.GG — VIRAL 2027 HIGH-CRAFT TACTILE DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg: #0d0e12;
  --surface: #16181f;
  --surface-raised: #1e212b;
  --border: #2e3342;
  --border-light: #475066;
  --text: #ffffff;
  --text-muted: #8c96ab;

  --color-correct: #538d4e;
  --color-present: #b59f3b;
  --color-absent: #323744;
  --color-key-bg: #818898;

  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 10%, #161a26 0%, #0d0e12 85%);
}

.game-wrapper {
  width: 100%;
  max-width: 440px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .game-wrapper {
    padding-top: max(16px, env(safe-area-inset-top, 32px));
    padding-bottom: max(10px, env(safe-area-inset-bottom, 20px));
  }
}

/* ==========================================================================
   COMPACT 3D CUBE ROLLING LOGO & HEADER
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  gap: 4px;
  position: relative;
  z-index: 50;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo-cube-container {
  display: flex;
  align-items: center;
  gap: 2px;
  perspective: 600px;
  text-decoration: none;
  cursor: pointer;
}

.logo-letter {
  width: 19px;
  height: 24px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
  animation: rollInCube 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--i) * 0.06s) backwards;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-cube-container:hover .logo-letter {
  transform: rotateX(90deg);
}

.logo-letter .face-front,
.logo-letter .face-top {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  border-radius: 4px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  backface-visibility: hidden;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.logo-letter .face-front {
  transform: rotateX(0deg) translateZ(12px);
}

.logo-letter .face-top {
  transform: rotateX(-90deg) translateZ(12px);
  background: #252936;
  color: #38bdf8;
}

.logo-suffix {
  font-size: 13px;
  font-weight: 900;
  color: var(--color-correct);
  letter-spacing: -0.02em;
  margin-left: 2px;
  text-transform: lowercase;
}

@keyframes rollInCube {
  0% { transform: rotateX(-90deg) translateY(-8px); opacity: 0; }
  100% { transform: rotateX(0deg) translateY(0); opacity: 1; }
}

.room-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.room-tag-btn:hover, .room-tag-btn:active {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.lang-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 800;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.lang-tag-btn:hover, .lang-tag-btn:active {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.6);
}

.lang-tag-btn.locked {
  opacity: 0.6;
  cursor: default;
}

.lang-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.lang-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-picker-option:hover, .lang-picker-option:active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  color: #38bdf8;
}

.lang-picker-option.active {
  background: rgba(83, 141, 78, 0.2);
  border-color: var(--color-correct);
  color: #4ade80;
}

.lang-picker-option .opt-flag {
  font-size: 18px;
  margin-right: 8px;
}

.lang-picker-option .opt-check {
  font-size: 14px;
  font-weight: 900;
}

.room-qr-icon {
  font-size: 11px;
  line-height: 1;
}

.nav-btn, .invite-btn, .leave-btn {
  width: 27px;
  height: 27px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 60;
  pointer-events: auto;
  touch-action: manipulation;
}

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

.nav-btn:active {
  transform: scale(0.92);
  background: var(--border-light);
}

.invite-btn {
  background: var(--color-correct);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 6px rgba(83, 141, 78, 0.3);
}

.invite-btn:active {
  transform: scale(0.92);
}

.leave-btn {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.leave-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
}

.leave-btn:active {
  transform: scale(0.92);
}

.turn-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pass-turn-btn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
}

.pass-turn-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.5);
}

.pass-turn-btn:active {
  transform: scale(0.94);
}

.pass-turn-btn.hidden {
  display: none !important;
}

.take-turn-btn {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
}

.take-turn-btn:hover {
  background: rgba(56, 189, 248, 0.28);
  border-color: rgba(56, 189, 248, 0.6);
}

.take-turn-btn:active {
  transform: scale(0.94);
}

.take-turn-btn.hidden {
  display: none !important;
}

/* ==========================================================================
   PLAYERS STRIP & SLEEK TURN STATUS PILL
   ========================================================================== */
.players-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 3px 2px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.players-strip::-webkit-scrollbar { display: none; }

.player-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5px 8px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.player-tag.is-you {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

.player-tag.active {
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.player-tag.offline {
  opacity: 0.4;
}

.player-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Sleek Status Pill (Replacing chunky text) */
.turn-pill-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3px 0 1px;
  flex-shrink: 0;
}

.turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 16px;
  background: rgba(22, 24, 31, 0.85);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.25s ease;
}

.turn-pill.is-active {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.08);
  color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.16);
}

.turn-pill.is-victory {
  border-color: rgba(83, 141, 78, 0.5);
  background: rgba(83, 141, 78, 0.12);
  color: #538d4e;
}

.turn-pill.is-loss {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.1);
  color: #f43f5e;
}

.turn-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.turn-pill.is-active .turn-indicator-dot {
  animation: pulseGlow 1.2s infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

/* ==========================================================================
   BOARD GRID (6 x 5) — ROCK-SOLID WEIGHTY PHYSICS
   ========================================================================== */
.board-area {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
  padding: 2px 0;
}

.grid {
  display: flex;
  flex-direction: column;
  gap: min(5px, 0.7vh);
  height: 100%;
  max-height: min(42vh, 340px);
  width: 100%;
  max-width: min(340px, 92vw);
}

.grid-row {
  display: flex;
  align-items: center;
  gap: min(5px, 0.7vh);
  flex: 1;
  min-height: 0;
}

.row-meta {
  width: 40px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  text-align: right;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.row-tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: min(5px, 0.7vh);
  flex: 1;
  height: 100%;
}

.tile {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  perspective: 1000px;
  display: block;
}

.tile-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tile.flip .tile-inner {
  transform: rotateX(180deg);
}

.tile-front, .tile-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: min(24px, 3.8vh);
  font-weight: 800;
  text-transform: uppercase;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 5px;
}

.tile-front {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.tile-front .main-char {
  font-size: min(24px, 3.8vh);
  font-weight: 800;
  line-height: 1;
  display: block;
}

/* Weighty Rock-Solid Tile Drop Settle Animation */
.tile.dropped .tile-front {
  animation: tileDropSettle 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
}

@keyframes tileDropSettle {
  0% {
    transform: translateY(-4px) scale(1.06);
    border-color: var(--border-light);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  }
  60% {
    transform: translateY(1.5px) scale(0.97);
    border-color: #38bdf8;
  }
  100% {
    transform: translateY(0) scale(1);
    border-color: var(--border-light);
  }
}

/* Multi-Player Mini Suggestion Pills Row on top of tile */
.sugg-row {
  position: absolute;
  top: 2px;
  left: 1px;
  right: 1px;
  display: flex;
  justify-content: center;
  gap: 2px;
  z-index: 5;
  pointer-events: none;
}

.mini-sugg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: min(8.5px, 1.3vh);
  font-weight: 900;
  width: min(13px, 2vh);
  height: min(13px, 2vh);
  border-radius: 3px;
  background: rgba(13, 14, 18, 0.92);
  border: 1px solid currentColor;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  line-height: 1;
}

.tile-back {
  transform: rotateX(180deg);
  color: white;
  border: 2px solid transparent;
}

.tile-back.correct {
  background: var(--color-correct) !important;
  border-color: var(--color-correct) !important;
}

.tile-back.present {
  background: var(--color-present) !important;
  border-color: var(--color-present) !important;
}

.tile-back.absent {
  background: var(--color-absent) !important;
  border-color: var(--color-absent) !important;
}

/* Wordle Victory Bounce Wave */
.tile.bounce {
  animation: bounceWave 0.5s cubic-bezier(0.28, 0.84, 0.42, 1);
}

@keyframes bounceWave {
  0%, 20% { transform: translateY(0); }
  40% { transform: translateY(-18px); }
  50% { transform: translateY(0); }
  60% { transform: translateY(-6px); }
  80%, 100% { transform: translateY(0); }
}

.grid-row.shake {
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* ==========================================================================
   KEYBOARD — TACTILE MECHANICAL FEEL
   ========================================================================== */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: min(4.5px, 0.6vh);
  flex-shrink: 0;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: 3.5px;
}

.spacer.half {
  flex: 0.5;
}

.key {
  height: min(46px, 5.8vh);
  flex: 1;
  max-width: 40px;
  background: var(--color-key-bg);
  border: none;
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font);
  font-size: min(15px, 2.2vh);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, background 0.12s ease;
}

.key.action-key {
  max-width: 58px;
  flex: 1.5;
  font-size: min(11px, 1.8vh);
  font-weight: 800;
}

.keyboard.lang-ru .key {
  max-width: 32px;
  font-size: min(13.5px, 2vh);
}

.keyboard.lang-ru .key.action-key {
  max-width: 44px;
  font-size: min(10px, 1.4vh);
}

.keyboard.lang-es .key {
  max-width: 36px;
}

.keyboard.lang-es .key.action-key {
  max-width: 52px;
}

.key:active {
  transform: translateY(2px);
  box-shadow: none;
  background: #5b6272;
}

.key.correct {
  background: var(--color-correct) !important;
  color: white !important;
}

.key.present {
  background: var(--color-present) !important;
  color: white !important;
}

.key.absent {
  background: var(--color-absent) !important;
  color: #64748b !important;
  opacity: 0.55;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #151821;
  border: 1px solid #2d3345;
  border-radius: 16px;
  padding: 20px 18px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.85);
  position: relative;
  overflow: hidden;
}

.modal-card.victory-card {
  border-color: rgba(83, 141, 78, 0.5);
  background: radial-gradient(circle at 50% 0%, rgba(83, 141, 78, 0.15) 0%, #151821 70%);
}

.victory-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.victory-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 4px 12px rgba(250, 204, 21, 0.4));
}

.result-header {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #538d4e;
}

.result-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

/* Solution Reveal in 3D Tile Caps */
.solution-reveal-container {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.solution-title {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.solution-tiles {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.sol-tile {
  width: 38px;
  height: 42px;
  background: #538d4e;
  border: 1px solid #6ab063;
  border-radius: 6px;
  color: white;
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.sol-tile.loss {
  background: #334155;
  border-color: #475569;
}

/* Team Contribution Chips */
.team-contrib {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 0 4px;
}

.contrib-chip {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Emoji Preview Box */
.share-preview-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.share-preview {
  font-family: monospace;
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 3px;
  display: inline-block;
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.btn-share-grid {
  background: linear-gradient(135deg, #538d4e 0%, #3ca746 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(83, 141, 78, 0.4);
  transition: all 0.15s ease;
}

.btn-share-grid:active {
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(83, 141, 78, 0.3);
}

.btn-next-word {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.15s ease;
}

.btn-next-word:active {
  transform: scale(0.97);
}

/* Toast */
.toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #ffffff;
  color: #000000;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 200;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Retro / Neon Live Counter Button */
.live-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
}

.live-tag-btn:hover, .live-tag-btn:active {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.6);
  transform: scale(1.03);
}

.live-dot-pulse {
  width: 6px;
  height: 6px;
  background-color: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
  animation: radarPulse 1.6s ease-in-out infinite;
}

@keyframes radarPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #22c55e; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Lobby Modal Styles */
.lobby-tab {
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.lobby-tab.active {
  background: #538d4e;
  color: #ffffff;
  border-color: #538d4e;
  box-shadow: 0 2px 8px rgba(83, 141, 78, 0.4);
}

.lobby-room-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  transition: all 0.15s ease;
  text-align: left;
}

.lobby-room-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.04);
}

.lobby-room-card.is-current {
  border-color: #538d4e;
  background: rgba(83, 141, 78, 0.08);
}

.lobby-room-card .card-tag {
  font-size: 13px;
  font-weight: 900;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lobby-room-card .card-meta {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 2px;
}

.lobby-room-card .card-btn {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lobby-room-card .card-btn:hover {
  background: #1d4ed8;
}

.lobby-room-card .card-btn.current {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: default;
}

.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-height: 640px) {
  .key { height: 42px; font-size: 14px; }
  .grid { max-height: 310px; }
}
