* {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
    }
    body, html {
      width: 100%;
      height: 100%;
      overflow: hidden;
      background: #05080e;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    }
    #canvas-container {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
    }

    #cinematic-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 5;
      background: radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 45%, rgba(4, 7, 12, 0.45) 80%, rgba(1, 3, 6, 0.85) 100%);
      mix-blend-mode: multiply;
    }

    #grain-canvas {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 6;
      opacity: 0.055;
      mix-blend-mode: overlay;
    }

    #crosshair {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 6px;
      height: 6px;
      pointer-events: none;
      display: none;
      z-index: 10;
    }
    #crosshair::before, #crosshair::after {
      content: '';
      position: absolute;
      background: rgba(235, 245, 255, 0.85);
      box-shadow: 0 0 3px rgba(0,0,0,0.9);
    }
    #crosshair::before { top: 2px; left: -5px; width: 16px; height: 2px; }
    #crosshair::after { top: -5px; left: 2px; width: 2px; height: 16px; }

    #hud {
      position: absolute;
      top: 18px;
      left: 20px;
      color: #e2e8f0;
      font-size: 13px;
      background: rgba(10, 15, 24, 0.84);
      backdrop-filter: blur(8px);
      padding: 12px 18px;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      pointer-events: none;
      z-index: 20;
      box-shadow: 0 4px 16px rgba(0,0,0,0.6);
    }
    #hud .title {
      font-weight: 700;
      color: #38bdf8;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      font-size: 11px;
      margin-bottom: 2px;
    }
    #hud .loc {
      font-size: 14px;
      font-weight: 600;
      color: #f8fafc;
      margin-bottom: 4px;
    }
    #hud .online-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      font-weight: 500;
      color: #4ade80;
      margin-top: 2px;
    }
    #hud .online-badge .dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #22c55e;
      box-shadow: 0 0 6px #22c55e;
    }
    #hud .hint {
      font-size: 11px;
      color: #94a3b8;
      margin-top: 4px;
    }

        #voice-indicator {
      position: absolute;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(15, 23, 42, 0.88);
      backdrop-filter: blur(8px);
      padding: 9px 20px;
      border-radius: 30px;
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: #f1f5f9;
      font-size: 14px;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 10px;
      pointer-events: none;
      z-index: 10;
      transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
      white-space: nowrap;
    }
    #voice-indicator .v-icon { font-size: 17px; }
    #voice-indicator #voice-status-text {
      min-width: 260px;
      text-align: center;
      display: inline-block;
    }
    #voice-indicator .v-meter {
      display: inline-block;
      width: 40px;
      height: 7px;
      background: rgba(0, 0, 0, 0.4);
      border-radius: 4px;
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.2);
      flex-shrink: 0;
    }
    #voice-indicator .v-meter-fill {
      display: block;
      width: 0%;
      height: 100%;
      background: #4ade80;
      border-radius: 4px;
      transition: width 0.05s linear;
    }
    #voice-indicator.talking {
      background: rgba(22, 163, 74, 0.95);
      border-color: #86efac;
      box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
      color: #ffffff;
      font-weight: 600;
    }
    #voice-indicator.talking .v-meter-fill {
      background: #86efac;
    }
    #voice-indicator.denied {
      background: rgba(220, 38, 38, 0.88);
      border-color: #fca5a5;
    }

    #top-bar-controls {
      position: absolute;
      top: 18px;
      right: 20px;
      display: flex;
      gap: 10px;
      z-index: 50;
    }
    .top-btn {
      background: rgba(15, 23, 42, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.18);
      color: #e2e8f0;
      padding: 9px 15px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      transition: all 0.2s;
      box-shadow: 0 4px 16px rgba(0,0,0,0.6);
      user-select: none;
    }
    .top-btn:hover {
      background: rgba(30, 41, 59, 1);
      border-color: rgba(255, 255, 255, 0.35);
      color: #38bdf8;
    }
    #camera-toggle-btn, #fullscreen-btn, #menu-btn {
      /* И наследуют .top-btn */
    }

    #modal-close-btn {
      position: absolute;
      top: 14px;
      right: 16px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: #94a3b8;
      width: 32px;
      height: 32px;
      border-radius: 6px;
      font-size: 16px;
      cursor: pointer;
      display: none;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }
    #modal-close-btn:hover {
      background: rgba(239, 68, 68, 0.25);
      color: #f87171;
      border-color: rgba(239, 68, 68, 0.4);
    }

    #blocker {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(5, 8, 14, 0.82);
      backdrop-filter: blur(10px);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      color: #fff;
      cursor: pointer;
      z-index: 100;
      transition: opacity 0.2s ease;
    }
    .modal-box {
      background: rgba(14, 20, 31, 0.96);
      border: 1px solid rgba(255, 255, 255, 0.14);
      padding: 24px 30px;
      border-radius: 14px;
      text-align: center;
      max-width: 860px;
      width: 92%;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 25px 60px rgba(0,0,0,0.9);
      box-sizing: border-box;
    }
    .modal-header {
      margin-bottom: 18px;
      text-align: center;
    }
    .modal-badge {
      display: inline-block;
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 1px;
      color: #38bdf8;
      background: rgba(56, 189, 248, 0.12);
      border: 1px solid rgba(56, 189, 248, 0.28);
      padding: 2px 10px;
      border-radius: 20px;
      margin-bottom: 6px;
      text-transform: uppercase;
    }
    .modal-box h1 {
      font-size: 22px;
      margin: 0 0 4px 0;
      color: #f1f5f9;
      font-weight: 800;
      letter-spacing: 0.5px;
    }
    .modal-box .subtitle {
      font-size: 13px;
      color: #94a3b8;
      margin: 0;
      line-height: 1.4;
    }

    .modal-columns {
      display: flex;
      gap: 20px;
      text-align: left;
      align-items: stretch;
    }
    .modal-col-left {
      flex: 0 0 310px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      background: rgba(10, 15, 26, 0.65);
      padding: 16px 18px;
      border-radius: 10px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      box-sizing: border-box;
    }
    .modal-col-right {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
      box-sizing: border-box;
    }
    .modal-section-title {
      font-size: 11.5px;
      font-weight: 700;
      color: #38bdf8;
      text-transform: uppercase;
      letter-spacing: 0.6px;
      margin-bottom: 2px;
    }

    .gender-container {
      margin-bottom: 4px;
    }
    .gender-btn-group {
      display: flex;
      gap: 8px;
    }
    .gender-btn {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      background: #0b1120;
      border: 1px solid rgba(255, 255, 255, 0.22);
      border-radius: 6px;
      padding: 9px 12px;
      color: #94a3b8;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      user-select: none;
    }
    .gender-btn:hover {
      background: #1e293b;
      color: #f8fafc;
      border-color: rgba(255, 255, 255, 0.4);
    }
    .gender-btn.active {
      background: rgba(56, 189, 248, 0.18);
      border-color: #38bdf8;
      color: #38bdf8;
      box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    }

    .mic-container {
      margin-bottom: 4px;
    }
    .btn-mic {
      width: 100%;
      background: #1e293b;
      color: #f1f5f9;
      border: 1px solid rgba(255, 255, 255, 0.2);
      padding: 10px 14px;
      font-size: 13.5px;
      font-weight: 600;
      border-radius: 6px;
      cursor: pointer;
      transition: background 0.2s, transform 0.1s, border-color 0.2s;
      display: block;
      box-sizing: border-box;
      text-align: center;
    }
    .btn-mic:hover { background: #334155; }
    .btn-mic.active { background: #16a34a; border-color: #86efac; color: #ffffff; }
    .btn-mic.error { background: #dc2626; border-color: #fca5a5; color: #ffffff; }

    .modal-actions-box {
      margin-top: 6px;
      padding-top: 0;
    }
    .btn-start {
      width: 100%;
      background: linear-gradient(135deg, #0284c7, #0369a1);
      color: white;
      border: none;
      padding: 12px 20px;
      font-size: 15px;
      font-weight: 700;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
      display: block;
      box-sizing: border-box;
      text-align: center;
      margin-bottom: 8px;
      box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
    }
    .btn-start:hover {
      background: linear-gradient(135deg, #0369a1, #075985);
      transform: translateY(-1px);
      box-shadow: 0 6px 18px rgba(2, 132, 199, 0.6);
    }
    .btn-start:active {
      transform: translateY(1px);
    }
    .btn-yard-guide {
      width: 100%;
      background: linear-gradient(135deg, #ea580c, #c2410c);
      color: #fff;
      border: 1px solid rgba(251, 146, 60, 0.5);
      padding: 10px 12px;
      font-size: 13px;
      font-weight: 700;
      border-radius: 8px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      margin-top: 10px;
      margin-bottom: 6px;
      box-shadow: 0 4px 14px rgba(234, 88, 12, 0.4);
      transition: all 0.18s ease;
      user-select: none;
    }
    .btn-yard-guide:hover {
      background: linear-gradient(135deg, #f97316, #ea580c);
      box-shadow: 0 6px 18px rgba(234, 88, 12, 0.6);
      transform: translateY(-1px);
    }
    .btn-yard-guide:active {
      transform: translateY(1px);
    }
    .modal-quick-hint {
      font-size: 11px;
      color: #64748b;
      text-align: center;
      line-height: 1.35;
    }

    .controls-categories-list {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      height: 100%;
    }
    .ctrl-card {
      background: rgba(10, 15, 26, 0.65);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 8px;
      padding: 9px 12px;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
    }
    .ctrl-card-header {
      font-size: 11px;
      font-weight: 700;
      color: #38bdf8;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 6px;
      padding-bottom: 4px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }
    .ctrl-card-body {
      display: flex;
      flex-direction: column;
      gap: 5px;
    }
    .ctrl-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      font-size: 11.5px;
      color: #cbd5e1;
    }
    .ctrl-row span.key {
      background: #1e293b;
      padding: 2px 6px;
      border-radius: 4px;
      color: #f1f5f9;
      font-weight: 700;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 11px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      flex-shrink: 0;
      white-space: nowrap;
    }
    .ctrl-row span.key.highlight-q {
      color: #38bdf8;
      border-color: rgba(56, 189, 248, 0.4);
      background: rgba(56, 189, 248, 0.12);
    }
    .ctrl-row span.key.highlight-g {
      color: #f59e0b;
      border-color: rgba(245, 158, 11, 0.4);
      background: rgba(245, 158, 11, 0.12);
    }
    .ctrl-row span.key.highlight-v {
      color: #4ade80;
      border-color: rgba(74, 222, 128, 0.4);
      background: rgba(74, 222, 128, 0.12);
    }

    @media (max-width: 820px) {
      .modal-box {
        padding: 20px 18px;
      }
      .modal-columns {
        flex-direction: column;
        gap: 14px;
      }
      .modal-col-left {
        flex: auto;
      }
      .controls-categories-list {
        grid-template-columns: 1fr;
      }
    }

    .nickname-container {
      margin-bottom: 18px;
      text-align: left;
    }
    .nickname-label {
      display: block;
      font-size: 12px;
      color: #94a3b8;
      margin-bottom: 6px;
      font-weight: 600;
      letter-spacing: 0.3px;
    }
    #nickname-input {
      width: 100%;
      background: #0b1120;
      border: 1px solid rgba(255, 255, 255, 0.22);
      border-radius: 6px;
      padding: 11px 14px;
      color: #f8fafc;
      font-size: 15px;
      font-weight: 600;
      outline: none;
      box-sizing: border-box;
      transition: all 0.2s ease;
    }
    #nickname-input:focus {
      border-color: #38bdf8;
      background: #0f172a;
      box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
    }
    #nickname-input::placeholder {
      color: #64748b;
      font-weight: 400;
    }

    /* --- TEXT CHAT STYLES --- */
    #chat-container {
      position: absolute;
      bottom: 24px;
      left: 20px;
      width: 390px;
      max-width: calc(100vw - 40px);
      z-index: 35;
      display: flex;
      flex-direction: column;
      gap: 8px;
      pointer-events: none;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    #chat-messages {
      max-height: 210px;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 5px;
      padding-right: 4px;
      scrollbar-width: thin;
      scrollbar-color: rgba(255,255,255,0.2) transparent;
      pointer-events: auto;
    }
    #chat-messages::-webkit-scrollbar {
      width: 4px;
    }
    #chat-messages::-webkit-scrollbar-thumb {
      background: rgba(255,255,255,0.25);
      border-radius: 4px;
    }
    .chat-msg {
      background: rgba(10, 15, 24, 0.82);
      backdrop-filter: blur(8px);
      padding: 6px 12px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      font-size: 13px;
      line-height: 1.4;
      color: #f1f5f9;
      word-break: break-word;
      box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    }
    .chat-msg.system {
      color: #38bdf8;
      font-style: italic;
      font-size: 12px;
      background: rgba(15, 23, 42, 0.7);
      border-color: rgba(56, 189, 248, 0.2);
    }
    .chat-time {
      color: #64748b;
      font-size: 11px;
      margin-right: 6px;
      font-family: monospace;
    }
    .chat-author {
      font-weight: 700;
      margin-right: 6px;
    }
    #chat-input-wrapper {
      display: flex;
      pointer-events: auto;
    }
    #chat-input {
      width: 100%;
      background: rgba(10, 15, 24, 0.85);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 6px;
      padding: 9px 14px;
      color: #f8fafc;
      font-size: 13px;
      outline: none;
      transition: all 0.2s ease;
      box-shadow: 0 4px 14px rgba(0,0,0,0.5);
    }
    #chat-input:focus {
      background: rgba(15, 23, 42, 0.96);
      border-color: #38bdf8;
      box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
    }
    #chat-input::placeholder {
      color: #64748b;
    }

    /* --- COORDS HUD & CLIPBOARD NOTIFICATION --- */
    #coords-hud {
      position: absolute;
      top: 68px;
      right: 20px;
      color: #e2e8f0;
      background: rgba(10, 15, 24, 0.88);
      backdrop-filter: blur(8px);
      padding: 10px 14px;
      border-radius: 8px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      z-index: 40;
      box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65);
      display: flex;
      flex-direction: column;
      gap: 6px;
      pointer-events: auto;
      user-select: none;
      min-width: 250px;
    }
    .coords-title {
      font-size: 11px;
      font-weight: 700;
      color: #38bdf8;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 2px;
    }
    .coords-title .subhint {
      font-size: 10px;
      color: #94a3b8;
      font-weight: 400;
      text-transform: none;
    }
    .coords-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      background: rgba(255, 255, 255, 0.05);
      padding: 5px 10px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .coords-row:hover {
      background: rgba(56, 189, 248, 0.15);
      border-color: rgba(56, 189, 248, 0.45);
      transform: translateX(-2px);
    }
    .coords-row:active {
      transform: scale(0.98);
    }
    .coords-row.flash-copied {
      background: rgba(56, 189, 248, 0.35) !important;
      border-color: #38bdf8 !important;
      box-shadow: 0 0 14px rgba(56, 189, 248, 0.6) !important;
      transform: scale(1.02);
    }
    .coords-row.flash-copied-aim {
      background: rgba(16, 185, 129, 0.35) !important;
      border-color: #10b981 !important;
      box-shadow: 0 0 14px rgba(16, 185, 129, 0.6) !important;
      transform: scale(1.02);
    }
    .coords-left {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .coords-badge {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: #0284c7;
      color: #ffffff;
      font-weight: 700;
      font-size: 10px;
      padding: 2px 6px;
      border-radius: 4px;
      letter-spacing: 0.3px;
    }
    .coords-badge.target-badge {
      background: #10b981;
    }
    .coords-label-text {
      font-size: 12px;
      font-weight: 500;
      color: #cbd5e1;
    }
    .coords-val {
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      color: #f8fafc;
      font-weight: 600;
      font-size: 12px;
      letter-spacing: 0.2px;
    }

    #copy-toast {
      position: fixed;
      top: 24px;
      left: 50%;
      transform: translateX(-50%) translateY(-10px);
      background: rgba(16, 185, 129, 0.95);
      backdrop-filter: blur(10px);
      color: #ffffff;
      padding: 10px 20px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 16px rgba(16, 185, 129, 0.4);
      z-index: 10000;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.25s ease, transform 0.25s ease;
      white-space: pre-line;
      text-align: center;
      line-height: 1.45;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      border: 1px solid rgba(255, 255, 255, 0.3);
    }
    #copy-toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }


    /* FPS Meter в углу экрана */
    #fps-hud {
      position: absolute;
      bottom: 20px;
      right: 20px;
      background: rgba(10, 15, 24, 0.85);
      backdrop-filter: blur(8px);
      padding: 6px 12px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.14);
      color: #f1f5f9;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      font-size: 13px;
      font-weight: 700;
      z-index: 45;
      pointer-events: none;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
      display: flex;
      align-items: center;
      gap: 8px;
      user-select: none;
    }
    #fps-hud .fps-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #4ade80;
      box-shadow: 0 0 8px #4ade80;
      transition: background 0.3s ease, box-shadow 0.3s ease;
    }

