:root {
  --bg-deep: #0b0d13;
  --bg-panel: #151924;
  --bg-card: #1b202e;
  --bg-slot: #10141e;
  --border-subtle: #2a3145;
  --border-bright: #495678;
  --text-main: #e6ebf5;
  --text-muted: #8f9bb3;
  --accent-gold: #f0b949;
  --accent-red: #e04f5f;
  --accent-blue: #4a8ef5;
  --accent-cyan: #48d5f7;
  --accent-green: #42c97a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #171d2c 0%, var(--bg-deep) 70%);
  color: var(--text-main);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

/* Sprite Icons (128x224 atlas scaled 2x to 256x448 => 32x32 per tile) */
.sprite-icon {
  width: 32px;
  height: 32px;
  background-image: url("/assets/sprites/world_16x16.png");
  background-size: 256px 448px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

.sprite-icon-sm {
  width: 32px;
  height: 32px;
}

/* Badges & Buttons */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-hc {
  background: rgba(240, 185, 73, 0.16);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
}

.badge-std {
  background: rgba(74, 142, 245, 0.16);
  border: 1px solid var(--accent-blue);
  color: #84b6ff;
}

.badge-nexus {
  background: rgba(66, 201, 122, 0.15);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
}

.badge-combat {
  background: rgba(224, 79, 95, 0.18);
  border: 1px solid var(--accent-red);
  color: #ff808e;
}

.badge-dungeon {
  background: rgba(184, 107, 255, 0.18);
  border: 1px solid #b86bff;
  color: #ddb8ff;
}

.badge-patu {
  background: rgba(242, 157, 56, 0.2);
  border: 1px solid #ffbd61;
  color: #ffe4b8;
  box-shadow: 0 0 8px rgba(242, 157, 56, 0.28);
}

.badge-time-morning {
  background: rgba(255, 186, 118, 0.18);
  border: 1px solid #ffba76;
  color: #ffe1be;
}

.badge-time-day {
  background: rgba(92, 225, 255, 0.14);
  border: 1px solid #5ce1ff;
  color: #c8f5ff;
}

.badge-time-evening {
  background: rgba(235, 118, 72, 0.2);
  border: 1px solid #eb7648;
  color: #ffd1bd;
}

.badge-time-night {
  background: rgba(84, 108, 204, 0.24);
  border: 1px solid #7d96ff;
  color: #cdd8ff;
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-main);
  background: var(--bg-card);
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--border-bright);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-xs {
  padding: 2px 7px;
  font-size: 10px;
}

.btn-toggle {
  background: #232a3b;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn-toggle.active {
  background: rgba(66, 201, 122, 0.2);
  border-color: var(--accent-green);
  color: #9ff7c4;
}

.btn-danger {
  background: rgba(224, 79, 95, 0.16);
  border-color: rgba(224, 79, 95, 0.6);
  color: #ff9ca7;
}

.audio-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  width: 66px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.slot-hint-line {
  margin-bottom: 6px;
}

.diff-pos {
  color: #5ee694;
  font-weight: 700;
}

.diff-neg {
  color: #ff7a88;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, #d89b2b, #b67617);
  color: #0e1015;
}

.btn-secondary {
  background: #252c3f;
  border-color: var(--border-subtle);
}

.btn-accent {
  background: linear-gradient(135deg, #2d87d8, #1c5fb8);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-shell {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-brand {
  text-align: center;
}

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

.auth-card-title {
  margin: 0;
  font-size: 17px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-slot);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--accent-gold);
  box-shadow: inset 0 0 0 1px var(--border-bright);
}

.auth-error {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(224, 79, 95, 0.16);
  border: 1px solid var(--accent-red);
  color: #ffb3bc;
  font-size: 12px;
}

.auth-note {
  margin: 0;
  line-height: 1.4;
}

.auth-extra {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #5865f2;
  border-color: #6d78ff;
  color: #ffffff;
}

.btn-discord:hover:not(:disabled) {
  background: #4752c4;
}

