/* ==========================================================================
   MINIMALIST ULTIMA ONLINE
   In-game world & item sprites: 2x nearest-neighbor retro pixel art
   UI, Modals, Paperdoll & Inventory: Crisp native-resolution modern minimalist UI
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #07090d;
  color: #f3f4f6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  cursor: url('/assets/uo/cursors/point.png') 0 0, auto;
}

button,
label,
input[type="range"],
input[type="checkbox"],
.saved-char-card,
.archetype-card,
.city-card,
.inv-item-row,
.pd-slot-box.equipped {
  cursor: url('/assets/uo/cursors/point.png') 0 0, pointer !important;
}

button:active,
.drag-handle.dragging {
  cursor: url('/assets/uo/cursors/grab.png') 3 11, grabbing !important;
}

.viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#isoCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: url('/assets/uo/cursors/point.png') 0 0, crosshair;
}

/* ==========================================================================
   NATIVE <dialog> MODALS (SERVER MENU & ESCAPE OPTIONS MENU)
   ========================================================================== */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(4, 6, 10, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

dialog.server-dialog {
  margin: auto;
  width: min(680px, 94vw);
  max-height: 90vh;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(13, 16, 23, 0.94);
  color: #f9fafb;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72);
  padding: 0;
  overflow-y: auto;
}

dialog.escape-dialog {
  width: min(440px, 92vw);
}

.dialog-shell {
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.server-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: #9ca3af;
  margin-bottom: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
}

.dialog-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.dialog-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.dialog-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* Escape Options Menu: Volume Sliders */
.options-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.volume-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.volume-label-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
}

.volume-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #93c5fd;
}

.modern-slider {
  width: 100%;
  accent-color: #3b82f6;
  cursor: pointer;
}

.mute-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #e5e7eb;
  cursor: pointer;
}

.mute-toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #3b82f6;
  cursor: pointer;
}

/* Saved Characters Resume Section */
.saved-chars-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.saved-chars-section[hidden] {
  display: none !important;
}

.section-label,
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 6px;
}

.saved-chars-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.saved-char-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #f3f4f6;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.saved-char-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.25);
}

.saved-char-card strong {
  display: block;
  font-size: 13.5px;
  color: #ffffff;
}

.saved-char-card small {
  font-size: 11.5px;
  color: #9ca3af;
}

.resume-pill {
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
  padding: 4px 8px;
  border-radius: 6px;
}

/* Create Character Form & Validation (:user-invalid / :user-valid) */
.create-char-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hint {
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 6px;
}

.text-input {
  width: 100%;
  padding: 10px 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.text-input:focus {
  border-color: #60a5fa;
  background: rgba(255, 255, 255, 0.07);
}

.error-msg {
  display: none;
  color: #f87171;
  font-size: 12.5px;
  margin-top: 6px;
}

input:user-invalid,
input.user-invalid-fallback {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

input:user-invalid + .error-msg,
input.user-invalid-fallback + .error-msg {
  display: block;
}

input:user-valid {
  border-color: #34d399;
}

/* Appearance Picker (2x Pixel Art Sprite Previews) */
.archetype-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.archetype-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #e5e7eb;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.archetype-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.archetype-card.selected {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
}

.archetype-preview {
  width: 56px;
  height: 68px;
  background-repeat: no-repeat;
  background-position: -20px -16px;
  background-size: 576px 480px;
  image-rendering: pixelated;
}

.archetype-card span {
  font-size: 11.5px;
  font-weight: 500;
  text-align: center;
}

/* Starting City Grid */
.city-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.city-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #f3f4f6;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.city-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.city-card.selected {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.12);
}

.city-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.city-card-top strong {
  font-size: 13.5px;
  color: #ffffff;
}

.city-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #9ca3af;
}

.city-subtitle {
  font-size: 11.5px;
  color: #93c5fd;
  font-weight: 500;
}

.city-desc {
  font-size: 11.5px;
  color: #9ca3af;
  line-height: 1.35;
}

/* Dialog Footer & Buttons */
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-note {
  font-size: 12px;
  color: #9ca3af;
}

.primary-btn {
  padding: 10px 18px;
  background: #3b82f6;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.primary-btn:hover {
  background: #2563eb;
}

