.status-bar {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, 94vw);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--panel-gap);
  padding: 8px 12px;
  border-radius: var(--card-radius);
  background: linear-gradient(180deg, rgba(38, 27, 16, 0.95), rgba(21, 14, 8, 0.95));
  border: 1px solid var(--color-border-panel-strong);
  box-shadow: var(--shadow-card);
  z-index: 8;
}

.status-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #f5e3c4;
}

.status-name {
  font-weight: 700;
  color: var(--color-gold-strong);
}

.status-text {
  color: var(--color-muted-strong);
  font-size: 12px;
}

.status-ping {
  color: var(--color-muted-strong);
  font-size: 12px;
}

.status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--color-blue-soft);
  border: 1px solid var(--color-blue);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 600;
}

.badge-warn {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecdd3;
}

.status-bars {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
}

.bar-label {
  color: #f8fafc;
  font-size: 12px;
}

.bar-track {
  height: 8px;
  border-radius: 8px;
  background: rgba(248, 180, 76, 0.18);
  overflow: hidden;
  width: 150px;
  border: 1px solid rgba(248, 180, 76, 0.3);
}

.bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.2s ease;
}

.bar-fill.hp {
  background: linear-gradient(90deg, #f87171, #facc15);
}

.bar-fill.cap {
  background: linear-gradient(90deg, #22c55e, #15803d);
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-actions button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(248, 180, 76, 0.35);
  background: rgba(31, 25, 18, 0.9);
  color: var(--color-text);
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-quick {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-border-highlight);
  background: rgba(31, 25, 18, 0.9);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  padding: 0;
}

.quick-btn {
  position: relative;
}

.quick-icon {
  width: 28px;
  height: 28px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.quick-btn--chat .quick-icon {
  background-image: url("../assets/chat.png");
}

.quick-btn--inventory .quick-icon {
  background-image: url("../assets/inventory.png");
}

.quick-btn--equip .quick-icon {
  background-image: url("../assets/equip.png");
}

.quick-btn--sound .sound-icon {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.quick-btn--sound.is-muted {
  border-color: rgba(244, 63, 94, 0.9);
  background: rgba(244, 63, 94, 0.14);
}

.quick-btn--sound .sound-icon {
  transition: color 150ms;
}

.quick-btn--sound.is-muted .sound-icon {
  color: rgba(244, 63, 94, 0.8);
}

.quick-unread {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

.quick-unread.active {
  display: flex;
}

.sawmill-panel {
  top: calc(140px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: rgba(245, 158, 11, 0.28);
  box-shadow: var(--shadow-panel);
  background: linear-gradient(180deg, rgba(20, 13, 8, 0.96), rgba(12, 10, 8, 0.94));
  z-index: 7;
}

.sawmill-panel.busy {
  border-color: rgba(248, 113, 113, 0.35);
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.25);
}

.sawmill-panel.near {
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
}

.sawmill-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sawmill-title {
  font-weight: 700;
  color: var(--color-gold);
}

.sawmill-sub {
  color: var(--color-muted-strong);
  font-size: 12px;
}

.sawmill-chip {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(248, 180, 76, 0.4);
  color: #fde68a;
  font-weight: 700;
  min-width: 64px;
  text-align: center;
}

.sawmill-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sawmill-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sawmill-controls button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: linear-gradient(180deg, #0f172a, #0b1120);
  color: var(--color-text);
  cursor: pointer;
  font-weight: 700;
}

.sawmill-controls .sawmill-bulk-btn.active {
  border-color: rgba(250, 204, 21, 0.6);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

.sawmill-controls button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.sawmill-progress {
  flex: 1;
  height: 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.7);
  overflow: hidden;
}

.sawmill-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #facc15, #f97316);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
  transition: width 0.15s ease;
}

.sawmill-hint {
  font-size: 12px;
  color: var(--color-muted-subtle);
}

.trader-panel {
  top: calc(180px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  width: min(420px, 94vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, rgba(9, 16, 35, 0.96), rgba(9, 12, 24, 0.94));
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.18);
  overflow: hidden;
}

.trader-panel.near {
  box-shadow: 0 10px 26px rgba(59, 130, 246, 0.24);
}

.trader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.trader-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.trader-sub {
  color: var(--color-muted-strong);
  font-size: 12px;
}

.trader-chip {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(14, 116, 144, 0.35);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
  font-weight: 700;
  min-width: 64px;
  text-align: center;
}

.trader-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(8, 47, 73, 0.6);
  color: #e0f2fe;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.trader-close:hover {
  border-color: rgba(125, 211, 252, 0.6);
  background: rgba(8, 47, 73, 0.9);
}

.trader-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.trader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.trader-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trader-col-title {
  font-weight: 700;
  color: #e0f2fe;
}

.trader-bag,
.trader-cart {
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.65);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-height: 100px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.trader-cart {
  text-align: center;
  align-content: start;
}

.trader-cart.active {
  border-color: rgba(250, 204, 21, 0.7);
  background: rgba(250, 204, 21, 0.1);
}

.trader-slot {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 8px;
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 58px;
}

.trader-slot .slot-icon-img {
  position: static;
  width: 42px;
  height: 42px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  margin: 0 auto;
}

.trader-slot.empty {
  opacity: 0.6;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.6);
}

.trader-slot .slot-title {
  font-weight: 700;
}

.trader-slot .slot-count {
  font-size: 12px;
  color: var(--color-muted-subtle);
}

.trader-slot .slot-price {
  font-size: 12px;
  color: #bae6fd;
}

.trader-slot button {
  justify-self: end;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(8, 47, 73, 0.8);
  color: #e0f2fe;
  cursor: pointer;
}

.trader-slot button:hover {
  border-color: rgba(125, 211, 252, 0.7);
}

.trader-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.trader-actions button {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(180deg, #0ea5e9, #0284c7);
  color: #e0f2fe;
  font-weight: 700;
  cursor: pointer;
}

.trader-actions button.secondary {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.35);
}

.trader-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.trader-hint {
  font-size: 12px;
  color: var(--color-muted-subtle);
}

.trader-empty {
  color: var(--color-muted-subtle);
  font-size: 12px;
}

.inventory-panel,
.bag-panel {
  position: fixed;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  min-width: 260px;
  width: 320px;
  background: linear-gradient(180deg, var(--color-bg-panel), var(--color-bg-panel-alt));
  border: 1px solid rgba(202, 138, 4, 0.28);
  box-shadow: var(--shadow-panel);
  max-width: 94vw;
  max-height: 76vh;
  overflow: hidden;
}

.inventory-panel.quick-hidden,
.bag-panel.quick-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .inventory-panel,
  .bag-panel {
    width: min(92vw, 320px);
    max-height: 55vh;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  }
  .inventory-panel {
    top: calc(60px + var(--safe-top));
    right: calc(8px + var(--safe-right));
  }
  .bag-panel {
    left: auto;
    right: calc(8px + var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
  }
  .sawmill-panel {
    width: min(92vw, 340px);
    left: 50%;
    transform: translateX(-50%);
    top: calc(140px + var(--safe-top));
  }
  .trader-panel {
    width: min(94vw, 360px);
    max-height: 76vh;
    left: 50%;
    transform: translateX(-50%);
    top: calc(160px + var(--safe-top));
  }
  .inventory-body,
  .bag-body {
    max-height: calc(55vh - 120px);
  }
  .inventory-top {
    gap: 6px;
    grid-template-columns: 64px 1fr;
    padding: 10px;
  }
  .bag-slot {
    min-height: 40px;
  }
}

.inventory-panel {
  top: calc(70px + var(--safe-top));
  right: calc(14px + var(--safe-right));
  width: 360px;
  padding: 16px;
  gap: 12px;
  border-radius: 24px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: linear-gradient(180deg, rgba(32, 18, 8, 0.96), rgba(11, 6, 3, 0.95));
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.65), 0 0 28px rgba(245, 158, 11, 0.3);
  backdrop-filter: blur(12px);
  overflow: hidden;
  isolation: isolate;
}

.inventory-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.7), rgba(248, 196, 113, 0)) border-box;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