.dev-login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Lobby Layout */
.lobby-screen {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.lobby-account-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lobby-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.12em;
  color: var(--accent-gold);
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.account-pill {
  padding: 7px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 12px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.character-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
}

.char-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
}

.char-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.char-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.char-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.char-card-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

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

.field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.text-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-slot);
  color: var(--text-main);
  font-size: 13px;
}

.class-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.class-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-main);
  text-align: center;
}

.class-option.selected {
  border-color: var(--accent-gold);
  background: rgba(240, 185, 73, 0.1);
}

.class-option-role {
  font-size: 10px;
  color: var(--text-muted);
}

/* Game Screen */
.game-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.top-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.hud-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hud-char-name {
  font-weight: 700;
  font-size: 14px;
}

.hud-char-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.hud-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-hint {
  color: var(--text-muted);
  font-size: 11px;
}

.game-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 330px;
}

.canvas-stage {
  position: relative;
  background: #090b10;
  overflow: hidden;
}

.canvas-stage.canvas-drop-active {
  box-shadow: inset 0 0 0 2px var(--accent-gold), inset 0 0 24px rgba(240, 185, 73, 0.25);
}

.canvas-drop-banner {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(11, 13, 19, 0.92);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  z-index: 15;
}

.controls-drawer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 7px 14px;
  background: rgba(15, 19, 29, 0.96);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.controls-drawer b {
  color: var(--accent-cyan);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

.ws-status-pill {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(11, 13, 19, 0.8);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

/* Sidebar */
.rpg-sidebar {
  background: var(--bg-panel);
  border-left: 1px solid var(--border-subtle);
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 9px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 7px;
}

.card-title-row h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.muted-note {
  color: var(--text-muted);
  font-size: 10px;
}

/* Progress Bars */
.bar-row {
  margin-bottom: 6px;
}

.bar-row:last-child {
  margin-bottom: 0;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 2px;
}

.bar-track {
  height: 10px;
  background: var(--bg-slot);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.08s linear;
}

.bar-hp {
  background: linear-gradient(90deg, #b8293b, #e84b5f);
}

.bar-mp {
  background: linear-gradient(90deg, #2157b8, #4d8eff);
}

.bar-xp {
  background: linear-gradient(90deg, #b8841e, #f2c249);
}

.bar-cd {
  background: linear-gradient(90deg, #1b88a8, #4ce0ff);
}

/* 8-Stat Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 8px;
}

.stat-cell {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  background: var(--bg-slot);
  border-radius: 4px;
  font-size: 11px;
}

.stat-key {
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-val-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

.stat-hard-max {
  font-size: 9px;
  color: #6b7896;
}

.stat-val.maxed {
  color: var(--accent-gold);
  font-weight: 700;
}

/* Inventory / Equipment / Loot / Vault Grids */
.slot-grid {
  display: grid;
  gap: 6px;
}

.slot-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

#equip-grid {
  margin-bottom: 6px;
}

.item-slot {
  position: relative;
  height: 54px;
  background: var(--bg-slot);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.1s ease, background-color 0.1s ease, box-shadow 0.1s ease;
}

.item-slot:hover {
  border-color: var(--border-bright);
}

.item-slot.selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px var(--accent-gold);
}

.item-slot.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.item-slot.dragging {
  opacity: 0.42;
}

.item-slot.drop-valid {
  border-color: var(--accent-green);
  background: rgba(66, 201, 122, 0.1);
  box-shadow: inset 0 0 0 1px var(--accent-green), 0 0 8px rgba(66, 201, 122, 0.25);
}

.item-slot.drop-invalid {
  border-color: var(--accent-red);
  background: rgba(224, 79, 95, 0.12);
  box-shadow: inset 0 0 0 1px var(--accent-red);
}

.item-slot.item-incompatible {
  background: rgba(224, 79, 95, 0.08);
  border-color: rgba(224, 79, 95, 0.45);
}

.item-slot.loot-empty {
  opacity: 0.45;
  cursor: default;
}

.slot-tag,
.hotkey-badge {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: #667391;
  pointer-events: none;
}

.hotkey-badge {
  color: #8c9bb8;
  font-size: 9px;
}

.empty-role-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #4f5d7a;
  text-transform: uppercase;
  pointer-events: none;
}

.incompat-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-red);
  pointer-events: none;
}

.loot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loot-ttl-track {
  height: 4px;
  background: var(--bg-slot);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 7px;
}

.loot-ttl-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-green));
  transition: width 0.1s linear;
}

