/* ==========================================================================
   VELSCOUR MODERN GAME CHAT SYSTEM
   Diablo II / Dark Gothic ARPG Aesthetic
   ========================================================================== */

/* Main Chat Container docked at top-left (a dragged position saved by chat.js overrides this) */
.game-chat {
  position: absolute;
  left: max(4px, env(safe-area-inset-left));
  top: max(4px, env(safe-area-inset-top));
  width: min(440px, 65vw);
  height: 220px;
  min-width: 280px;
  min-height: 120px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 11, 9, 0.45);
  border: 1px solid rgba(160, 120, 60, 0.25);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  z-index: 6;
  font-family: 'Alegreya Sans', sans-serif;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  pointer-events: auto;
  user-select: text;
}

/* Focused / Hovered State: Solidifies into Rich Obsidian Parchment */
.game-chat:hover,
.game-chat.active {
  background: rgba(14, 11, 9, 0.92);
  border-color: rgba(212, 163, 89, 0.6);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.85), inset 0 0 20px rgba(0, 0, 0, 0.7);
}

.game-chat.is-dragging,
.game-chat.is-resizing {
  transition: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.game-chat.is-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.game-chat.is-resizing * {
  cursor: nwse-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.game-chat.minimized .gc-body,
.game-chat.minimized .gc-footer,
.game-chat.minimized .gc-resize-handle {
  display: none !important;
}

.game-chat.minimized {
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  background: rgba(14, 11, 9, 0.8);
}

/* --------------------------------------------------------------------------
   Desktop: docked exactly where the scrolling pickup log (#log) sits.
   No drag/resize/minimize — a pushpin keeps it open; otherwise it fades.
   -------------------------------------------------------------------------- */
body:not(.touch) .game-chat.gc-desktop {
  left: 12px;
  top: auto;
  right: auto;
  bottom: calc(var(--hud-w) * var(--hud-k) + 10px);
  width: min(420px, 60vw);
  height: 220px;
  min-width: 280px;
  min-height: 120px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 40px);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0s linear 0s, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body:not(.touch) .game-chat.gc-desktop.gc-custom-pos {
  bottom: auto;
}

body:not(.touch) .game-chat.gc-desktop .gc-drag-handle,
body:not(.touch) .game-chat.gc-desktop .gc-resize-handle {
  display: flex;
}

body:not(.touch) .game-chat.gc-desktop .gc-header {
  cursor: grab;
}

body:not(.touch) .game-chat.gc-desktop.is-dragging .gc-header {
  cursor: grabbing;
}

/* Closed, not hovered: translucent for 5 s */
body:not(.touch) .game-chat.gc-desktop.gc-fading:not(:hover) {
  opacity: 0.45;
}

/* After the 5 s idle: gone, the pickup log takes the spot back */
body:not(.touch) .game-chat.gc-desktop.gc-faded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.8s ease, visibility 0s linear 0.8s;
}

/* While the chat is showing, hide the scrolling pickup text underneath it */
body.gc-chat-visible:not(.touch) #log {
  visibility: hidden;
}

.gc-pin-btn svg {
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  opacity: 0.65;
}

.gc-pin-btn.pinned {
  color: #ffd860;
  border-color: rgba(212, 163, 89, 0.7);
  background: rgba(90, 60, 30, 0.55);
}

.gc-pin-btn.pinned svg {
  transform: rotate(0deg);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Header & Tabs
   -------------------------------------------------------------------------- */
.gc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  background: rgba(24, 18, 14, 0.85);
  border-bottom: 1px solid rgba(140, 105, 55, 0.3);
  font-family: 'Cinzel', serif;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  touch-action: none;
}

.gc-header:active {
  cursor: grabbing;
}

.gc-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.gc-tabs::-webkit-scrollbar {
  display: none;
}

.gc-tab {
  position: relative;
  background: transparent;
  border: 1px solid transparent;
  color: #a8977c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.gc-tab:hover {
  color: #ffd860;
  background: rgba(255, 216, 96, 0.08);
}

.gc-tab.active {
  color: #ffd34a;
  background: rgba(45, 34, 24, 0.8);
  border-color: rgba(212, 163, 89, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 240, 180, 0.2);
}

