/* VELSCOUR Online - Diablo II Style Lobby Styles */

/* Stylistic slim scrollbars across all lobby screens, rails, lists, and chat */
#d2-lobby,
#d2-lobby *,
.d2-char-select-screen,
.d2-char-select-screen *,
.d2-create-screen,
.d2-create-screen *,
.d2-friends-overlay,
.d2-friends-overlay * {
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 rgba(10, 6, 4, 0.75);
}

#d2-lobby *::-webkit-scrollbar,
.d2-char-select-screen *::-webkit-scrollbar,
.d2-create-screen *::-webkit-scrollbar,
.d2-friends-overlay *::-webkit-scrollbar,
#d2-lobby::-webkit-scrollbar,
.d2-char-select-screen::-webkit-scrollbar,
.d2-create-screen::-webkit-scrollbar,
.d2-friends-overlay::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

#d2-lobby *::-webkit-scrollbar-track,
.d2-char-select-screen *::-webkit-scrollbar-track,
.d2-create-screen *::-webkit-scrollbar-track,
.d2-friends-overlay *::-webkit-scrollbar-track,
#d2-lobby::-webkit-scrollbar-track,
.d2-char-select-screen::-webkit-scrollbar-track,
.d2-create-screen::-webkit-scrollbar-track,
.d2-friends-overlay::-webkit-scrollbar-track {
  background: rgba(10, 6, 4, 0.75);
  border-radius: 3px;
}

#d2-lobby *::-webkit-scrollbar-thumb,
.d2-char-select-screen *::-webkit-scrollbar-thumb,
.d2-create-screen *::-webkit-scrollbar-thumb,
.d2-friends-overlay *::-webkit-scrollbar-thumb,
#d2-lobby::-webkit-scrollbar-thumb,
.d2-char-select-screen::-webkit-scrollbar-thumb,
.d2-create-screen::-webkit-scrollbar-thumb,
.d2-friends-overlay::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid rgba(140, 94, 48, 0.55);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 216, 96, 0.15);
}

#d2-lobby *::-webkit-scrollbar-thumb:hover,
.d2-char-select-screen *::-webkit-scrollbar-thumb:hover,
.d2-create-screen *::-webkit-scrollbar-thumb:hover,
.d2-friends-overlay *::-webkit-scrollbar-thumb:hover,
#d2-lobby::-webkit-scrollbar-thumb:hover,
.d2-char-select-screen::-webkit-scrollbar-thumb:hover,
.d2-create-screen::-webkit-scrollbar-thumb:hover,
.d2-friends-overlay::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
  box-shadow: inset 0 1px 0 rgba(255, 216, 96, 0.35), 0 0 4px rgba(212, 163, 75, 0.3);
}

#d2-lobby *::-webkit-scrollbar-thumb:active,
.d2-char-select-screen *::-webkit-scrollbar-thumb:active,
.d2-create-screen *::-webkit-scrollbar-thumb:active,
.d2-friends-overlay *::-webkit-scrollbar-thumb:active,
#d2-lobby::-webkit-scrollbar-thumb:active,
.d2-char-select-screen::-webkit-scrollbar-thumb:active,
.d2-create-screen::-webkit-scrollbar-thumb:active,
.d2-friends-overlay::-webkit-scrollbar-thumb:active {
  background: #8c5e30;
  border-color: #ffd860;
}

#d2-lobby *::-webkit-scrollbar-corner,
.d2-char-select-screen *::-webkit-scrollbar-corner,
.d2-create-screen *::-webkit-scrollbar-corner,
.d2-friends-overlay *::-webkit-scrollbar-corner,
#d2-lobby::-webkit-scrollbar-corner,
.d2-char-select-screen::-webkit-scrollbar-corner,
.d2-create-screen::-webkit-scrollbar-corner,
.d2-friends-overlay::-webkit-scrollbar-corner {
  background: transparent;
}

#d2-lobby {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at center, rgba(40, 8, 4, 0.55), rgba(0, 0, 0, 0.94) 70%), #060403;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  font-family: var(--font-head);
  color: var(--text);
  overflow: hidden;
  box-shadow: inset 0 0 160px rgba(0, 0, 0, 0.95), inset 0 0 60px rgba(0, 0, 0, 0.9);
}

#d2-lobby .title-eyes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
}

#d2-lobby .title-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#d2-lobby .title-eyes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
}

#d2-lobby .title-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Ornate gothic outer frame */
#d2-lobby::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* ------------------------------------------------ Top Header */
.d2-header {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(24, 15, 10, 0.96) 0%, rgba(12, 7, 5, 0.92) 100%);
  border-bottom: 2px solid #5a3c1e;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
  position: relative;
  z-index: 6;
  width: 100%;
  overflow: visible;
}

.d2-header-left {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  position: relative;
  z-index: 10;
}

.d2-channel-title {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-head);
  color: #ffd860;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 3px #000, 0 0 8px rgba(255, 180, 40, 0.4);
  line-height: 1.2;
}

.d2-channel-sub {
  font-size: 10.5px;
  font-family: var(--font-body);
  color: #a8977c;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  line-height: 1.2;
  margin-top: 2px;
}

.d2-title-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  scale: 2;
  top: 16px;
  pointer-events: none;
  z-index: 1;
}