.inventory-panel::after {
  content: "";
  position: absolute;
  inset: 12% 10% 12% 10%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 229, 157, 0.35), transparent 58%),
    radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.08), transparent 60%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}

.inventory-panel > * {
  position: relative;
  z-index: 1;
}

.bag-panel {
  bottom: calc(10px + var(--safe-bottom));
  left: calc(14px + var(--safe-left));
  width: 320px;
}

.inventory-title {
  font-weight: 700;
  color: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 2px 4px;
  cursor: default;
  user-select: none;
}

.gear-title {
  padding: 0;
  gap: 10px;
}

.gear-title .panel-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.1;
}

.gear-title .panel-title {
  font-size: 22px;
  letter-spacing: 0.05em;
}

.panel-subtitle {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: rgba(255, 255, 255, 0.65);
}

.inventory-body,
.bag-body {
  min-height: 0;
}

.inventory-body {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, rgba(17, 11, 6, 0.85), rgba(8, 5, 3, 0.95));
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 18px rgba(255, 255, 255, 0.05), inset 0 -10px 30px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}

.inventory-top {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(248, 180, 76, 0.35);
  background: linear-gradient(180deg, rgba(39, 29, 17, 0.9), rgba(14, 7, 3, 0.95));
  box-shadow: inset 0 1px 10px rgba(255, 255, 255, 0.05), 0 10px 24px rgba(0, 0, 0, 0.55);
  position: relative;
  backdrop-filter: blur(4px);
}