#loot-card.loot-tier-brown {
  border-color: #8a572c;
}

#loot-card.loot-tier-purple {
  border-color: #9b51e0;
}

#loot-card.loot-tier-blue {
  border-color: #3d8bff;
}

#loot-card.loot-tier-white {
  border-color: #3dd9c9;
}

.drink-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  padding: 1px 4px;
  font-size: 9px;
  border-radius: 3px;
  border: 1px solid var(--accent-cyan);
  background: rgba(72, 213, 247, 0.2);
  color: #bff4ff;
  cursor: pointer;
}

.bag-brown {
  border-color: #8a572c;
}

.bag-purple {
  border-color: #9b51e0;
}

.bag-blue {
  border-color: #3d8bff;
}

.bag-white {
  border-color: #e6f7ff;
  box-shadow: inset 0 0 8px rgba(61, 217, 201, 0.35);
}

/* Phase 5: 5-Tier Rarity Borders, Badges, Tooltips & Combat Log Colors */
.rarity-text-normal {
  color: #f0f4f8;
}

.rarity-text-uncommon {
  color: #3de374;
}

.rarity-text-rare {
  color: #4ea8ff;
}

.rarity-text-epic {
  color: #c06cff;
}

.rarity-text-legendary {
  color: #ff9b26;
}

.item-slot.rarity-normal {
  border-color: rgba(240, 244, 248, 0.35);
}

.item-slot.rarity-uncommon {
  border-color: #3de374;
  box-shadow: inset 0 0 6px rgba(61, 227, 116, 0.22);
}

.item-slot.rarity-rare {
  border-color: #4ea8ff;
  box-shadow: inset 0 0 8px rgba(78, 168, 255, 0.32);
}

.item-slot.rarity-epic {
  border-color: #c06cff;
  box-shadow: inset 0 0 10px rgba(192, 108, 255, 0.38);
}

.item-slot.rarity-legendary {
  border-color: #ff9b26;
  box-shadow: inset 0 0 12px rgba(255, 155, 38, 0.48), 0 0 8px rgba(255, 155, 38, 0.32);
}

.rarity-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(10, 14, 22, 0.86);
  pointer-events: none;
}

.rarity-badge-uncommon {
  color: #3de374;
  border: 1px solid rgba(61, 227, 116, 0.55);
}

.rarity-badge-rare {
  color: #4ea8ff;
  border: 1px solid rgba(78, 168, 255, 0.65);
}

.rarity-badge-epic {
  color: #c06cff;
  border: 1px solid rgba(192, 108, 255, 0.7);
}

.rarity-badge-legendary {
  color: #ff9b26;
  border: 1px solid rgba(255, 155, 38, 0.8);
}

.item-tooltip.rarity-normal {
  border-color: rgba(240, 244, 248, 0.45);
}

.item-tooltip.rarity-uncommon {
  border-color: #3de374;
}

.item-tooltip.rarity-rare {
  border-color: #4ea8ff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 10px rgba(78, 168, 255, 0.25);
}

.item-tooltip.rarity-epic {
  border-color: #c06cff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 12px rgba(192, 108, 255, 0.32);
}

.item-tooltip.rarity-legendary {
  border-color: #ff9b26;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.72), 0 0 16px rgba(255, 155, 38, 0.4);
}

.tooltip-affix-line {
  color: #5ff28f;
  font-weight: 600;
}

.tooltip-lore {
  margin-top: 6px;
  font-size: 10.5px;
  font-style: italic;
  color: #d6c598;
  line-height: 1.35;
}

.tooltip-sell-value {
  margin-top: 4px;
  font-size: 10px;
  color: var(--accent-gold);
}