.d2-center-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.d2-center-logo-wrap .d2-logo-img {
  height: 38px;
  filter: drop-shadow(0 0 14px rgba(255, 90, 15, 0.6)) drop-shadow(0 2px 8px #ff4010);
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.d2-center-logo-wrap .d2-logo-fire {
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  width: 240px;
  height: 76px;
  pointer-events: none;
  z-index: 2;
}

.d2-header-right {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.d2-header-right button {
  width: 78px;
  padding: 3px 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.2;
}

/* ------------------------------------------------ Main Split Body (Full Width) */
.d2-body {
  flex: 1;
  display: flex;
  gap: 12px;
  padding: 10px 16px 8px;
  position: relative;
  z-index: 5;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  margin-top: 16px;
  margin-bottom: 16px;
}

/* Common Panel Styling - Wide and atmospheric */
.d2-panel {
  flex: 1 1 50%;
  background: rgba(10, 7, 5, 0.93);
  border: 2px solid #52371d;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.96), 0 6px 20px rgba(0, 0, 0, 0.8);
  min-height: 0;
}

.d2-panel-header {
  height: 36px;
  background: linear-gradient(180deg, #2e1c11, #160c07);
  border-bottom: 2px solid #5a3a1c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  color: #ffd860;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 2px #000;
}

/* ------------------------------------------------ Left: Global Chat */
.d2-chat-area {
  min-height: 0;
}

.d2-chat-tabs {
  display: flex;
  background: #150d08;
  border-bottom: 1px solid #3d2614;
  padding: 3px 8px;
  gap: 4px;
}

.d2-chat-tab {
  background: transparent;
  border: 1px solid transparent;
  color: #a8977c;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

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

.d2-chat-tab.active {
  color: #ffd34a;
  background: rgba(58, 41, 26, 0.8);
  border-color: #8c6030;
}

.d2-sender-clickable {
  cursor: pointer;
  font-weight: 700;
  transition: filter 0.15s;
}

.d2-sender-clickable.is-me {
  color: #48e868;
}

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

.d2-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: "Alegreya Sans", var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: #e9dcc4;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(4, 2, 2, 0.7);
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 #0c0806;
}

.d2-chat-log::-webkit-scrollbar {
  width: 6px;
}

.d2-chat-log::-webkit-scrollbar-track {
  background: #0c0806;
  border-left: 1px solid #28180c;
  border-radius: 3px;
}

.d2-chat-log::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid #8c5e30;
  border-radius: 3px;
}

.d2-chat-log::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
}

.d2-chat-msg {
  word-break: break-word;
  text-shadow: 0 1px 2px #000;
}

.d2-chat-msg.system {
  color: #3a8aff;
}

.d2-chat-msg.whisper {
  color: #48e868;
  font-weight: 600;
}

.d2-chat-msg.gem {
  color: #d040ff;
  font-weight: 700;
  text-shadow: 0 0 8px #c040ff;
}

.d2-chat-msg.emote {
  color: #ffb440;
  font-style: italic;
}

.d2-chat-input-bar {
  display: flex;
  padding: 8px 12px;
  gap: 8px;
  background: #140c08;
  border-top: 1px solid #3c2414;
}

.d2-input {
  flex: 1;
  background: #090605;
  border: 1px solid #5a3c20;
  border-radius: 2px;
  padding: 7px 12px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.d2-input:focus {
  border-color: #ffd860;
  box-shadow: 0 0 6px rgba(255, 216, 96, 0.4);
}

.d2-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: #0e0906;
  border-top: 1px solid #2a180e;
}

.d2-btn-classic {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 14px;
  color: #ffd860;
  background: linear-gradient(180deg, #3c2616, #1a0e08);
  border: 1px solid #6e4822;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1), 0 2px 4px #000;
  transition: all 0.15s;
}

.d2-btn-classic:hover {
  background: linear-gradient(180deg, #58361e, #2a150b);
  border-color: #ffd860;
  color: #fff;
}

.d2-btn-classic:active {
  transform: translateY(1px);
}

/* ------------------------------------------------ Right: Room Browser / Creator */
.d2-room-area {
  min-height: 0;
}

.d2-room-tabs {
  display: flex;
  background: #180f0a;
  border-bottom: 2px solid #4a3018;
}

.d2-tab-btn {
  flex: 1;
  padding: 9px 0;
  text-align: center;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #a8977c;
  background: #120a06;
  border: none;
  border-right: 1px solid #301e10;
  cursor: pointer;
  transition: all 0.15s;
}

.d2-tab-btn:hover {
  color: #ffd860;
  background: #20120b;
}

.d2-tab-btn.active {
  color: #ffd860;
  background: linear-gradient(180deg, #321d12, #1a0e08);
  border-bottom: 2px solid #ffd860;
}

.d2-tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 16px;
}

.d2-join-inputs {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
  width: 100%;
}

.d2-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  box-sizing: border-box;
}

.d2-input-group label {
  font-size: 11px;
  font-weight: 700;
  color: #ffd860;
  letter-spacing: 1px;
}

.d2-games-split {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
  margin-bottom: 12px;
}

.d2-games-table-wrap {
  flex: 3;
  background: #080504;
  border: 1px solid #3e2614;
  border-radius: 2px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 rgba(10, 6, 4, 0.75);
}

.d2-games-table-wrap::-webkit-scrollbar {
  width: 6px;
}

.d2-games-table-wrap::-webkit-scrollbar-track {
  background: rgba(10, 6, 4, 0.75);
  border-radius: 3px;
}

.d2-games-table-wrap::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid rgba(140, 94, 48, 0.55);
  border-radius: 3px;
}

.d2-games-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
}

.d2-games-header {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  background: #1e130c;
  border-bottom: 1px solid #4a301a;
  font-size: 11px;
  font-weight: 700;
  color: #ffd860;
  letter-spacing: 1px;
  position: sticky;
  top: 0;
}

.d2-game-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 14px;
  cursor: pointer;
  border-bottom: 1px solid #1a100a;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: #e9dcc4;
  transition: background 0.1s;
}

.d2-game-row:hover {
  background: #2a180e;
  color: #fff;
}

.d2-game-row.selected {
  background: #462816;
  color: #ffd860;
  font-weight: 700;
}

.d2-game-preview-pane {
  flex: 2;
  background: #0a0604;
  border: 1px solid #3e2614;
  border-radius: 2px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  font-family: var(--font-body);
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 rgba(10, 6, 4, 0.75);
}

.d2-game-preview-pane::-webkit-scrollbar {
  width: 6px;
}

.d2-game-preview-pane::-webkit-scrollbar-track {
  background: rgba(10, 6, 4, 0.75);
  border-radius: 3px;
}

.d2-game-preview-pane::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid rgba(140, 94, 48, 0.55);
  border-radius: 3px;
}

.d2-game-preview-pane::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
}

.d2-prev-title {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  color: #ffd860;
  border-bottom: 1px solid #3a2212;
  padding-bottom: 4px;
}

.d2-prev-elapsed {
  font-size: 12px;
  color: #a8977c;
}

.d2-prev-player-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.d2-prev-player-item {
  color: #ffd860;
}

.d2-prev-player-sub {
  font-size: 11px;
  color: #8c785c;
  margin-left: 6px;
}