.secondary-btn {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   FLOATING DRAGGABLE PANELS: PAPERDOLL (P) & INVENTORY (I)
   ========================================================================== */
.floating-panel {
  position: fixed;
  width: 320px;
  background: rgba(13, 16, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
  z-index: 15;
  overflow: hidden;
}

.floating-panel[hidden] {
  display: none !important;
}

.drag-handle {
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.drag-handle.dragging {
  cursor: grabbing;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
}

.panel-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #f9fafb;
}

.panel-close-btn {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 13px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.panel-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.panel-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Paperdoll Panel (P) */
.pd-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.pd-identity strong {
  font-size: 15px;
  color: #ffffff;
}

.pd-role {
  font-size: 12px;
  color: #9ca3af;
}

.pd-stage-grid {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  gap: 8px;
  align-items: center;
}

.pd-slot-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pd-slot-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 62px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #9ca3af;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pd-slot-box.equipped {
  border-color: rgba(96, 165, 250, 0.4);
  background: rgba(59, 130, 246, 0.08);
}

.pd-slot-box:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.pd-slot-box img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
}

.pd-slot-label {
  font-size: 10px;
  font-weight: 500;
  color: #9ca3af;
}

.pd-figure-box {
  position: relative;
  height: 202px;
  background: radial-gradient(circle at 50% 55%, rgba(59, 130, 246, 0.12) 0%, rgba(0, 0, 0, 0.35) 80%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pd-figure-gump {
  position: absolute;
  width: 210px;
  height: 190px;
  object-fit: contain;
  image-rendering: pixelated;
  opacity: 0.22;
  pointer-events: none;
}

.pd-sprite-preview {
  position: relative;
  width: 112px;
  height: 136px;
  background-repeat: no-repeat;
  background-position: -40px -32px;
  background-size: 1152px 960px;
  image-rendering: pixelated;
}

.pd-stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.stat-pill span {
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
}

.stat-pill strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  color: #f9fafb;
}

/* Inventory Panel (I) */
.inv-summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.inv-pack-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #f3f4f6;
}

.inv-pack-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
}

.inv-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
}

.inv-gold {
  color: #fcd34d;
  font-weight: 600;
}

.inv-weight {
  color: #9ca3af;
}

.inv-item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.inv-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #f3f4f6;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.inv-item-row:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.18);
}

.inv-item-row.equipped {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.09);
}

.inv-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inv-item-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 7px;
  padding: 3px;
}

.inv-item-info strong {
  display: block;
  font-size: 12.5px;
  color: #ffffff;
}

.inv-item-info small {
  font-size: 11px;
  color: #9ca3af;
}

.inv-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #9ca3af;
}

.inv-item-row.equipped .inv-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

/* ==========================================================================
   CLASSIC UO RIGHT-CLICK CONTEXT MENU
   ========================================================================== */
.uo-context-menu {
  position: fixed;
  min-width: 210px;
  max-width: 270px;
  padding: 6px;
  background: rgba(11, 14, 21, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 12px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.72);
  z-index: 30;
}

.uo-context-menu[hidden] {
  display: none !important;
}

.uo-ctx-header {
  padding: 6px 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.uo-ctx-header strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fef08a;
}

.uo-ctx-header small {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 1px;
}

.uo-ctx-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.uo-ctx-item {
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #f3f4f6;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

.uo-ctx-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* ==========================================================================
   MINIMALIST INLINE OVERHEAD SPEECH BAR (ENTER KEY) & IN-GAME HUD PILL
   ========================================================================== */
.speech-bar {
  position: fixed;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: min(440px, 90vw);
  padding: 8px 14px;
  background: rgba(12, 15, 22, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 999px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  z-index: 16;
}

.speech-bar[hidden] {
  display: none !important;
}

.speech-prefix {
  font-size: 12px;
  font-weight: 600;
  color: #fde047;
  white-space: nowrap;
}

#speechInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fef08a;
  font-family: inherit;
  font-size: 13.5px;
}

.hud-pill {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(12, 15, 20, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1;
  letter-spacing: -0.01em;
  z-index: 10;
  white-space: nowrap;
}

.hud-location {
  font-weight: 600;
  color: #f9fafb;
}

.hud-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #9ca3af;
}

.hud-inspect {
  color: #d1d5db;
  font-size: 12.5px;
}

.hud-sep {
  color: rgba(255, 255, 255, 0.22);
}

.hud-btn {
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hud-btn:hover,
.hud-btn.active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.hud-btn-accent {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
  font-weight: 600;
}

@media (max-width: 640px) {
  .archetype-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .city-grid {
    grid-template-columns: 1fr;
  }
}