/* =========================================================================
   INTERACTION HUD PROMPT ([F] Открыть / Закрыть дверку)
   ========================================================================= */
#interaction-prompt {
  position: absolute;
  top: calc(50% + 34px);
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  background: rgba(15, 23, 42, 0.90);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 16px rgba(56, 189, 248, 0.3);
  color: #f8fafc;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  user-select: none;
}

#interaction-prompt.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

/* При сидении за столом плашка плавно опускается к нижней части экрана (над плашкой микрофона) */
#interaction-prompt.bench-sitting-mode {
  top: auto !important;
  bottom: 82px !important;
  transform: translateX(-50%) scale(1) !important;
}

.interaction-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: keyPulse 1.8s infinite ease-in-out;
}

@keyframes keyPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 4px rgba(0,0,0,0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 10px rgba(56, 189, 248, 0.7); }
}

#interaction-text {
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.interaction-key.sec-key {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1c1917;
}
.interaction-key.fire-key {
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  animation: fireKeyPulse 1.2s infinite ease-in-out;
}
@keyframes fireKeyPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
  50% { transform: scale(1.1); box-shadow: 0 0 14px rgba(249, 115, 22, 0.9); }
}

/* Индикатор удержания клавиши для вставания со скамейки */
.bench-hold-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 210px;
}
.bench-hold-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bench-hold-progress-bg {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
.bench-hold-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #f59e0b);
  border-radius: 4px;
  width: 0%;
  transition: width 0.04s linear;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
}