.d2-room-bottom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ------------------------------------------------ Create Game View */
.d2-create-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 #0c0806;
}

.d2-create-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 #0c0806;
}

.d2-create-row {
  display: flex;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.d2-create-view::-webkit-scrollbar,
.d2-create-inputs::-webkit-scrollbar {
  width: 6px;
}

.d2-create-view::-webkit-scrollbar-track,
.d2-create-inputs::-webkit-scrollbar-track {
  background: #0c0806;
  border-radius: 3px;
}

.d2-create-view::-webkit-scrollbar-thumb,
.d2-create-inputs::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid rgba(140, 94, 48, 0.55);
  border-radius: 3px;
}

.d2-create-view::-webkit-scrollbar-thumb:hover,
.d2-create-inputs::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
}

/* ------------------------------------------------ Bottom Pedestal: Full Width Dais */
.d2-pedestal-wrap {
  width: 100%;
  height: 148px;
  background: linear-gradient(180deg, #24160c 0%, #160c06 14%, #0a0604 100%);
  border-top: 2px solid #8e5c2e;
  box-shadow: inset 0 1px 0 #caa050, 0 -6px 20px #000;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
  box-sizing: border-box;
  overflow: visible;
  transition: height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.d2-pedestal-wrap.collapsed {
  height: 22px;
}

.d2-pedestal-wrap.collapsed .d2-pedestal-rail {
  display: none;
}

.d2-pedestal-rail {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: flex-end;
  margin-top: -26px;
  padding: 26px 24px 8px;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 rgba(10, 6, 4, 0.75);
}

.d2-pedestal-rail::-webkit-scrollbar {
  height: 6px;
}

.d2-pedestal-rail::-webkit-scrollbar-track {
  background: rgba(10, 6, 4, 0.75);
  border-radius: 3px;
  margin: 0 12px;
}

.d2-pedestal-rail::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid rgba(140, 94, 48, 0.55);
  border-radius: 3px;
}

.d2-pedestal-rail::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
}

.d2-player-pod {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  width: 100px;
  position: relative;
  overflow: visible;
  transition: transform 0.15s;
}

.d2-player-pod:hover {
  transform: translateY(-4px);
}

.d2-player-canvas-wrap {
  width: 84px;
  height: 92px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  overflow: visible;
}

.d2-player-canvas {
  width: 148px;
  height: 148px;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.d2-player-name-plaque {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  color: #ffd860;
  text-shadow: 0 1px 3px #000, 0 0 5px #000;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  line-height: 1.2;
}

.d2-player-pod.is-me .d2-player-name-plaque {
  color: #48e868;
}

.d2-player-level-tag {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 600;
  color: #d4aa60;
  text-shadow: 0 1px 2px #000;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  line-height: 1.15;
  margin-top: 1px;
}

.d2-player-class-tag {
  font-family: var(--font-body);
  font-size: 10px;
  color: #a8977c;
  text-shadow: 0 1px 2px #000;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.d2-player-title-tag {
  text-align: center;
  white-space: nowrap;
}

.d2-pedestal-toggle {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #3c2414, #1a0e08);
  border: 1px solid #7a4e26;
  border-radius: 12px;
  padding: 2px 16px;
  font-family: var(--font-head);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffd860;
  cursor: pointer;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.15);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.d2-pedestal-toggle:hover {
  background: linear-gradient(180deg, #58361e, #2a150b);
  border-color: #ffd860;
  color: #fff;
  transform: translateX(-50%) translateY(-1px);
}

.d2-toggle-arrow {
  font-size: 9px;
  color: #ff9a2a;
}

.d2-btn-quit {
  background: linear-gradient(180deg, #581c14, #2a0b07) !important;
  border: 1px solid #8c362a !important;
  color: #ffb8b0 !important;
}

.d2-btn-quit:hover {
  background: linear-gradient(180deg, #7c261c, #3c0f0a) !important;
  border-color: #ff6040 !important;
  color: #ffffff !important;
  box-shadow: 0 0 10px rgba(255, 96, 64, 0.4) !important;
}

/* ------------------------------------------------ Portrait & Mobile Responsive Stacking */
@media (orientation: portrait),
(max-width: 820px) {
  #d2-lobby .d2-header {
    height: 56px;
    padding: 0 8px;
    box-sizing: border-box;
  }

  #d2-lobby .d2-header-left {
    flex: 0 0 88px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    position: relative;
    z-index: 10;
  }

  #d2-lobby .d2-header-right {
    flex: 0 0 88px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    position: relative;
    z-index: 10;
    pointer-events: auto;
  }

  #d2-lobby .d2-header-right button {
    width: 66px;
    padding: 2px 0;
    font-size: 10px;
    line-height: 1.15;
  }

  #d2-lobby .d2-center-logo-wrap {
    pointer-events: none;
  }

  #d2-lobby .d2-center-logo-wrap .d2-logo-img {
    height: 24px;
    pointer-events: none;
  }

  #d2-lobby .d2-center-logo-wrap .d2-logo-fire {
    width: 170px;
    height: 52px;
    pointer-events: none;
  }

  #d2-lobby .d2-title-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
    padding: 0 4px;
    scale: 2;
    top: 16px;
    pointer-events: none;
    z-index: 1;
  }

  #d2-lobby .d2-channel-title {
    font-size: 11.5px;
    letter-spacing: 0.8px;
    line-height: 1.15;
    margin: 0;
  }

  #d2-lobby .d2-channel-sub {
    font-size: 8.5px;
    letter-spacing: 0.4px;
    line-height: 1.15;
    margin-top: 1px;
  }

  #d2-lobby .d2-btn-quit {
    padding: 4px 10px;
    font-size: 10.5px;
  }

  /* Main body stacks: Game list on top, Chat on bottom */
  #d2-lobby .d2-body {
    flex-direction: column;
    padding: 6px 8px 4px;
    gap: 8px;
    min-height: 0;
    margin-top: 16px;
    margin-bottom: 16px;
  }

  #d2-lobby .d2-panel {
    flex: 1 1 50%;
    min-height: 0;
  }

  /* Game list on top */
  #d2-lobby .d2-room-area {
    order: 1;
    flex: 1 1 53%;
    min-height: 0;
  }

  /* Chat on bottom */
  #d2-lobby .d2-chat-area {
    order: 2;
    flex: 1 1 47%;
    min-height: 0;
  }

  #d2-lobby .d2-panel-header {
    height: 28px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  #d2-lobby .d2-tab-btn {
    padding: 7px 0;
    font-size: 12px;
  }

  #d2-lobby .d2-tab-content {
    padding: 8px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #d2-lobby .d2-create-view {
    gap: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #d2-lobby .d2-create-inputs {
    gap: 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #d2-lobby .d2-create-row {
    gap: 8px;
  }

  #d2-lobby .d2-join-inputs {
    gap: 8px;
    margin-bottom: 6px;
  }

  #d2-lobby .d2-input-group label {
    font-size: 10px;
  }

  #d2-lobby .d2-input {
    padding: 5px 8px;
    font-size: 13px;
  }

  #d2-lobby .d2-games-split {
    gap: 8px;
    margin-bottom: 6px;
  }

  #d2-lobby .d2-games-header {
    padding: 5px 8px;
    font-size: 10px;
  }

  #d2-lobby .d2-game-row {
    padding: 5px 8px;
    font-size: 12px;
  }

  #d2-lobby .d2-game-preview-pane {
    padding: 6px 8px;
    font-size: 11px;
    gap: 4px;
  }

  #d2-lobby .d2-prev-title {
    font-size: 11px;
    padding-bottom: 2px;
  }

  #d2-lobby .d2-room-bottom-actions {
    gap: 8px;
  }

  #d2-lobby .d2-chat-log {
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    gap: 4px;
  }

  #d2-lobby .d2-chat-input-bar {
    padding: 5px 8px;
    gap: 6px;
  }

  #d2-lobby .d2-chat-actions {
    padding: 4px 8px;
    gap: 6px;
  }

  #d2-lobby .d2-btn-classic {
    font-size: 10px;
    padding: 4px 10px;
  }

  #d2-lobby .d2-pedestal-wrap {
    height: 134px;
  }

  #d2-lobby .d2-pedestal-wrap.collapsed {
    height: 22px;
  }

  #d2-lobby .d2-pedestal-rail {
    margin-top: -48px;
    padding: 48px 12px 6px;
    gap: 12px;
  }

  #d2-lobby .d2-player-pod {
    width: 80px;
  }

  #d2-lobby .d2-player-canvas-wrap {
    width: 68px;
    height: 70px;
  }

  #d2-lobby .d2-player-canvas {
    width: 120px;
    height: 120px;
  }

  #d2-lobby .d2-player-name-plaque {
    font-size: 11px;
  }

  #d2-lobby .d2-player-level-tag {
    font-size: 9.5px;
  }

  #d2-lobby .d2-player-class-tag {
    font-size: 9px;
  }
}