.combat-loot_drop {
  font-weight: 600;
}

.combat-legendary-announce {
  background: rgba(255, 155, 38, 0.12);
  border-left: 2px solid #ff9b26;
  padding-left: 4px;
}

/* Tooltip & Toasts */
.item-tooltip {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  max-width: 240px;
  background: rgba(12, 15, 23, 0.96);
  border: 1px solid var(--border-bright);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  font-size: 11px;
}

.tooltip-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 2px;
}

.tooltip-meta {
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tooltip-line {
  color: #a9d6ff;
}

.diff-pos {
  color: var(--accent-green);
  font-weight: 700;
}

.diff-neg {
  color: var(--accent-red);
  font-weight: 700;
}

.tooltip-warn {
  margin-top: 4px;
  color: #ff808e;
  font-size: 10px;
  font-weight: 600;
}

.tooltip-hint {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--border-subtle);
  color: var(--accent-gold);
  font-size: 10px;
}

.toast-container {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(21, 25, 36, 0.95);
  border: 1px solid var(--border-bright);
  font-size: 12px;
}

.toast-error {
  border-color: var(--accent-red);
  color: #ffb3bc;
}

.toast-ok {
  border-color: var(--accent-green);
  color: #b4f5cc;
}

/* Hardcore Death Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 7, 11, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  max-width: 440px;
  background: var(--bg-panel);
  border: 1px solid var(--accent-red);
  border-radius: 10px;
  padding: 22px;
  text-align: center;
}

.modal-card.modal-card-normal {
  border-color: var(--accent-blue);
}

.modal-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(224, 79, 95, 0.18);
  color: #ff8b97;
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 10px;
}

.modal-badge.modal-badge-normal {
  background: rgba(74, 142, 245, 0.18);
  color: #84b6ff;
}

.modal-summary {
  margin: 12px 0 18px;
  padding: 10px;
  background: var(--bg-slot);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.modal-input {
  margin: 10px 0 16px;
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.vault-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vault-card-hc {
  border-color: rgba(240, 185, 73, 0.45);
}

.vault-card-normal {
  border-color: rgba(74, 142, 245, 0.45);
}

/* Phase 6: Party HUD & Tabbed Chat / Combat Log */
.btn-xxs {
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
}

.party-hud {
  position: absolute;
  top: 40px;
  left: 10px;
  width: 248px;
  z-index: 12;
  background: rgba(11, 14, 22, 0.84);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(4px);
}

.party-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.party-hud-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-main);
}