/* ========================================================================= */
/* РАДИАЛЬНОЕ КРУГОВОЕ МЕНЮ ЭМОЦИЙ (Q) И ДЕЙСТВИЙ (G)                        */
/* ========================================================================= */
#radial-wheel-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  pointer-events: none;
  user-select: none;
}

.radial-wheel-box {
  position: relative;
  width: 400px;
  height: 400px;
  animation: radialWheelPop 0.16s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes radialWheelPop {
  0% { transform: scale(0.82); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.radial-wheel-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 14px 40px rgba(0, 0, 0, 0.85));
}

.radial-sector-path {
  fill: rgba(15, 23, 42, 0.88);
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1.5;
  transition: fill 0.12s ease, stroke 0.12s ease;
}

.radial-sector-path.selected {
  stroke-width: 3.5;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.75));
}

.radial-sector-divider {
  stroke: rgba(255, 255, 255, 0.20);
  stroke-width: 1.5;
}

.radial-items-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.radial-sector-item {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  transition: transform 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.12s ease;
}

.radial-sector-item.selected {
  transform: translate(calc(-50% + var(--pos-x, 0px)), calc(-50% + var(--pos-y, 0px))) scale(1.18) !important;
  filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.9));
}

.radial-item-icon {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.7));
}

.radial-item-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 1px;
}