/* Also support body.portrait class explicitly */
body.portrait #d2-lobby .d2-body {
  flex-direction: column;
  padding: 6px 8px 4px;
  gap: 8px;
  min-height: 0;
  margin-top: 16px;
  margin-bottom: 16px;
}

body.portrait #d2-lobby .d2-room-area {
  order: 1;
  flex: 1 1 53%;
  min-height: 0;
}

body.portrait #d2-lobby .d2-chat-area {
  order: 2;
  flex: 1 1 47%;
  min-height: 0;
}

/* ==========================================================================
   GAME MODE SELECT SCREEN (Single Player vs Online Multiplayer)
   ========================================================================== */
.gamemode-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 20%, rgba(35, 22, 14, 0.75) 0%, rgba(10, 6, 4, 0.95) 70%, #060403 100%), #080504;
  overflow-y: auto;
  box-sizing: border-box;
}

.gamemode-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(32, 20, 12, 0.9) 0%, rgba(16, 10, 6, 0.95) 100%);
  border: 1px solid #78502a;
  box-shadow: inset 0 1px 0 rgba(230, 185, 100, 0.25), 0 4px 16px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  padding: 6px 16px 6px 10px;
  margin-bottom: 14px;
}

.gamemode-hero-cv {
  width: 48px;
  height: 54px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.gamemode-hero-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gamemode-hero-name {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: #ffd860;
  text-shadow: 0 1px 4px #000;
  margin: 0;
}

.gamemode-hero-stats {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: #c8b496;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gamemode-dot {
  color: #6a5038;
}

.gamemode-gold {
  color: #ffb830;
  font-weight: 600;
}

.gamemode-title {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 900;
  color: #f5dfba;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px #000, 0 0 20px rgba(230, 170, 70, 0.35);
  margin: 0 0 4px;
  text-align: center;
}

.gamemode-subtitle {
  font-family: var(--font-body);
  font-size: 13.5px;
  color: #9f8c74;
  margin: 0 0 18px;
  text-align: center;
}

.gamemode-grid {
  display: flex;
  gap: 20px;
  max-width: 760px;
  width: 100%;
  justify-content: center;
  align-items: stretch;
  margin-bottom: 18px;
}

.gamemode-card {
  flex: 1 1 320px;
  max-width: 360px;
  background: linear-gradient(180deg, #1c120a 0%, #120b06 100%);
  border: 2px solid #5a3a1e;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(220, 180, 110, 0.2), 0 8px 28px rgba(0, 0, 0, 0.7);
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}

.gamemode-card-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 90px;
  background: radial-gradient(ellipse at 50% 0%, rgba(200, 140, 50, 0.15) 0%, transparent 75%);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.gamemode-card:hover,
.gamemode-card:focus-visible {
  transform: translateY(-4px);
  border-color: #d4a34b;
  box-shadow: inset 0 1px 0 rgba(255, 220, 140, 0.4), 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 20px rgba(212, 163, 75, 0.25);
  outline: none;
}

.gamemode-card:hover .gamemode-card-glow,
.gamemode-card:focus-visible .gamemode-card-glow {
  opacity: 1;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 175, 60, 0.3) 0%, transparent 75%);
}