.portrait {
  width: 82px;
  height: 82px;
  border-radius: 16px;
  background-image: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15), rgba(28, 39, 64, 0.85)),
    linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(3, 6, 11, 0.95));
  border: 1px solid rgba(248, 180, 76, 0.35);
  box-shadow: inset 0 0 18px rgba(250, 204, 21, 0.4), 0 10px 25px rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  color: #fef3c7;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
}

.equip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 92px));
  gap: 10px;
  justify-content: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 213, 94, 0.15), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.07), transparent 45%),
    linear-gradient(180deg, rgba(15, 12, 8, 0.95), rgba(7, 5, 4, 0.95));
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.04), 0 12px 30px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.equip-slot {
  aspect-ratio: 1/1;
  border-radius: 14px;
  background: radial-gradient(
      circle at 30% 20%,
      rgba(255, 255, 255, 0.15),
      rgba(26, 20, 12, 0.8)
    ),
    linear-gradient(180deg, rgba(23, 15, 9, 0.95), rgba(5, 4, 7, 0.95));
  border: 1px solid rgba(255, 203, 107, 0.45);
  position: relative;
  overflow: hidden;
  cursor: grab;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
  box-shadow: inset 0 0 18px rgba(250, 204, 21, 0.32), 0 10px 25px rgba(0, 0, 0, 0.65);
}

.equip-slot:hover {
  transform: translateY(-2px);
  border-color: rgba(249, 168, 37, 0.85);
  box-shadow: inset 0 0 24px rgba(255, 215, 102, 0.4), 0 14px 30px rgba(0, 0, 0, 0.55);
}

.bag-slot {
  aspect-ratio: 1/1;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f2937, #0f172a);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  overflow: hidden;
  cursor: grab;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.equip-slot.empty {
  background: linear-gradient(135deg, rgba(7, 9, 15, 0.92), rgba(3, 4, 8, 0.95));
  opacity: 0.78;
}

.bag-slot.empty {
  background: linear-gradient(135deg, #0f172a, #0b1221);
  opacity: 0.65;
}

.slot-icon-img {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--color-text);
}

.slot-count-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 700;
}

.equip-slot.drop-ready {
  border-color: rgba(255, 220, 120, 0.95);
  box-shadow: inset 0 0 0 3px rgba(255, 220, 120, 0.45), 0 0 18px rgba(255, 220, 120, 0.65);
}