.radial-item-title {
  font-size: 11px;
  font-weight: 600;
  color: #f8fafc;
  max-width: 82px;
  line-height: 1.15;
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.radial-sector-item.disabled .radial-item-title {
  color: #94a3b8;
}

.radial-sector-item.disabled .radial-item-icon {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.radial-item-soon {
  font-size: 8px;
  text-transform: uppercase;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.radial-center-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.75), inset 0 0 14px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  transition: all 0.14s ease;
}

.radial-center-circle.active-select {
  border-color: #38bdf8;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.55), inset 0 0 14px rgba(56, 189, 248, 0.25);
}

.radial-center-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #38bdf8;
}

.radial-center-status {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  margin: 3px 0 1px 0;
  line-height: 1.2;
}

.radial-center-sub {
  font-size: 8.5px;
  color: #94a3b8;
}

.radial-pointer-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  border: 2px solid #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.04s linear;
}

.radial-pointer-dot.active {
  background: #38bdf8;
  border-color: #e0f2fe;
  box-shadow: 0 0 16px #38bdf8, 0 0 6px #ffffff;
  transform: translate(-50%, -50%) scale(1.25);
}

/* --- HUD АКТИВНОЙ АНИМАЦИИ И ПРЕРЫВАНИЯ [X] --- */
#active-emote-hud {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 220px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.2);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 900;
}

#active-emote-hud.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.active-emote-content {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #f8fafc;
}

.active-emote-key {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  animation: keyPulse 1.5s infinite ease-in-out;
}

.active-emote-label {
  color: #94a3b8;
  font-size: 12px;
}

.active-emote-title {
  font-weight: 700;
  color: #38bdf8;
}

.active-emote-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  margin-left: auto;
}

.active-emote-bar-bg {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
}

.active-emote-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8, #f59e0b);
  border-radius: 3px;
  transition: width 0.05s linear;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

/* ========================================================================= */
/* ИНТЕРАКТИВНАЯ ЗАПИСКА В ЯЩИКЕ ТУМБОЧКИ (РЕАЛИСТИЧНЫЙ ТЕТРАДНЫЙ ЛИСТОК)    */
/* ========================================================================= */
#drawer-note-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.78);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.drawer-note-editor-box {
  max-width: 460px;
  width: 90%;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.2);
  display: flex;
  flex-direction: column;
  animation: noteEditorPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes noteEditorPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.note-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.note-editor-title {
  font-size: 15px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.note-editor-hint {
  font-size: 12px;
  color: #94a3b8;
}

.note-editor-hint kbd,
.held-note-btn kbd {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.note-editor-body {
  margin-bottom: 12px;
}

#drawer-note-textarea {
  width: 100%;
  min-height: 100px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 12px 14px;
  outline: none;
  resize: vertical;
  font-family: "Segoe Print", "Caveat", "Comic Sans MS", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.4;
  box-sizing: border-box;
  user-select: text;
  transition: border-color 0.15s;
}

#drawer-note-textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.note-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 12px;
}

.note-char-counter {
  font-size: 11px;
  color: #94a3b8;
  font-family: monospace;
}

.note-btns-row {
  display: flex;
  gap: 10px;
}

.btn-note-secondary {
  background: rgba(100, 116, 139, 0.15);
  border: 1px solid rgba(100, 116, 139, 0.3);
  color: #475569;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-note-secondary:hover {
  background: rgba(100, 116, 139, 0.25);
  color: #1e293b;
}

.btn-note-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
  transition: all 0.15s;
}

.btn-note-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.6);
}

/* Плавающий бейдж записки в руках и на спине */
#held-note-hud,
#back-note-hud {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 24px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 45;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
}

#back-note-hud {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.25);
}

#back-note-hud .held-note-btn {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

#back-note-hud .held-note-btn:hover {
  background: rgba(245, 158, 11, 0.35);
  border-color: #f59e0b;
  color: #ffffff;
}

/* Соревнование по прыжкам с качелей */
#swing-comp-hud {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(234, 179, 8, 0.55);
  border-radius: 16px;
  padding: 10px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(234, 179, 8, 0.25);
  z-index: 55;
  color: #f1f5f9;
  text-align: center;
  pointer-events: none;
  min-width: 280px;
}

#swing-comp-prompt {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
}

.swing-comp-pill {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(234, 179, 8, 0.6);
  border-radius: 20px;
  padding: 7px 16px;
  color: #fef08a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.swing-comp-pill:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #fde047;
  transform: scale(1.04);
}

.swing-comp-pill kbd {
  background: rgba(234, 179, 8, 0.25);
  border: 1px solid rgba(234, 179, 8, 0.5);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: #fff;
  margin-right: 4px;
}

#swing-comp-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(234, 179, 8, 0.7);
  border-radius: 16px;
  padding: 20px 28px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 24px rgba(234, 179, 8, 0.3);
  z-index: 100;
  color: #f8fafc;
  text-align: center;
  max-width: 440px;
}

.held-note-icon {
  font-size: 16px;
}

.held-note-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.held-note-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border-color: #38bdf8;
}

.held-note-btn.btn-put-back {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.held-note-btn.btn-put-back:hover {
  background: rgba(16, 185, 129, 0.35);
  border-color: #10b981;
  color: #ffffff;
}

/* Просмотр объявления о пропаже на дверях */
#poster-view-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.poster-view-box {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9);
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  flex-direction: column;
}

.poster-view-img {
  display: block;
  max-width: 480px;
  width: 90vw;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  user-select: none;
}

.poster-view-hint {
  text-align: center;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  user-select: none;
}