.gamemode-card-icon-wrap {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle, #2a180c 0%, #130a05 100%);
  border: 1px solid #784c24;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 12px rgba(180, 110, 30, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f0c060;
  margin-bottom: 12px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.gamemode-card-icon-wrap svg {
  width: 36px;
  height: 36px;
}

.gamemode-card:hover .gamemode-card-icon-wrap {
  transform: scale(1.08);
  color: #ffdf80;
  border-color: #d4a34b;
}

.gamemode-card-name {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 800;
  color: #f7e6cb;
  letter-spacing: 1px;
  margin: 0 0 3px;
}

.gamemode-card-tag {
  font-family: var(--font-head);
  font-size: 10.5px;
  font-weight: 700;
  color: #bb8844;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.gamemode-card-desc {
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.4;
  color: #ab977e;
  margin: 0 0 16px;
  flex: 1;
}

.gamemode-action-btn {
  width: 100%;
  margin-top: auto;
}

.gamemode-card-mp .gamemode-card-icon-wrap {
  color: #64b5f6;
  border-color: #3b5b82;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 12px rgba(60, 130, 220, 0.25);
}

.gamemode-card-mp:hover .gamemode-card-icon-wrap {
  color: #90caf9;
  border-color: #72a9e0;
}

.gamemode-card-mp .gamemode-card-tag {
  color: #6ea0d4;
}

.gamemode-card-mp:hover,
.gamemode-card-mp:focus-visible {
  border-color: #64b5f6;
  box-shadow: inset 0 1px 0 rgba(160, 210, 255, 0.4), 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 22px rgba(100, 180, 250, 0.28);
}

.gamemode-card-mp:hover .gamemode-card-glow,
.gamemode-card-mp:focus-visible .gamemode-card-glow {
  background: radial-gradient(ellipse at 50% 0%, rgba(70, 150, 250, 0.3) 0%, transparent 75%);
}

.gamemode-btn-online {
  background: linear-gradient(180deg, #1b3858 0%, #10243b 60%, #0a1624 100%) !important;
  border-color: #4b80b6 !important;
  color: #e4f0fc !important;
}

.gamemode-btn-online:hover {
  background: linear-gradient(180deg, #254d78 0%, #163252 60%, #0f2034 100%) !important;
  border-color: #72a9e0 !important;
  color: #ffffff !important;
}

.gamemode-bottom-row {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 820px;
}

/* Landscape mobile / short viewports (phone horizontal screens) */
@media (max-height: 560px) {
  .gamemode-screen {
    padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    justify-content: safe center;
  }

  .gamemode-hero {
    display: none;
  }

  .gamemode-title {
    font-size: 18px;
    margin: 0 0 2px;
  }

  .gamemode-subtitle {
    font-size: 11.5px;
    margin: 0 0 8px;
  }

  .gamemode-grid {
    flex-direction: row;
    gap: 12px;
    max-width: 640px;
    margin-bottom: 8px;
  }

  .gamemode-card {
    flex: 1 1 240px;
    max-width: 310px;
    padding: 10px 14px 10px;
    border-radius: 6px;
  }

  .gamemode-card-icon-wrap {
    width: 38px;
    height: 38px;
    margin-bottom: 4px;
  }

  .gamemode-card-icon-wrap svg {
    width: 22px;
    height: 22px;
  }

  .gamemode-card-name {
    font-size: 14.5px;
    margin: 0 0 1px;
  }

  .gamemode-card-tag {
    font-size: 9px;
    margin-bottom: 3px;
    letter-spacing: 1px;
  }

  .gamemode-card-desc {
    font-size: 11px;
    line-height: 1.25;
    margin: 0 0 8px;
  }

  .gamemode-action-btn {
    padding: 5px 12px !important;
    font-size: 13px !important;
  }

  .gamemode-bottom-row .btn {
    padding: 3px 18px;
    font-size: 12px;
  }
}

/* Portrait mobile / narrow viewports */
@media (max-width: 680px),
(orientation: portrait) {
  .gamemode-screen {
    padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    justify-content: safe center;
  }

  .gamemode-hero {
    margin-bottom: 10px;
    padding: 5px 14px 5px 10px;
  }

  .gamemode-hero-cv {
    width: 42px;
    height: 48px;
  }

  .gamemode-hero-name {
    font-size: 16px;
  }

  .gamemode-hero-stats {
    font-size: 11.5px;
  }

  .gamemode-title {
    font-size: 20px;
    margin: 0 0 2px;
  }

  .gamemode-subtitle {
    font-size: 12px;
    margin: 0 0 12px;
  }

  .gamemode-grid {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }

  .gamemode-card {
    width: 100%;
    max-width: 320px;
    padding: 14px 16px 14px;
  }

  .gamemode-card-icon-wrap {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
  }

  .gamemode-card-icon-wrap svg {
    width: 26px;
    height: 26px;
  }

  .gamemode-card-name {
    font-size: 16px;
    margin: 0 0 2px;
  }

  .gamemode-card-tag {
    font-size: 9.5px;
    margin-bottom: 6px;
  }

  .gamemode-card-desc {
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .gamemode-action-btn {
    padding: 7px 16px !important;
    font-size: 14px !important;
  }

  .gamemode-bottom-row .btn {
    padding: 4px 20px;
    font-size: 13px;
  }
}

/* ==========================================================================
   ONLINE ACCOUNT LOGIN / REGISTER & CHARACTER ROSTER SCREENS
   ========================================================================== */
.online-auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: radial-gradient(circle at 50% 20%, rgba(35, 22, 14, 0.78) 0%, rgba(10, 6, 4, 0.96) 72%, #060403 100%), #080504;
  overflow-y: auto;
  box-sizing: border-box;
}

.online-auth-panel {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, rgba(28, 18, 10, 0.96) 0%, rgba(14, 9, 5, 0.98) 100%);
  border: 2px solid #78502a;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 215, 130, 0.25), 0 16px 48px rgba(0, 0, 0, 0.85);
  padding: 24px 26px 20px;
  box-sizing: border-box;
}

.online-auth-header {
  text-align: center;
  margin-bottom: 16px;
}

.online-auth-badge {
  font-family: var(--font-head);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #c89e38;
  margin-bottom: 4px;
}

.online-auth-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 900;
  color: #ffd860;
  letter-spacing: 1.5px;
  margin: 0 0 6px;
  text-shadow: 0 2px 6px #000;
}

.online-auth-sub {
  font-family: var(--font-body);
  font-size: 13px;
  color: #b4a088;
  margin: 0;
  line-height: 1.35;
}

.online-auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: rgba(8, 5, 3, 0.7);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #48301a;
}

.online-auth-tab {
  flex: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #a69279;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.online-auth-tab:hover {
  color: #f3dfc1;
}

.online-auth-tab.active {
  background: linear-gradient(180deg, #3a2412 0%, #24150a 100%);
  border-color: #9e6e36;
  color: #ffd860;
  box-shadow: inset 0 1px 0 rgba(255, 220, 140, 0.2);
}

.online-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.online-auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.online-auth-field.hidden {
  display: none !important;
}

.online-auth-label {
  font-family: var(--font-head);
  font-size: 11.5px;
  font-weight: 700;
  color: #d8c3a5;
  letter-spacing: 0.6px;
}

.online-auth-input {
  background: rgba(8, 5, 3, 0.9);
  border: 1px solid #6b4826;
  border-radius: 4px;
  color: #f5e6cf;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 9px 12px;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}

.online-auth-input:focus {
  border-color: #ffd34a;
  box-shadow: 0 0 8px rgba(255, 211, 74, 0.25);
}

.online-auth-error {
  background: rgba(120, 22, 18, 0.35);
  border: 1px solid #c94a4a;
  border-radius: 4px;
  color: #ff9e9e;
  font-size: 13px;
  padding: 8px 10px;
  text-align: center;
}

.online-auth-error.hidden {
  display: none !important;
}

.online-auth-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.online-auth-actions .btn.big {
  flex: 1;
}

.online-auth-switch {
  text-align: center;
  margin-top: 2px;
}

.online-auth-link {
  background: none;
  border: none;
  color: #d4a84f;
  font-family: var(--font-body);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 8px;
}

.online-auth-link:hover {
  color: #ffe08a;
}

/* Online Character Roster Screen & Layout */
.online-char-screen {
  justify-content: flex-start !important;
  align-items: center !important;
  padding: 14px 20px 10px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  height: 100% !important;
}

.online-roster-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 8px;
  padding: 0 6px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.online-roster-topbar .screen-title {
  margin: 0;
  text-align: left;
}

.online-roster-topbar .d2-btn-quit {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 20px;
  font-size: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #581c14, #2a0b07);
  border: 1px solid #8c362a;
  color: #ffb8b0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: all 0.15s ease;
}

.online-roster-topbar .d2-btn-quit:hover {
  background: linear-gradient(180deg, #7c261c, #3c0f0a);
  border-color: #ff6040;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 96, 64, 0.4);
}

.online-roster-main {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  gap: 20px;
  box-sizing: border-box;
}

.online-roster-left {
  flex: 1 1 58%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-right: 6px;
  box-sizing: border-box;
}

.online-roster-left::-webkit-scrollbar {
  width: 6px;
}

.online-roster-left::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.online-roster-left::-webkit-scrollbar-thumb {
  background: #5c3d20;
  border-radius: 3px;
}

.online-roster-left::-webkit-scrollbar-thumb:hover {
  background: #8b5d32;
}

.online-char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  width: 100%;
  padding: 2px 4px 10px;
  box-sizing: border-box;
}

.online-char-card {
  height: clamp(140px, 22vh, 175px);
}

.online-roster-right {
  flex: 0 0 410px;
  max-width: 440px;
  min-width: 330px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-sizing: border-box;
}

.online-char-detail-panel {
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 20%, #1e130a 0%, #0c0805 100%);
  border: 1.5px solid #6e4a25;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.85), inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px rgba(110, 74, 37, 0.3);
  padding: 14px 16px;
  box-sizing: border-box;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.online-char-detail-panel::-webkit-scrollbar {
  width: 6px;
}

.online-char-detail-panel::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.online-char-detail-panel::-webkit-scrollbar-thumb {
  background: #5c3d20;
  border-radius: 3px;
}

.online-detail-header {
  margin-bottom: 8px;
}

.online-char-name {
  margin: 0 0 4px;
  font: 900 24px var(--font-head);
  color: var(--gold-bright);
  letter-spacing: 1.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(255, 211, 74, 0.3);
}

.online-char-meta {
  font-size: 13px;
  color: #d8c7af;
  margin-bottom: 6px;
  line-height: 1.35;
}

.online-char-lore {
  font-size: 12px;
  color: #a8977c;
  margin: 4px 0 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.online-char-stats {
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 10px;
}

.online-detail-equip {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 4px 0 10px;
}

.online-detail-equip .inv-section-title {
  width: 100%;
  margin-bottom: 6px;
}

.online-char-paperdoll {
  background: radial-gradient(ellipse at 50% 54%, #4b3422 0%, #261a12 55%, #130d09 100%);
  border: 1px solid #76532c;
  border-radius: 5px;
  box-shadow: inset 0 0 30px #080503, 0 0 0 1px #100b07;
  grid-template-columns: repeat(4, 56px);
  grid-template-rows: repeat(4, 56px);
  gap: 5px;
  padding: 6px;
  margin: 0 auto;
}

.online-char-paperdoll .eslot {
  width: 56px;
  height: 56px;
}

.online-char-paperdoll .portrait img {
  max-height: 120px;
  max-width: 68px;
}

.online-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 10px;
}

.online-enter-btn {
  width: 100% !important;
  font-size: 18px !important;
  padding: 10px 18px !important;
  text-align: center;
  justify-content: center;
  box-sizing: border-box;
}

.online-delete-btn {
  width: 100% !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
  text-align: center;
  justify-content: center;
  box-sizing: border-box;
}

.online-roster-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 8px auto 0;
  padding: 0 6px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.online-account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(20, 13, 8, 0.85);
  border: 1px solid #5c3d20;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 13px;
  color: #cbb799;
}

.online-account-email b {
  color: #ffd860;
}

@media (max-width: 860px) and (orientation: portrait) {
  .online-char-screen {
    overflow-y: auto !important;
    padding: 10px !important;
  }

  .online-roster-main {
    flex-direction: column;
    overflow-y: visible;
  }

  .online-roster-left {
    flex: none;
    max-height: 250px;
    padding-right: 0;
  }

  .online-roster-right {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .online-char-detail-panel {
    max-height: none;
    flex: none;
  }

  .online-roster-footer {
    justify-content: center;
  }
}

/* Mobile Landscape for Online Character Screen: 3-column grid on left, info panel on right with buttons below */
@media (orientation: landscape) and (max-height: 560px),
(orientation: landscape) and (max-width: 950px) {
  .online-char-screen {
    padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
    overflow: hidden !important;
    height: 100% !important;
  }

  .online-roster-topbar {
    margin: 0 auto 4px !important;
    padding: 0 4px !important;
  }

  .online-roster-topbar .screen-title {
    font-size: 14px !important;
  }

  .online-roster-topbar .d2-btn-quit {
    padding: 3px 14px !important;
    font-size: 11px !important;
  }

  .online-roster-main {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    width: 100% !important;
  }

  .online-roster-left {
    flex: 1 1 54% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    max-height: none !important;
    padding-right: 4px !important;
  }

  .online-char-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    padding: 2px 2px 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .online-char-card,
  .online-create-card {
    height: clamp(96px, 24vh, 126px) !important;
    min-height: 90px !important;
    padding: 4px !important;
  }

  .online-char-card .card-lv {
    font-size: 9px !important;
    top: 2px !important;
    right: 4px !important;
  }

  .online-char-card .plaque {
    font-size: 9.5px !important;
    padding: 1px 4px !important;
    bottom: 2px !important;
  }

  .online-create-card-title {
    font-size: 11px !important;
  }

  .online-create-card-sub {
    font-size: 8.5px !important;
  }

  .online-roster-right {
    flex: 0 0 clamp(240px, 44vw, 360px) !important;
    max-width: 48% !important;
    min-width: 230px !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    box-sizing: border-box !important;
  }

  .online-char-detail-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 8px 10px !important;
    max-height: none !important;
  }

  .online-char-name {
    font-size: 16px !important;
    margin: 0 0 2px !important;
  }

  .online-char-meta {
    font-size: 11px !important;
    margin-bottom: 3px !important;
  }

  .online-char-lore {
    font-size: 10px !important;
    margin: 2px 0 4px !important;
    -webkit-line-clamp: 1 !important;
  }

  .online-char-stats {
    font-size: 10.5px !important;
    margin-bottom: 4px !important;
    line-height: 1.3 !important;
  }

  .online-detail-equip {
    margin: 2px 0 4px !important;
  }

  .online-detail-equip .inv-section-title {
    font-size: 10.5px !important;
    margin-bottom: 2px !important;
  }

  .online-char-paperdoll {
    grid-template-columns: repeat(4, 34px) !important;
    grid-template-rows: repeat(4, 34px) !important;
    gap: 3px !important;
    padding: 3px !important;
  }

  .online-char-paperdoll .eslot {
    width: 34px !important;
    height: 34px !important;
  }

  .online-char-paperdoll .portrait img {
    max-height: 72px !important;
    max-width: 44px !important;
  }

  .online-detail-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    margin-top: 6px !important;
    flex-shrink: 0 !important;
  }

  .online-enter-btn {
    flex: 1.8 !important;
    font-size: 13.5px !important;
    padding: 7px 10px !important;
  }

  .online-delete-btn {
    flex: 1 !important;
    font-size: 11px !important;
    padding: 7px 6px !important;
  }

  .online-roster-footer {
    margin: 4px auto 0 !important;
    padding: 0 4px !important;
    justify-content: flex-end !important;
  }

  .online-account-bar {
    padding: 2px 8px !important;
    font-size: 11px !important;
    gap: 6px !important;
  }

  .online-account-bar .btn.small {
    padding: 2px 8px !important;
    font-size: 11px !important;
  }
}

body.touch.landscape .online-char-screen,
body.touch:not(.portrait) .online-char-screen {
  padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
  overflow: hidden !important;
  height: 100% !important;
}

body.touch.landscape .online-roster-main,
body.touch:not(.portrait) .online-roster-main {
  display: flex !important;
  flex-direction: row !important;
  gap: 10px !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
  width: 100% !important;
}

body.touch.landscape .online-roster-left,
body.touch:not(.portrait) .online-roster-left {
  flex: 1 1 54% !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  max-height: none !important;
  padding-right: 4px !important;
}

body.touch.landscape .online-char-grid,
body.touch:not(.portrait) .online-char-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 6px !important;
  padding: 2px 2px 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body.touch.landscape .online-char-card,
body.touch.landscape .online-create-card,
body.touch:not(.portrait) .online-char-card,
body.touch:not(.portrait) .online-create-card {
  height: clamp(96px, 24vh, 126px) !important;
  min-height: 90px !important;
  padding: 4px !important;
}

body.touch.landscape .online-char-card .card-lv,
body.touch:not(.portrait) .online-char-card .card-lv {
  font-size: 9px !important;
  top: 2px !important;
  right: 4px !important;
}

body.touch.landscape .online-char-card .plaque,
body.touch:not(.portrait) .online-char-card .plaque {
  font-size: 9.5px !important;
  padding: 1px 4px !important;
  bottom: 2px !important;
}

body.touch.landscape .online-roster-right,
body.touch:not(.portrait) .online-roster-right {
  flex: 0 0 clamp(240px, 44vw, 360px) !important;
  max-width: 48% !important;
  min-width: 230px !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  box-sizing: border-box !important;
}

body.touch.landscape .online-char-detail-panel,
body.touch:not(.portrait) .online-char-detail-panel {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 8px 10px !important;
  max-height: none !important;
}

body.touch.landscape .online-char-paperdoll,
body.touch:not(.portrait) .online-char-paperdoll {
  grid-template-columns: repeat(4, 34px) !important;
  grid-template-rows: repeat(4, 34px) !important;
  gap: 3px !important;
  padding: 3px !important;
}

body.touch.landscape .online-char-paperdoll .eslot,
body.touch:not(.portrait) .online-char-paperdoll .eslot {
  width: 34px !important;
  height: 34px !important;
}

body.touch.landscape .online-char-paperdoll .portrait img,
body.touch:not(.portrait) .online-char-paperdoll .portrait img {
  max-height: 72px !important;
  max-width: 44px !important;
}

body.touch.landscape .online-detail-actions,
body.touch:not(.portrait) .online-detail-actions {
  display: flex !important;
  flex-direction: row !important;
  gap: 6px !important;
  margin-top: 6px !important;
  flex-shrink: 0 !important;
}

body.touch.landscape .online-enter-btn,
body.touch:not(.portrait) .online-enter-btn {
  flex: 1.8 !important;
  font-size: 13.5px !important;
  padding: 7px 10px !important;
}

body.touch.landscape .online-delete-btn,
body.touch:not(.portrait) .online-delete-btn {
  flex: 1 !important;
  font-size: 11px !important;
  padding: 7px 6px !important;
}

@media (orientation: portrait) {
  .online-char-screen {
    overflow-y: auto !important;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
  }

  .online-roster-main {
    flex-direction: column;
    overflow-y: visible;
  }

  .online-roster-left {
    flex: 1 1 auto;
    max-height: none;
    padding-right: 0;
  }

  .online-roster-right {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .online-char-detail-panel {
    display: none !important;
  }

  .online-roster-footer {
    justify-content: center;
  }
}

body.portrait .online-char-detail-panel {
  display: none !important;
}

body.portrait .online-roster-left {
  flex: 1 1 auto;
  max-height: none;
}

.online-create-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-style: dashed !important;
  border-color: #7a552c !important;
  background: rgba(24, 15, 9, 0.65) !important;
}

.online-create-card:hover {
  border-color: #ffd34a !important;
  background: rgba(45, 28, 15, 0.85) !important;
}

.online-create-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding-bottom: 18px;
  color: #dcb464;
}

.online-create-plus {
  font-family: var(--font-head);
  font-size: 36px;
  line-height: 1;
  font-weight: 700;
  color: #ffd34a;
  margin-bottom: 4px;
}

.online-create-label {
  font-family: var(--font-head);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #c8b08a;
  text-align: center;
}

/* Online Character Creation Name Check */
.online-create-name-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 6px 0 2px;
}

.online-name-status {
  font-size: 13px;
  min-height: 19px;
  text-align: center;
}

.online-name-status.checking {
  color: #e6c670;
}

.online-name-status.ok {
  color: #6ee787;
  font-weight: 600;
}

.online-name-status.bad {
  color: #ff8080;
  font-weight: 600;
}

/* ------------------------------------------------------------------ Friends List Modal */
.d2-friends-overlay,
.d2-add-friend-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.d2-friends-window {
  width: min(540px, 94vw);
  max-height: 80vh;
  background: linear-gradient(180deg, #18110b 0%, #0d0906 100%);
  border: 2px solid #5a3c1e;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9), inset 0 0 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(90, 60, 30, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
}

.d2-friends-head {
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(38, 24, 15, 0.95) 0%, rgba(20, 12, 8, 0.95) 100%);
  border-bottom: 2px solid #5a3c1e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.d2-friends-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.d2-friends-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffd860;
  text-shadow: 0 2px 4px #000, 0 0 10px rgba(255, 180, 40, 0.4);
}

.d2-friends-stats {
  font-size: 12px;
  color: #a8977c;
}

.d2-friends-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.d2-friends-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 180px;
  max-height: 52vh;
  scrollbar-width: thin;
  scrollbar-color: #5a3c20 rgba(10, 6, 4, 0.75);
}