/* Unread Badge */
.gc-badge {
  background: #9d2ec9;
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 8px;
  line-height: 1;
  box-shadow: 0 0 6px rgba(157, 46, 201, 0.8);
  user-select: none;
  -webkit-user-select: none;
}

.gc-badge.pulse {
  animation: gcPulse 1.2s infinite alternate;
}

@keyframes gcPulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }

  100% {
    transform: scale(1.15);
    filter: brightness(1.3);
  }
}

/* Blank draggable spacer in the header */
.gc-drag-handle {
  flex: 1;
  height: 22px;
  min-width: 20px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.gc-drag-handle:active {
  cursor: grabbing;
}

.gc-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  user-select: none;
  -webkit-user-select: none;
}

.gc-tool-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #8c7860;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  gap: 3px;
}

.gc-tool-btn:hover {
  color: #ffd34a;
  background: rgba(255, 216, 96, 0.1);
}

.gc-tool-btn.active,
.gc-tool-btn.has-filter {
  color: #ffd34a;
  border-color: rgba(212, 163, 89, 0.4);
  background: rgba(45, 34, 24, 0.8);
}

.gc-filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffd34a;
  box-shadow: 0 0 5px #ffd34a;
  display: inline-block;
  margin-left: 2px;
  flex-shrink: 0;
}

/* Filter Dropdown Popover */
.gc-filter-menu {
  position: absolute;
  top: 32px;
  right: 6px;
  width: 220px;
  background: #18110b;
  border: 1px solid #d4a359;
  border-radius: 4px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.98), 0 0 12px rgba(0, 0, 0, 0.9);
  z-index: 50;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Cinzel', serif;
  animation: filterFadeIn 0.15s ease-out;
}

@keyframes filterFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gc-filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(140, 105, 55, 0.45);
  padding-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #ffd34a;
  letter-spacing: 0.5px;
}

.gc-filter-close {
  background: transparent;
  border: none;
  color: #a8977c;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.gc-filter-close:hover {
  color: #ffd860;
}

.gc-filter-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 3px 0;
}

.gc-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 2px;
  transition: background 0.15s;
}

.gc-filter-item:hover {
  background: rgba(255, 216, 96, 0.12);
}

.gc-filter-item input[type="checkbox"] {
  accent-color: #ffd34a;
  cursor: pointer;
  width: 14px;
  height: 14px;
  margin: 0;
}

.gc-filter-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  text-transform: uppercase;
}

.gc-filter-desc {
  font-family: 'Alegreya Sans', sans-serif;
  font-size: 12px;
  color: #c9b493;
  margin-left: auto;
}

.gc-filter-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(140, 105, 55, 0.25);
  padding-top: 5px;
  margin-top: 2px;
}