.party-hud-header-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.party-invite-banner {
  background: rgba(240, 185, 73, 0.14);
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  padding: 6px 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.party-invite-text {
  font-size: 11px;
  color: #ffe29a;
  line-height: 1.25;
}

.party-invite-actions {
  display: flex;
  gap: 6px;
}

.party-members-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.party-empty-note {
  font-size: 10px;
  color: var(--text-muted);
}

.party-member-row {
  background: rgba(18, 23, 35, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.party-member-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.party-member-identity {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.party-leader-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(240, 185, 73, 0.22);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  flex-shrink: 0;
}

.party-member-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.party-member-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.party-member-level {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.party-zone-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}

.party-zone-badge.zone-nexus {
  background: rgba(66, 201, 122, 0.16);
  color: #7ee8ab;
}

.party-zone-badge.zone-combat {
  background: rgba(224, 79, 95, 0.18);
  color: #ff98a4;
}

.party-member-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.party-bar-track {
  height: 5px;
  background: var(--bg-slot);
  border-radius: 3px;
  overflow: hidden;
}

.party-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.1s linear;
}

.party-bar-hp {
  background: #e04f5f;
}

.party-bar-mp {
  background: #4a8ef5;
}

.party-member-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.party-invite-form {
  display: flex;
  gap: 4px;
}

.social-input,
.social-select {
  background: rgba(12, 15, 24, 0.92);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  color: var(--text-main);
  font-size: 11px;
  padding: 4px 6px;
}

.social-input:focus,
.social-select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.party-invite-form .social-input {
  flex: 1;
  min-width: 0;
}

.social-chat-panel {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 390px;
  max-width: calc(100% - 20px);
  z-index: 12;
  background: rgba(11, 14, 22, 0.86);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  backdrop-filter: blur(4px);
}

.social-tabs {
  display: flex;
  gap: 4px;
}

.social-tab {
  border: 1px solid var(--border-subtle);
  background: rgba(20, 25, 38, 0.8);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.social-tab.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(72, 213, 247, 0.12);
}

.social-log-feed {
  height: 128px;
  overflow-y: auto;
  padding: 4px 6px;
  background: rgba(8, 10, 16, 0.72);
  border: 1px solid rgba(42, 49, 69, 0.7);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  line-height: 1.35;
}

.social-line {
  word-break: break-word;
}

.social-time {
  color: #6b7896;
  font-size: 10px;
}

.social-tag {
  font-weight: 700;
}

.tag-global {
  color: #9bb8ff;
}

.tag-party {
  color: #5ee694;
}

.tag-whisper {
  color: #e28aff;
}

.tag-system {
  color: var(--accent-gold);
}

.tag-combat {
  color: #ff9f66;
}

.chat-sender {
  font-weight: 600;
  color: #dfe8ff;
}

.chat-party {
  color: #c9f7dc;
}

.chat-whisper {
  color: #f3c8ff;
}

.chat-system {
  color: #ffe29a;
}

.combat-damage_dealt {
  color: #ffd3a8;
}

.combat-damage_taken {
  color: #ff98a4;
}

.combat-ability {
  color: #9be8ff;
}

.combat-enemy_slain {
  color: #9ff7c4;
}

.combat-loot {
  color: #ffe066;
}

.combat-boss_bark {
  color: #ffd97d;
  font-style: italic;
}

.social-chat-form {
  display: flex;
  align-items: center;
  gap: 4px;
}

.social-select {
  width: 72px;
  flex-shrink: 0;
}

.social-whisper-input {
  width: 82px;
  flex-shrink: 0;
}

.social-chat-input {
  flex: 1;
  min-width: 0;
}

/* Gold Balance & Nexus Vendor Shop Modal */
.gold-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(240, 185, 73, 0.14);
  border: 1px solid rgba(240, 185, 73, 0.55);
  color: #ffe28a;
  font-weight: 700;
  font-size: 11px;
}

.gold-coin-mini {
  width: 16px;
  height: 16px;
  background-image: url("/assets/sprites/world_16x16.png");
  background-size: 128px 224px;
  background-position: -80px -112px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.vendor-modal-card {
  width: 100%;
  max-width: 780px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vendor-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vendor-header-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vendor-header-identity h2 {
  margin: 0;
  font-size: 17px;
}

.vendor-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vendor-columns {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 12px;
  min-height: 0;
}

.vendor-pane {
  background: var(--bg-slot);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.vendor-pane h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.vendor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 2px;
}

.vendor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.vendor-row:hover {
  border-color: var(--border-bright);
}

.vendor-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.vendor-item-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.vendor-item-name {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vendor-item-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.vendor-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vendor-price {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 11px;
}

.vendor-price-unaffordable {
  color: var(--accent-red);
}

.vault-highlight-pulse {
  box-shadow: 0 0 0 2px var(--accent-gold), 0 0 18px rgba(240, 185, 73, 0.45);
}

/* 7-Type Affinity Badges & Tooltip Details */
.tooltip-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.affinity-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.affinity-physical {
  color: #d0d8e8;
  background: rgba(120, 130, 150, 0.22);
}

.affinity-beast {
  color: #f5b062;
  background: rgba(180, 104, 36, 0.22);
}

.affinity-nature {
  color: #72eb7a;
  background: rgba(42, 140, 64, 0.22);
}

.affinity-undead {
  color: #c494ff;
  background: rgba(116, 64, 176, 0.24);
}

.affinity-frost {
  color: #7ce8ff;
  background: rgba(38, 142, 188, 0.24);
}

.affinity-infernal {
  color: #ff7e47;
  background: rgba(196, 64, 28, 0.24);
}

.affinity-holy {
  color: #ffe87a;
  background: rgba(190, 154, 32, 0.24);
}

.tooltip-desc {
  margin-top: 5px;
  font-size: 11px;
  color: #aebad0;
  line-height: 1.35;
}

.sprite-icon-patu {
  width: 48px;
  height: 48px;
  background-image: url("/assets/sprites/patu_48x48.png");
  background-size: 192px 96px;
}

.vendor-greeting {
  padding: 8px 11px;
  background: rgba(240, 185, 73, 0.08);
  border-left: 3px solid var(--accent-gold);
  border-radius: 4px;
  color: #e6dcc8;
  font-size: 12px;
  font-style: italic;
  line-height: 1.4;
}

.dialogue-modal-card {
  width: 100%;
  max-width: 560px;
  border-color: rgba(240, 185, 73, 0.55);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialogue-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialogue-stage-badge {
  background: rgba(92, 225, 255, 0.14);
  border: 1px solid rgba(92, 225, 255, 0.45);
  color: #9fe8ff;
}

.dialogue-lines {
  background: var(--bg-slot);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-line {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #eef3fb;
}

.dialogue-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dialogue-topic-active {
  box-shadow: 0 0 0 1px rgba(240, 185, 73, 0.7);
}

.dialogue-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.escalation-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(24, 34, 52, 0.85);
  border: 1px solid rgba(118, 178, 224, 0.45);
  color: #a8dcff;
  white-space: nowrap;
}

.escalation-pill.stage-1 {
  border-color: rgba(240, 185, 73, 0.55);
  color: #ffd98a;
}

.escalation-pill.stage-2 {
  border-color: rgba(94, 230, 117, 0.55);
  color: #9df7ab;
}

.escalation-pill.stage-3 {
  border-color: rgba(184, 124, 255, 0.6);
  color: #d6b3ff;
}

.escalation-pill.stage-4 {
  border-color: rgba(124, 232, 255, 0.65);
  color: #aaf2ff;
}

.escalation-pill.stage-5 {
  border-color: rgba(255, 110, 58, 0.72);
  background: rgba(68, 22, 16, 0.85);
  color: #ffb296;
}

.escalation-pill.stage-6 {
  border-color: rgba(255, 170, 68, 0.85);
  background: rgba(78, 28, 18, 0.9);
  color: #ffe08a;
}

.escalation-pill.stage-7 {
  border-color: rgba(255, 232, 122, 0.9);
  background: rgba(84, 64, 16, 0.9);
  color: #fff3b0;
  box-shadow: 0 0 8px rgba(255, 232, 122, 0.35);
}

.shard-pips {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.shard-pip {
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border-radius: 1px;
  background: rgba(140, 152, 175, 0.25);
  border: 1px solid rgba(140, 152, 175, 0.45);
  transition: transform 0.2s ease, background 0.2s ease;
}

.shard-pip.reclaimed {
  transform: rotate(45deg) scale(1.1);
}

.shard-pip.reclaimed.shard-physical { background: #d0d8e8; border-color: #ffffff; }
.shard-pip.reclaimed.shard-nature { background: #5ee675; border-color: #b8ffc2; }
.shard-pip.reclaimed.shard-undead { background: #b87cff; border-color: #e6ccff; }
.shard-pip.reclaimed.shard-frost { background: #7ce8ff; border-color: #d6f8ff; }
.shard-pip.reclaimed.shard-infernal { background: #ff6e3a; border-color: #ffc2a8; }
.shard-pip.reclaimed.shard-beast { background: #ffaa44; border-color: #ffe0a8; }
.shard-pip.reclaimed.shard-holy { background: #ffe87a; border-color: #ffffff; }

.sanctum-timer {
  padding-left: 4px;
  border-left: 1px solid rgba(255, 232, 122, 0.4);
  color: #ffe87a;
}

@media (max-width: 960px) {
  .vendor-columns {
    grid-template-columns: 1fr;
  }
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .game-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 300px;
  }

  .control-hint {
    display: none;
  }
}