.equip-slot.slot-flash {
  animation: slotFlash 0.6s ease;
}

@keyframes slotFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.6);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.8);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
  }
}

.inventory-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.inventory-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #fef3c7;
  font-size: 13px;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.45);
  line-height: 1.35;
}

.inventory-meta__status {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inventory-meta__title {
  font-size: 16px;
  color: #ffe28c;
  letter-spacing: 0.05em;
}

.inventory-meta__stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#cap-meta {
  font-weight: 600;
  color: #fcd34d;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  flex: 1;
  display: inline-block;
}

.coins-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #fedc8b;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(245, 158, 11, 0.1);
  box-shadow: inset 0 -1px 6px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.coin-icon {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #facc15, #f97316);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.65);
  display: inline-block;
  border: 1px solid rgba(248, 180, 76, 0.7);
}

.inventory-bag {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 58px));
  gap: 4px;
  justify-content: center;
}

.inventory-row,
.drop-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drop-actions button,
.inventory-panel button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: var(--color-text);
  cursor: pointer;
}

.drop-input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.8);
  color: var(--color-text);
}

.mobile-chop {
  display: none;
  font-weight: 700;
}

.chat-panel {
  bottom: calc(8px + var(--safe-bottom));
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: min(880px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 40vh;
  background: linear-gradient(180deg, rgba(41, 29, 17, 0.95), var(--color-bg-panel-deep));
  border: 1px solid var(--color-border-panel);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(202, 138, 4, 0.2);
  padding-bottom: 4px;
}

.chat-tabs {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

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

.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border-panel);
  background: var(--color-bg-glass);
  color: var(--color-text);
  cursor: pointer;
  font-size: 12px;
}

.tab.active {
  border-color: var(--color-gold-strong);
  color: var(--color-gold);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2) inset;
}

.chat-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.inventory-panel .panel-close,
.bag-panel .panel-close,
.chat-panel .panel-close,
.inventory-panel .panel-drag,
.bag-panel .panel-drag,
.chat-panel .panel-drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  width: auto;
  min-width: 42px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--color-border-panel);
  background: var(--color-bg-glass);
  color: var(--color-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15) inset;
  cursor: pointer;
}

.inventory-panel .panel-close:hover,
.bag-panel .panel-close:hover,
.chat-panel .panel-close:hover,
.inventory-panel .panel-drag:hover,
.bag-panel .panel-drag:hover,
.chat-panel .panel-drag:hover {
  border-color: var(--color-gold-strong);
  color: var(--color-gold);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25) inset;
}

.panel-drag {
  cursor: move;
}

.chat-logs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-log {
  height: 140px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  background: rgba(24, 17, 11, 0.8);
  border: 1px solid rgba(202, 138, 4, 0.25);
  font-size: 13px;
}

.chat-line {
  margin-bottom: 4px;
}

.chat-name {
  color: var(--color-gold);
  font-weight: 600;
}

.chat-form input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border-panel-strong);
  background: rgba(24, 17, 11, 0.9);
  color: var(--color-text);
  outline: none;
}

.chat-form input::placeholder {
  color: #e2c48d;
}

.chat-form input:focus {
  border-color: var(--color-gold-strong);
}

.players-list {
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.4;
}

.typing {
  font-size: 12px;
  color: #e2c48d;
  margin-top: 6px;
  padding: 4px 6px;
  background: rgba(24, 17, 11, 0.8);
  border-radius: 8px;
}

.chat-unread {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  background: #ef4444;
  border-radius: 50%;
  display: none;
}

.chat-unread.active {
  display: block;
}

.drop-zone {
  position: fixed;
  top: calc(12px + var(--safe-top));
  right: calc(12px + var(--safe-right));
  bottom: calc(12px + var(--safe-bottom));
  left: calc(12px + var(--safe-left));
  border-radius: 14px;
  border: 2px dashed rgba(248, 180, 76, 0.45);
  background: var(--color-drop-zone);
  color: #fde68a;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: grid;
  place-items: center;
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  z-index: 4;
}