.poster-view-hint kbd {
  background: rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  margin: 0 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* ========================================================================= */
/* CARD GAME «СВИНЬЯ» (PIG) & TABLE BENCH HUD STYLES                         */
/* ========================================================================= */

.bench-sitting-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  padding: 8px 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}
.bench-hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bench-hud-sep {
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

#card-game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  display: none;
}

.cg-panel {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: #f8fafc;
  pointer-events: auto;
}

#cg-top-bar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
}

.cg-game-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.cg-turn-badge {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.25s ease;
}

.cg-turn-badge.cg-my-turn {
  background: #16a34a;
  color: #ffffff;
  border-color: #22c55e;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.6);
  animation: pulseMyTurn 1.6s infinite alternate;
}

@keyframes pulseMyTurn {
  0% { transform: scale(1.0); }
  100% { transform: scale(1.06); }
}

.cg-deck-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 500;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.cg-deck-badge strong {
  color: #38bdf8;
  font-size: 14px;
  font-weight: 800;
}

.cg-deck-icon {
  font-size: 15px;
}

.cg-declared-suit {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff !important;
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid rgba(245, 158, 11, 0.6);
}

.cg-declared-suit * {
  color: #ffffff !important;
}

.cg-top-actions {
  display: flex;
  gap: 8px;
}

#cg-players-sidebar {
  position: absolute;
  top: 80px;
  right: 20px;
  width: 220px;
  padding: 12px 16px;
}

#cg-action-log {
  position: absolute;
  top: 240px;
  left: 20px;
  width: 290px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  box-sizing: border-box;
  pointer-events: auto !important;
  z-index: 350;
  border-radius: 12px;
}

.cg-log-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-bottom: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cg-log-count {
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  color: #cbd5e1;
}

#cg-log-entries {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 4px;
  max-height: 280px;
}

#cg-log-entries::-webkit-scrollbar {
  width: 5px;
}

#cg-log-entries::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

.cg-log-entry {
  font-size: 12px;
  line-height: 1.35;
  color: #cbd5e1;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  border-left: 2.5px solid #64748b;
  word-break: break-word;
}

.cg-log-entry .log-time {
  font-size: 10px;
  color: #64748b;
  margin-right: 4px;
  font-family: monospace;
}

.cg-log-entry.cg-log-start {
  border-left-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  color: #e0f2fe;
}

.cg-log-entry.cg-log-play {
  border-left-color: #64748b;
}

.cg-log-entry.cg-log-queen {
  border-left-color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
  color: #f3e8ff;
}

.cg-log-entry.cg-log-skip {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.09);
  color: #fee2e2;
}

.cg-log-entry.cg-log-penalty {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.09);
  color: #fef3c7;
}

.cg-log-entry.cg-log-take {
  border-left-color: #ec4899;
  background: rgba(236, 72, 153, 0.08);
  color: #fce7f3;
}

.cg-log-entry.cg-log-steal {
  border-left-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  color: #ede9fe;
}

.cg-log-entry.cg-log-win {
  border-left-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  font-weight: 600;
}

.cg-log-entry.cg-log-pig {
  border-left-color: #f43f5e;
  background: rgba(244, 63, 94, 0.14);
  color: #ffe4e6;
  font-weight: 700;
}

.cg-crosshair-hint {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, 0);
  background: rgba(15, 23, 42, 0.90);
  border: 1px solid rgba(59, 130, 246, 0.6);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), 0 0 10px rgba(59, 130, 246, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pulseCrosshairHint 1.4s infinite alternate;
}

@keyframes pulseCrosshairHint {
  0% { transform: translate(-50%, 0) scale(1.0); }
  100% { transform: translate(-50%, 0) scale(1.04); }
}

.cg-crosshair-hint .cg-crosshair-key {
  background: #3b82f6;
  color: #ffffff;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.cg-players-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  margin-bottom: 8px;
  font-weight: 700;
}

.cg-player-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.03);
}

.cg-player-row.cg-player-current {
  background: rgba(56, 189, 248, 0.2);
  border-left: 3px solid #38bdf8;
  font-weight: 600;
}

.cg-p-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cg-p-name {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cg-p-count {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 600;
}

#cg-action-center {
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 90;
}

.cg-action-hint-badge {
  padding: 8px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(245, 158, 11, 0.6);
  color: #fef3c7;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 10px rgba(245, 158, 11, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: pulseActionHint 1.6s infinite alternate;
  user-select: none;
}

@keyframes pulseActionHint {
  0% { transform: scale(1.0); }
  100% { transform: scale(1.03); }
}

.cg-action-hint-badge.penalty {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.25);
  color: #fee2e2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 14px rgba(239, 68, 68, 0.4);
}

.cg-btn-action {
  display: none !important;
}

.cg-btn-penalty {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  border-color: #fca5a5 !important;
  animation: pulsePenalty 1.2s infinite alternate !important;
}

@keyframes pulsePenalty {
  0% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.45); transform: scale(1); }
  100% { box-shadow: 0 0 24px rgba(239, 68, 68, 0.95); transform: scale(1.04); }
}

.cg-turn-badge.cg-turn-penalty {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #fca5a5 !important;
  border-color: #ef4444 !important;
  animation: pulsePenaltyText 1.2s infinite alternate;
}

@keyframes pulsePenaltyText {
  0% { opacity: 0.85; }
  100% { opacity: 1; text-shadow: 0 0 8px #ef4444; }
}

@keyframes pulseAction {
  0% { box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
  100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.85); }
}

#cg-hand-container {
  display: none !important;
}

body.cg-alt-held #cg-hand-container {
  display: none !important;
}

body.pip-alt-held #yard-tablet-yt-host,
body.pip-alt-held #yard-tablet-yt-host iframe {
  pointer-events: auto !important;
  cursor: default !important;
}

#cg-controls-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.90);
  border: 1px solid rgba(245, 158, 11, 0.65);
  color: #f1f5f9;
  padding: 8px 22px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 12px rgba(245, 158, 11, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  user-select: none;
  white-space: nowrap;
}

#cg-controls-hint kbd {
  background: rgba(245, 158, 11, 0.25);
  border: 1px solid #f59e0b;
  color: #fbbf24;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
}

.cg-hint-btn {
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  pointer-events: auto;
}

.cg-hint-btn:hover kbd {
  background: #f59e0b;
  color: #0f172a;
}

#cg-hand-cards {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  pointer-events: auto;
  padding: 10px 40px;
}