.gc-filter-act-btn {
  background: transparent;
  border: 1px solid rgba(160, 120, 60, 0.3);
  color: #c9b493;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}

.gc-filter-act-btn:hover {
  background: rgba(255, 216, 96, 0.12);
  color: #ffd860;
  border-color: #ffd860;
}

/* --------------------------------------------------------------------------
   Messages Body
   -------------------------------------------------------------------------- */
.gc-body {
  position: relative;
  flex: 1 1 0;
  min-height: 60px;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #6a5334 rgba(15, 11, 8, 0.5);
}

.gc-body::-webkit-scrollbar {
  width: 5px;
}

.gc-body::-webkit-scrollbar-track {
  background: rgba(15, 11, 8, 0.5);
  border-radius: 3px;
}

.gc-body::-webkit-scrollbar-thumb {
  background: #6a5334;
  border: 1px solid rgba(142, 92, 46, 0.45);
  border-radius: 3px;
}

.gc-body::-webkit-scrollbar-thumb:hover {
  background: #9a7848;
  border-color: #caa050;
}

.gc-messages {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Message Rows */
.gc-msg {
  font-size: 13.5px;
  line-height: 1.35;
  color: #e9dcc4;
  word-break: break-word;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.gc-time {
  font-size: 11px;
  color: #7d6b55;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.gc-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 0 3px;
  border-radius: 2px;
  flex-shrink: 0;
  text-transform: uppercase;
}

.tag-party {
  color: #5ad0ff;
  background: rgba(90, 208, 255, 0.12);
}

.tag-whisper {
  color: #d870ff;
  background: rgba(216, 112, 255, 0.15);
}

.tag-whisper-to {
  color: #b886ff;
  background: rgba(184, 134, 255, 0.15);
}

.tag-system {
  color: #ffd34a;
  background: rgba(255, 211, 74, 0.12);
}

.tag-lobby {
  color: #e9b360;
  background: rgba(233, 179, 96, 0.12);
}

.gc-sender {
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, text-decoration 0.15s;
}

.gc-sender:hover {
  text-decoration: underline;
  filter: brightness(1.2);
}

.gc-sender.sender-party {
  color: #7ab8ff;
}

.gc-sender.sender-whisper {
  color: #e48fff;
}

.gc-sender.sender-self {
  color: #48e868;
}

.gc-sender.sender-lobby {
  color: #f0c070;
}

.gc-text {
  flex: 1;
}

/* Jump to bottom pill */
.gc-scroll-bottom {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 22, 16, 0.95);
  color: #ffd860;
  border: 1px solid rgba(212, 163, 89, 0.6);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
  transition: all 0.15s;
}

.gc-scroll-bottom:hover {
  background: rgba(50, 36, 24, 0.98);
  border-color: #ffd860;
}

/* --------------------------------------------------------------------------
   Input Footer
   -------------------------------------------------------------------------- */
.gc-footer {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 20px 4px 6px;
  background: rgba(20, 15, 12, 0.9);
  border-top: 1px solid rgba(140, 105, 55, 0.25);
  user-select: none;
  -webkit-user-select: none;
}

.gc-channel-btn {
  background: rgba(38, 28, 20, 0.85);
  border: 1px solid rgba(160, 120, 60, 0.4);
  color: #5ad0ff;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.gc-channel-btn:hover {
  background: rgba(55, 40, 28, 0.95);
  border-color: #ffd34a;
}

.gc-channel-btn.ch-whisper {
  color: #d870ff;
  border-color: rgba(216, 112, 255, 0.4);
}

.gc-channel-btn.ch-lobby {
  color: #ffd34a;
  border-color: rgba(255, 211, 74, 0.4);
}

.gc-input {
  flex: 1;
  background: rgba(10, 8, 6, 0.8);
  border: 1px solid rgba(120, 90, 50, 0.35);
  border-radius: 2px;
  color: #fff;
  font-family: 'Alegreya Sans', sans-serif;
  font-size: 13.5px;
  padding: 4px 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gc-input:focus {
  border-color: #d4a359;
  box-shadow: 0 0 6px rgba(212, 163, 89, 0.35);
  background: rgba(10, 8, 6, 0.95);
}

.gc-input::placeholder {
  color: #7d6b55;
  font-size: 12.5px;
}

.gc-send-btn {
  background: linear-gradient(180deg, #443222 0%, #291e14 100%);
  border: 1px solid rgba(160, 120, 60, 0.4);
  color: #ffd860;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.gc-send-btn:hover {
  border-color: #ffd860;
  background: linear-gradient(180deg, #58412c 0%, #3a2a1c 100%);
  box-shadow: 0 0 6px rgba(255, 216, 96, 0.3);
}

/* --------------------------------------------------------------------------
   Visual Resize Grip (Bottom-Right Corner)
   -------------------------------------------------------------------------- */
.gc-resize-handle {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 15;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 2px 2px 2px 2px;
  box-sizing: border-box;
  touch-action: none;
}

.gc-resize-handle svg {
  width: 11px;
  height: 11px;
  display: block;
  pointer-events: none;
}

.gc-resize-handle svg line {
  stroke: rgba(212, 163, 89, 0.7);
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke 0.15s ease;
}

.gc-resize-handle:hover svg line,
.game-chat.is-resizing .gc-resize-handle svg line {
  stroke: #ffd34a;
  filter: drop-shadow(0 0 3px rgba(255, 211, 74, 0.85));
}

/* --------------------------------------------------------------------------
   Mobile & Touch Floating Chat Button
   -------------------------------------------------------------------------- */
.gc-mobile-toggle {
  position: absolute;
  left: 12px;
  bottom: calc(var(--hud-w) * var(--hud-k) + 12px);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(22, 16, 12, 0.9);
  border: 1px solid rgba(212, 163, 89, 0.6);
  color: #ffd860;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s, background 0.15s;
}

.gc-mobile-toggle:active {
  transform: scale(0.92);
  background: rgba(45, 33, 24, 0.98);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .game-chat {
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 80px);
  }

  .gc-body {
    min-height: 60px;
  }

  .gc-msg {
    font-size: 12.5px;
  }
}

/* --------------------------------------------------------------------------
   Mobile Portrait Bottom Docked Chat (Overlay When Expanded)
   -------------------------------------------------------------------------- */
body.touch.portrait .game-chat {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100vw !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  border-radius: 0 !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: none !important;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.8) !important;
  transition: height 0.28s cubic-bezier(0.2, 0.85, 0.3, 1), background 0.25s ease !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Minimized: bottom banner across the screen showing tabs and unread badges */
body.touch.portrait .game-chat.minimized {
  height: calc(34px + env(safe-area-inset-bottom, 0px)) !important;
  min-height: calc(34px + env(safe-area-inset-bottom, 0px)) !important;
  max-height: calc(34px + env(safe-area-inset-bottom, 0px)) !important;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 20 !important;
  background: rgba(14, 11, 9, 0.88) !important;
  border-top: 1px solid rgba(160, 120, 60, 0.45) !important;
}

/* Expanded: pop-up overlay covering bottom half without shifting the HUD */
body.touch.portrait .game-chat:not(.minimized) {
  height: 50vh !important;
  height: 50dvh !important;
  min-height: 280px !important;
  max-height: 55vh !important;
  max-height: 55dvh !important;
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  z-index: 80 !important;
  /* Overlays on top of HUD & touch elements */
  background: rgba(14, 11, 9, 0.96) !important;
  border-top: 1px solid rgba(212, 163, 89, 0.65) !important;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(0, 0, 0, 0.7) !important;
}

body.touch.portrait .gc-drag-handle,
body.touch.portrait .gc-resize-handle,
body.touch.portrait .gc-mobile-toggle,
body.touch.portrait #gc-btn-toggle {
  display: none !important;
}

body.touch.portrait .gc-header {
  cursor: default !important;
  padding: 4px 8px !important;
  flex-shrink: 0 !important;
}

body.touch.portrait .gc-tabs {
  gap: 2px;
}

body.touch.portrait .gc-tab {
  padding: 3px 6px;
  font-size: 11px;
}

body.touch.portrait .gc-tool-btn {
  padding: 2px 5px;
  font-size: 11px;
}

body.touch.portrait .game-chat .gc-body {
  flex: 1 1 0 !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow-y: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.touch.portrait .game-chat .gc-messages {
  flex: 1 1 0 !important;
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

body.touch.portrait .game-chat .gc-footer {
  flex-shrink: 0 !important;
  padding: 5px 8px !important;
}

/* --------------------------------------------------------------------------
   Mobile Landscape Right 1/2 Pop-Out Chat Overlay & Toggle Handle
   -------------------------------------------------------------------------- */
body.touch:not(.portrait) .game-chat,
body.touch.landscape .game-chat {
  position: fixed !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  width: 50vw !important;
  min-width: 320px !important;
  max-width: 50vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  border-radius: 0 !important;
  border-top: none !important;
  border-bottom: none !important;
  border-right: none !important;
  border-left: 1px solid rgba(212, 163, 89, 0.55) !important;
  background: rgba(14, 11, 9, 0.96) !important;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 80 !important;
  /* Sits completely over all HUD & touch elements */
  padding-top: max(4px, env(safe-area-inset-top, 0px)) !important;
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px)) !important;
  padding-right: max(6px, env(safe-area-inset-right, 0px)) !important;
  padding-left: 0 !important;
  box-sizing: border-box !important;
  transition: transform 0.28s cubic-bezier(0.2, 0.85, 0.3, 1), background 0.25s ease !important;
  transform: translateX(100%) !important;
  /* Hidden off right screen edge by default */
  pointer-events: none;
  /* Touches pass through to game when closed */
}

/* When open in landscape: slide out to right 1/2 overlay */
body.touch:not(.portrait) .game-chat.gc-landscape-open,
body.touch.landscape .game-chat.gc-landscape-open {
  transform: translateX(0) !important;
  pointer-events: auto !important;
}

/* Handle element on right edge */
.gc-landscape-handle {
  display: none;
}

body.touch:not(.portrait) .gc-landscape-handle,
body.touch.landscape .gc-landscape-handle {
  display: flex !important;
  position: absolute !important;
  left: -36px !important;
  top: 36% !important;
  transform: translateY(-50%) !important;
  width: 36px !important;
  height: 64px !important;
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  background: rgba(18, 14, 11, 0.96) !important;
  border: 1px solid rgba(212, 163, 89, 0.65) !important;
  border-right: none !important;
  color: #ffd860 !important;
  box-shadow: -4px 3px 14px rgba(0, 0, 0, 0.85), inset 0 0 10px rgba(0, 0, 0, 0.6) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  /* Always clickable even when chat is pointer-events: none */
  z-index: 85 !important;
  /* Above chat container (80) and all HUD elements */
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2px !important;
  padding: 0 !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: manipulation !important;
  transition: background 0.2s, border-color 0.2s, color 0.2s !important;
}

body.touch:not(.portrait) .gc-landscape-handle:hover,
body.touch.landscape .gc-landscape-handle:hover,
body.touch:not(.portrait) .gc-landscape-handle:active,
body.touch.landscape .gc-landscape-handle:active {
  background: rgba(35, 26, 18, 0.98) !important;
  border-color: rgba(255, 216, 96, 0.9) !important;
  color: #fff4d0 !important;
}

.gc-landscape-handle .gc-handle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  opacity: 0.9;
}

.gc-landscape-handle .gc-handle-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #c02040;
  color: #ffffff;
  font-size: 9px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 220, 180, 0.8);
  box-shadow: 0 0 6px rgba(255, 40, 80, 0.8);
  line-height: 1.1;
}