.d2-friends-list::-webkit-scrollbar {
  width: 6px;
}

.d2-friends-list::-webkit-scrollbar-track {
  background: rgba(10, 6, 4, 0.75);
  border-radius: 3px;
}

.d2-friends-list::-webkit-scrollbar-thumb {
  background: #5a3c20;
  border: 1px solid rgba(140, 94, 48, 0.55);
  border-radius: 3px;
}

.d2-friends-list::-webkit-scrollbar-thumb:hover {
  background: #7a502a;
  border-color: #d4a34b;
}

.d2-friends-empty {
  padding: 32px 16px;
  text-align: center;
  color: #a8977c;
  font-size: 14px;
}

.d2-friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(28, 18, 12, 0.65);
  border: 1px solid #3d2816;
  border-radius: 4px;
  transition: background 0.15s, border-color 0.15s;
}

.d2-friend-row:hover {
  background: rgba(45, 30, 20, 0.85);
  border-color: #6d4826;
}

.d2-friend-row.offline {
  opacity: 0.72;
}

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

.d2-friend-dot.online {
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
}

.d2-friend-dot.offline {
  background: #554433;
}

.d2-friend-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.d2-friend-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.d2-friend-name {
  font-weight: 700;
  font-size: 15px;
  color: #ffd860;
  letter-spacing: 0.5px;
}