.cg-hand-card {
  width: 96px;
  height: 142px;
  background: #ffffff;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  margin: 0 -18px;
  position: relative;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
  user-select: none;
  cursor: default;
  transform-origin: center 120%;
}

.cg-hand-card.cg-playable {
  cursor: pointer;
  border: 2px solid #22c55e;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.55), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.cg-hand-card.cg-playable:hover {
  transform: translateY(-38px) scale(1.16) !important;
  z-index: 50;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6), 0 0 22px rgba(34, 197, 94, 0.85);
  border-color: #4ade80;
}

.cg-card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.05;
}
.cg-card-tl { top: 6px; left: 8px; }
.cg-card-br { bottom: 6px; right: 8px; transform: rotate(180deg); }
.cg-mini-suit { font-size: 12px; }

.cg-card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cg-center-rank { font-size: 18px; font-weight: 800; }
.cg-center-suit { font-size: 32px; line-height: 1; }

/* MODALS */
.cg-modal-backdrop {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999 !important;
  cursor: default !important;
  pointer-events: auto !important;
}

.cg-player-row.cg-player-finished {
  opacity: 0.88;
  border-left: 3px solid #22c55e;
  background: rgba(34, 197, 94, 0.10);
}

.cg-modal-box {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  color: #f8fafc;
}

.cg-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cg-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
}

.cg-close-btn {
  background: transparent;
  border: none;
  font-size: 26px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}
.cg-close-btn:hover { color: #f8fafc; }

.cg-game-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.cg-game-card.selected {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.cg-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.cg-icon-big { font-size: 32px; }
.cg-tag {
  font-size: 12px;
  color: #38bdf8;
  font-weight: 600;
}
.cg-game-desc {
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
}

.cg-warning-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #fbbf24;
  line-height: 1.45;
}

.cg-btn.cg-btn-disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: auto;
}

.cg-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.cg-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
}

.cg-btn-primary {
  background: #2563eb;
  color: #ffffff;
}
.cg-btn-primary:hover { background: #1d4ed8; }

.cg-btn-danger {
  background: #dc2626;
  color: #ffffff;
}
.cg-btn-danger:hover { background: #b91c1c; }

.cg-btn-subtle {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.cg-btn-subtle:hover { background: rgba(255, 255, 255, 0.15); color: #ffffff; }

/* TIMER BARS */
.cg-timer-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin: 16px 0 8px;
}
.cg-timer-bar-fill {
  height: 100%;
  width: 100%;
  background: #38bdf8;
  border-radius: 3px;
  transition: width 0.1s linear;
}
.cg-invite-sub {
  font-size: 12px;
  color: #94a3b8;
  text-align: right;
}

/* SUITS GRID */
.cg-suits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 10px;
}
.cg-suit-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: all 0.2s ease;
}
.cg-suit-btn:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.cg-suit-icon { font-size: 40px; margin-bottom: 6px; }

/* GAME OVER */
.cg-results-section {
  margin-bottom: 16px;
  font-size: 14px;
}
.cg-results-section ol {
  margin-left: 20px;
  margin-top: 8px;
}
.cg-results-section li {
  margin-bottom: 4px;
  color: #cbd5e1;
}

.cg-pig-badge {
  background: rgba(225, 29, 72, 0.15);
  border: 2px solid #e11d48;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.cg-pig-icon { font-size: 48px; }
.cg-pig-label { font-size: 13px; font-weight: 700; color: #fb7185; }
.cg-pig-name { font-size: 18px; font-weight: 800; color: #ffffff; margin-top: 4px; }

/* =========================================================================
   ПРАВИЛА КАРТОЧНОЙ ИГРЫ «СВИНЬЯ» (ПЛАШКА И МОДАЛЬНОЕ ОКНО)
   ========================================================================= */
#cg-rules-badge {
  display: none !important;
}

#cg-rules-badge:hover {
  background: rgba(30, 41, 59, 1);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 18px rgba(56, 189, 248, 0.45);
}

#cg-rules-badge .cg-rules-badge-icon {
  font-size: 16px;
}

.cg-rules-modal-box {
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.cg-rules-modal-body {
  overflow-y: auto;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(85vh - 130px);
}

.cg-rules-modal-body::-webkit-scrollbar {
  width: 6px;
}

.cg-rules-modal-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 4px;
}

.cg-rules-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
}

.cg-rules-sec-title {
  font-size: 13px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 6px 0;
}

.cg-rules-section p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #cbd5e1;
}

.cg-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.cg-rule-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  padding: 8px 10px;
}

.cg-rule-card p {
  font-size: 12px !important;
  margin-top: 4px !important;
  color: #e2e8f0;
}

.cg-rule-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.cg-badge-ace { background: rgba(239, 68, 68, 0.25); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.45); }
.cg-badge-queen { background: rgba(168, 85, 247, 0.25); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.45); }
.cg-badge-seven { background: rgba(245, 158, 11, 0.25); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.45); }
.cg-badge-eight { background: rgba(59, 130, 246, 0.25); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.45); }

.cg-rules-controls-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.cg-rules-ctrl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #cbd5e1;
}

.cg-rules-ctrl-item kbd {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  color: #38bdf8;
  white-space: nowrap;
}

/* ========================================================================= */
/* ИНТЕРАКТИВНЫЙ ГИД ПО ДВОРУ (ОКНО ОПИСАНИЯ АКТИВНОСТЕЙ)                    */
/* ========================================================================= */
#yard-guide-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.84);
  backdrop-filter: blur(8px);
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.yard-guide-box {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  color: #f1f5f9;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

.yard-guide-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.65);
}

.yard-guide-title {
  font-size: 18px;
  font-weight: 800;
  color: #f97316;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.yard-guide-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.yard-guide-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cbd5e1;
  font-size: 16px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.yard-guide-close:hover {
  background: #ef4444;
  color: #fff;
  border-color: #f87171;
  transform: scale(1.05);
}

.yard-guide-body {
  padding: 18px 22px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 720px) {
  .yard-guide-body {
    grid-template-columns: 1fr;
  }
}

.guide-item-card {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.guide-item-card:hover {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(30, 41, 59, 0.75);
}

.guide-item-header {
  font-size: 14.5px;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.guide-item-desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
}

.guide-item-keys {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}

.guide-item-keys span {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 2px 7px;
  border-radius: 4px;
  color: #facc15;
  font-weight: 600;
}

/* =========================================================================
   АДАПТИВНОЕ МОБИЛЬНОЕ СЕНСОРНОЕ УПРАВЛЕНИЕ (TOUCH CONTROLS)
   ========================================================================= */

#chat-send-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: none;
  border-radius: 8px;
  background: #38bdf8;
  color: #0f172a;
  font-weight: bold;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, background 0.15s ease;
}

#chat-send-btn:active {
  transform: scale(0.92);
  background: #0284c7;
}