.drop-zone.active {
  opacity: 0.95;
  border-color: rgba(34, 197, 94, 0.75);
  background: rgba(2, 6, 23, 0.18);
}

.inventory-panel.collapsed .inventory-body,
.bag-panel.collapsed .bag-body {
  display: none;
}

.panel-mobile-actions {
  position: fixed;
  right: calc(12px + var(--safe-right));
  bottom: calc(96px + var(--safe-bottom));
  display: none;
  gap: 8px;
  z-index: 9;
}

.panel-mobile-actions button {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--color-border-panel-strong);
  background: rgba(31, 25, 18, 0.95);
  color: var(--color-text);
  font-weight: 700;
  box-shadow: var(--shadow-card);
}

.chat-panel.collapsed .chat-logs,
.chat-panel.collapsed .chat-form,
.chat-panel.collapsed #players-list,
.chat-panel.collapsed .chat-tabs,
.chat-panel.collapsed .typing {
  display: none;
}

.guide-focus {
  box-shadow: var(--border-focus);
  border-radius: var(--card-radius);
}

@media (max-width: 1024px) {
  .card {
    padding: 8px;
    font-size: 12px;
  }

  .status-bar {
    left: calc(10px + var(--safe-left));
    right: calc(10px + var(--safe-right));
    width: auto;
    transform: none;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .status-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .status-line {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
  }

  .status-bars {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .bar {
    width: 100%;
  }

  .bar-track {
    width: 100%;
  }

  .status-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .inventory-panel {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    max-height: 56vh;
  }

  .inventory-body {
    padding-bottom: 6px;
  }

  .inventory-top {
    grid-template-columns: 64px 1fr;
    gap: 6px;
  }

  .portrait {
    width: 64px;
    height: 64px;
  }

  .equip-grid {
    gap: 4px;
  }

  .inventory-bag {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 4px;
  }

  .bag-panel {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
  }

  .chat-panel {
    left: 10px;
    right: 10px;
    width: auto;
    transform: none;
    max-height: 36vh;
  }

  .chat-panel.collapsed {
    width: auto;
  }

  .guide {
    left: 10px;
    right: 10px;
    transform: none;
    bottom: calc(130px + var(--safe-bottom));
  }

  .drop-zone {
    top: calc(8px + var(--safe-top));
    right: calc(8px + var(--safe-right));
    bottom: calc(8px + var(--safe-bottom));
    left: calc(8px + var(--safe-left));
  }
}

@media (max-width: 640px) {
  .status-line {
    font-size: 12px;
  }

  .status-name {
    font-size: 14px;
  }

  .status-actions button {
    padding: 5px 8px;
  }

  .bag-panel {
    bottom: calc(12px + var(--safe-bottom));
  }

  .chat-panel {
    bottom: calc(12px + var(--safe-bottom));
  }

  .panel-mobile-actions {
    display: flex;
  }

  .mobile-chop {
    display: block;
  }
}

.center-status {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.85);
  color: #f8fafc;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid rgba(248, 250, 252, 0.2);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.6);
  z-index: 20;
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.25s ease;
  pointer-events: none;
}

.center-status.hidden {
  opacity: 0;
}

.respawn-overlay {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 240px;
  max-width: 90vw;
  padding: 18px 26px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(248, 250, 252, 0.24);
  color: #e2e8f0;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
  z-index: 24;
  opacity: 1;
  transition: opacity 0.25s ease, transform 0.3s ease;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.respawn-overlay.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
}

.connection-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.75);
  z-index: 32;
  padding: 24px;
  pointer-events: all;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.connection-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.connection-overlay__card {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(248, 250, 252, 0.3);
  border-radius: 18px;
  padding: 24px 28px;
  text-align: center;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.6);
  min-width: 260px;
  max-width: 80vw;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.connection-overlay__card button {
  border: none;
  border-radius: 12px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  background: #38bdf8;
  color: #0f172a;
  transition: background 0.2s ease;
}

.connection-overlay__card button:hover {
  background: #0ea5e9;
}