.d2-friend-row.offline .d2-friend-name {
  color: #d8caa8;
}

.d2-friend-meta {
  font-size: 12px;
  color: #a8977c;
}

.d2-friend-loc-wrap {
  font-size: 11px;
}

.d2-friend-loc.room {
  color: #20e0ff;
  text-shadow: 0 0 6px rgba(32, 224, 255, 0.4);
}

.d2-friend-loc.lobby {
  color: #ffd34a;
}

.d2-friend-loc.offline {
  color: #7a6858;
}

.d2-friend-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.d2-friend-row-actions button.join {
  color: #34d399;
}

.d2-friend-row-actions button.whisper-online {
  color: #ffd860;
}

.d2-friend-row-actions button.whisper-offline {
  color: #a8977c;
  opacity: 0.85;
}

.d2-friend-row-actions button.whisper-offline:hover {
  color: #ffd860;
  opacity: 1;
}

.d2-friend-row-actions button.red {
  color: #ff6060;
  padding: 4px 8px;
}

.d2-friends-foot {
  padding: 8px 16px;
  background: rgba(12, 8, 5, 0.9);
  border-top: 1px solid #3d2816;
  font-size: 11px;
  text-align: center;
}

/* Add Friend Modal Dialog */
.d2-add-friend-box {
  width: min(380px, 90vw);
  background: linear-gradient(180deg, #20140c 0%, #100a06 100%);
  border: 2px solid #6d4826;
  border-radius: 6px;
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.d2-add-friend-title {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
  color: #ffd860;
  letter-spacing: 1px;
  margin: 0;
  text-align: center;
}

.d2-add-friend-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.d2-add-friend-err {
  font-size: 12px;
  color: #ff6060;
}

.d2-add-friend-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}