/* =========================================================================
   МОБИЛЬНОЕ МОДАЛЬНОЕ ОКНО ЧАТА (СВЕРХУ, КЛАВИАТУРА НЕ ПЕРЕКРЫВАЕТ)
   ========================================================================= */
#mobile-chat-modal {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 10000;
  display: none;
  animation: slideDownChat 0.18s ease-out;
}

@keyframes slideDownChat {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.mobile-chat-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.4);
  border-radius: 12px;
  padding: 8px 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#mobile-chat-input {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  color: #f8fafc;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

#mobile-chat-input:focus {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.9);
}

#mobile-chat-send-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 8px;
  background: #38bdf8;
  color: #0f172a;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease;
}

#mobile-chat-send-btn:active {
  transform: scale(0.92);
  background: #0284c7;
}

#mobile-chat-close-btn {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* =========================================================================
   МОБИЛЬНЫЙ СЕНСОРНЫЙ СЛОЙ УПРАВЛЕНИЯ
   ========================================================================= */
#touch-controls-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  display: none;
  user-select: none;
  -webkit-user-select: none;
}

body.is-touch-device #touch-controls-layer {
  display: block;
}

/* Зона свободного обзора камеры: на всю правую и верхнюю часть экрана */
#touch-look-zone {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
  touch-action: none;
  z-index: 38;
}

/* Левая сенсорная зона: плавающий джойстик */
#touch-joystick-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 45vw;
  height: 75vh;
  pointer-events: auto;
  touch-action: none;
  z-index: 42;
}

#touch-joystick-base {
  position: absolute;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.16s ease, transform 0.16s ease;
  background: radial-gradient(circle, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.78) 100%);
  border: 2px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25), inset 0 0 16px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#touch-joystick-base.active {
  opacity: 1;
  transform: scale(1);
}

#touch-joystick-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.9) 0%, rgba(14, 165, 233, 0.95) 100%);
  border: 2.5px solid #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.5);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

#touch-joystick-thumb.sprinting {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  border-color: #fef08a;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

/* Правый нижний кластер кнопок */
#touch-actions-cluster {
  position: absolute;
  right: 18px;
  bottom: 22px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  z-index: 46;
}

/* Контекстная динамическая кнопка действия */
#touch-btn-action {
  min-width: 120px;
  max-width: 220px;
  height: 48px;
  padding: 0 16px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.92);
  border: 2px solid #38bdf8;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.45);
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
}

#touch-table-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.touch-action-pill.table-sub-pill {
  min-width: 90px;
  height: 42px;
  padding: 0 12px;
  border-radius: 21px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
}

.touch-action-pill.table-sub-pill:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.3);
}

#touch-btn-action.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

#touch-btn-action:active {
  transform: scale(0.94);
  background: rgba(56, 189, 248, 0.25);
}

#touch-buttons-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.touch-circle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #e2e8f0;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}

#touch-btn-crouch.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

.touch-circle-btn.jump-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.55) 0%, rgba(2, 132, 199, 0.8) 100%);
  border: 2px solid rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.touch-circle-btn.jump-btn:active {
  transform: scale(0.92);
  background: rgba(56, 189, 248, 0.8);
}

.jump-svg {
  display: block;
}

.jump-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #e0f2fe;
  margin-top: -2px;
}

/* Верхнее быстрое мобильное меню */
#touch-quick-menu {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 52;
  pointer-events: auto;
}

#touch-quick-menu .touch-quick-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.12s ease;
}

#touch-quick-menu .touch-quick-btn:active {
  transform: scale(0.92);
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.3);
}

/* =========================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ ЭЛЕМЕНТОВ ИНТЕРФЕЙСА (ИСКЛЮЧИТЕЛЬНО ДЛЯ СЕНСОРА)
   ========================================================================= */

body.is-touch-device #top-bar-controls {
  display: none !important;
}

/* 1. Полностью скрываем голосовой чат на мобилке */
body.is-touch-device #voice-indicator {
  display: none !important;
}

/* 4. Полностью скрываем плашку с координатами на мобилке */
body.is-touch-device #coords-hud {
  display: none !important;
}

/* 6. Плашка слева наверху: только сколько человек онлайн и твой ник */
body.is-touch-device #hud {
  top: 12px !important;
  left: 12px !important;
  padding: 6px 10px !important;
  background: rgba(10, 15, 24, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  width: auto !important;
  max-width: fit-content !important;
}

body.is-touch-device #hud .title,
body.is-touch-device #hud .loc,
body.is-touch-device #hud #mode-text {
  display: none !important;
}

body.is-touch-device #hud-my-name {
  font-size: 12px !important;
  margin-bottom: 0 !important;
  line-height: 1.3 !important;
}

body.is-touch-device #hud .online-badge {
  font-size: 11px !important;
  padding: 2px 6px !important;
  line-height: 1.3 !important;
}

/* 7. ФПС: аккуратный компактный бейдж в уголке под статусом (НЕ на всю ширину) */
body.is-touch-device #fps-hud {
  position: absolute !important;
  top: 66px !important;
  left: 12px !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  max-width: fit-content !important;
  font-size: 10px !important;
  padding: 3px 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  z-index: 45 !important;
  background: rgba(10, 15, 24, 0.78) !important;
  backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 6px !important;
}

/* 1 & 2. Текстовый чат: ультракомпактный, без нижней полоски ввода */
body.is-touch-device #chat-container {
  bottom: 74px !important;
  left: 10px !important;
  width: 190px !important;
  max-width: 48vw !important;
  background: transparent !important;
  pointer-events: none !important;
  border: none !important;
  box-shadow: none !important;
}

body.is-touch-device #chat-container #chat-messages {
  max-height: 68px !important;
  font-size: 9.5px !important;
  line-height: 1.25 !important;
  background: rgba(10, 15, 24, 0.45) !important;
  backdrop-filter: blur(4px) !important;
  border-radius: 6px !important;
  padding: 3px 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body.is-touch-device #chat-container #chat-messages .chat-message {
  margin-bottom: 2px !important;
  word-break: break-word !important;
}