.gc-landscape-handle.has-unread {
  animation: gcHandleGlow 1.5s infinite alternate !important;
}

@keyframes gcHandleGlow {
  0% {
    border-color: rgba(212, 163, 89, 0.6);
    box-shadow: -4px 3px 14px rgba(0, 0, 0, 0.75);
  }

  100% {
    border-color: rgba(255, 80, 80, 0.9);
    box-shadow: -4px 3px 16px rgba(255, 50, 70, 0.6);
  }
}

/* Semi-transparent backdrop to dismiss landscape overlay by tapping left side */
.gc-landscape-backdrop {
  display: none;
}

body.touch .gc-landscape-backdrop.visible {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 75 !important;
  /* Below chat (80) and handle (85), above all HUD elements */
  pointer-events: auto !important;
  touch-action: manipulation !important;
  animation: gcBackdropFadeIn 0.2s ease forwards !important;
}

@keyframes gcBackdropFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Hide desktop free-drag grips and toggle/pin button on touch devices */
body.touch .gc-drag-handle,
body.touch .gc-resize-handle,
body.touch #gc-btn-toggle {
  display: none !important;
}

/* Header & message container layout in landscape overlay */
body.touch:not(.portrait) .game-chat .gc-header,
body.touch.landscape .game-chat .gc-header {
  cursor: default !important;
  padding: 5px 8px !important;
  flex-shrink: 0 !important;
}

body.touch:not(.portrait) .game-chat .gc-body,
body.touch.landscape .game-chat .gc-body {
  flex: 1 1 0 !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow-y: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.touch:not(.portrait) .game-chat .gc-messages,
body.touch.landscape .game-chat .gc-messages {
  flex: 1 1 0 !important;
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

body.touch:not(.portrait) .game-chat .gc-footer,
body.touch.landscape .game-chat .gc-footer {
  flex-shrink: 0 !important;
  padding: 6px 8px !important;
}