body.is-touch-device #chat-container #chat-input-wrapper {
  display: none !important;
}

/* 9. Интерактивная плашка по центру: на мобильных устройствах полностью скрыта,
   так как всё управление и информирование вынесено на правую контекстную кнопку действия */
body.is-touch-device #interaction-prompt {
  display: none !important;
}

body.is-touch-device #crosshair {
  pointer-events: none !important;
}

/* Мобильная адаптация табло стритбола: компактное, под верхними кнопками, не перекрывает прыжок/присед */
body.is-touch-device #basketball-scoreboard-hud {
  top: 62px !important;
  right: 14px !important;
  bottom: auto !important;
  left: auto !important;
  min-width: 110px !important;
  max-width: 135px !important;
  padding: 5px 8px !important;
  border-radius: 8px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  border: 1px solid rgba(234, 88, 12, 0.55) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5) !important;
  z-index: 40 !important;
  pointer-events: none !important;
}

body.is-touch-device #basketball-scoreboard-hud > div:first-child {
  font-size: 10px !important;
  padding-bottom: 3px !important;
  margin-bottom: 3px !important;
  gap: 4px !important;
}

body.is-touch-device #basketball-scoreboard-hud > div:last-child {
  gap: 2px !important;
  font-size: 9.5px !important;
  max-height: 85px !important;
  overflow-y: auto !important;
}

body.is-touch-device #basketball-scoreboard-hud span {
  font-size: 9.5px !important;
}

body.is-touch-device #basketball-scoreboard-hud span[style*="font-size:14px"] {
  font-size: 11px !important;
  margin-left: 4px !important;
}

/* Мобильная адаптация колеса эмоций (Q) и действий (G) */
body.is-touch-device #radial-wheel-overlay {
  pointer-events: auto !important;
  background: rgba(10, 15, 24, 0.65) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

body.is-touch-device .radial-wheel-box {
  transform: scale(0.85);
  pointer-events: auto !important;
}

body.is-touch-device .radial-sector-item {
  pointer-events: auto !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
}

body.is-touch-device .radial-center-circle {
  pointer-events: auto !important;
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent !important;
}

body.is-touch-device #active-emote-hud {
  bottom: 84px !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* ========================================================================= */
/* 🥽 WEBXR IMMERSIVE VR MODE STYLING                                       */
/* ========================================================================= */
#vr-enter-btn {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.9), rgba(6, 182, 212, 0.9)) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
  animation: pulse-vr-btn 3s infinite ease-in-out;
}

#vr-enter-btn:hover {
  background: linear-gradient(135deg, #0284c7, #06b6d4) !important;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

#touch-btn-vr {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.85), rgba(6, 182, 212, 0.85)) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

@keyframes pulse-vr-btn {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
  }
  50% {
    box-shadow: 0 6px 22px rgba(56, 189, 248, 0.65);
  }
}

/* ========================================================================= */
/* 📱 АДАПТАЦИЯ КАРТОЧНОЙ ИГРЫ «СВИНЬЯ» ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ              */
/* ========================================================================= */
body.is-touch-device #cg-controls-hint {
  display: none !important;
}

body.is-touch-device #cg-crosshair-hint {
  display: none !important;
}

body.is-touch-device #cg-top-bar {
  top: 8px !important;
  padding: 4px 10px !important;
  gap: 8px !important;
  border-radius: 20px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
  max-width: 94vw !important;
}

body.is-touch-device .cg-game-title {
  font-size: 11px !important;
  gap: 4px !important;
}

body.is-touch-device .cg-turn-badge {
  font-size: 10px !important;
  padding: 2px 7px !important;
  border-radius: 12px !important;
}

body.is-touch-device #cg-deck-counter-badge {
  font-size: 10px !important;
  padding: 2px 8px !important;
}

body.is-touch-device #cg-deck-counter-badge strong {
  font-size: 11px !important;
}

body.is-touch-device .cg-top-actions {
  gap: 4px !important;
}

body.is-touch-device .cg-top-actions .cg-btn {
  padding: 2px 6px !important;
  font-size: 9.5px !important;
}

body.is-touch-device #cg-btn-abort {
  display: none !important;
}

/* Компактный лог игры сверху-слева (не загораживает виртуальный джойстик) */
body.is-touch-device #cg-action-log {
  top: 48px !important;
  left: 8px !important;
  width: 175px !important;
  max-width: 44vw !important;
  max-height: 72px !important;
  padding: 4px 8px !important;
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(6px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  z-index: 50 !important;
  pointer-events: auto !important;
}

body.is-touch-device .cg-log-title {
  font-size: 8px !important;
  letter-spacing: 0.4px !important;
  margin-bottom: 2px !important;
}

body.is-touch-device .cg-log-count {
  font-size: 8px !important;
  padding: 0 4px !important;
}

body.is-touch-device #cg-log-entries {
  gap: 2px !important;
  max-height: 52px !important;
  padding-right: 2px !important;
}

body.is-touch-device .cg-log-entry {
  font-size: 9px !important;
  padding: 2px 4px !important;
  line-height: 1.2 !important;
  border-radius: 4px !important;
}

/* Компактный список игроков справа сверху */
body.is-touch-device #cg-players-sidebar {
  top: 48px !important;
  right: 8px !important;
  width: 105px !important;
  max-width: 30vw !important;
  padding: 4px 6px !important;
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(6px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px !important;
  z-index: 50 !important;
}

body.is-touch-device .cg-players-title {
  font-size: 8px !important;
  margin-bottom: 2px !important;
}

body.is-touch-device .cg-player-row {
  font-size: 9px !important;
  padding: 2px 4px !important;
  gap: 4px !important;
  margin-bottom: 2px !important;
}

body.is-touch-device .cg-p-dot {
  width: 6px !important;
  height: 6px !important;
}

/* Компактные уведомления-тосты карточной игры */
body.is-touch-device #cg-toast-notification {
  top: 42px !important;
  padding: 6px 14px !important;
  font-size: 11px !important;
  border-radius: 8px !important;
  max-width: 80vw !important;
  background: rgba(15, 23, 42, 0.88) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5) !important;
}

/* Активное состояние кнопки осмотра карты стола [T] */
#touch-btn-table-inspect.card-inspect-active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9)) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.8) !important;
  transform: scale(1.06);
}



