* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Tahoma', 'Segoe UI', sans-serif; }
body { background: #3a6ea5; min-height: 100vh; overflow: hidden; }

#splashScreen { position: fixed; inset: 0; background: #3a6ea5; display: none; align-items: center; justify-content: center; z-index: 9998; transition: opacity 0.8s ease; }
#splashScreen .splash-logo { max-width: 60%; max-height: 60%; object-fit: contain; }
#loginScreen { position: fixed; inset: 0; background: #3a6ea5; display: flex; align-items: center; justify-content: center; z-index: 9999; }
.login-box { background: #ece9d8; width: 340px; border: 1px solid #fff; outline: 1px solid #848484; box-shadow: 3px 3px 8px rgba(0,0,0,0.5); }
.login-header { background: linear-gradient(to right, #0a246a, #a6caf0); color: white; padding: 8px 12px; font-size: 13px; font-weight: bold; display: flex; align-items: center; gap: 8px; }
.login-body { padding: 20px; }
.login-body p { font-size: 12px; margin-bottom: 14px; color: #333; }
.login-btn { display: block; width: 100%; text-align: left; background: #ece9d8; border: 1px solid #aaa; padding: 8px 12px; font-size: 13px; cursor: pointer; margin-bottom: 6px; }
.login-btn:hover { background: #c1d2ee; }

#desktop { position: fixed; inset: 0 0 30px 0; overflow: visible; }
#desktopIcons { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.desktop-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; width: 70px; text-align: center; padding: 4px; }
.desktop-icon:hover { outline: 1px dashed rgba(255,255,255,0.8); background: rgba(255,255,255,0.15); }
.d-icon-img { font-size: 32px; }
.d-icon-label { font-size: 11px; color: white; text-shadow: 1px 1px 3px #000; word-break: break-word; }
.d-icon-wrapper { position: relative; display: inline-block; }
.d-icon-badge { position: absolute; top: -4px; right: -6px; background: #cc0000; color: white; font-size: 9px; font-weight: bold; padding: 1px 4px; border-radius: 8px; border: 1px solid #fff; line-height: 1.4; pointer-events: none; }

#taskbar { position: fixed; bottom: 0; left: 0; right: 0; height: 30px; background: linear-gradient(to bottom, #245cdb 0%, #3a7ae8 4%, #1640b8 6%, #1248c8 50%, #1040c0 52%, #0a30a0 100%); display: flex; align-items: center; padding: 0 2px; gap: 3px; z-index: 9999; opacity: 0; transition: opacity 0.8s ease; }
.start-btn { background: linear-gradient(to bottom, #5cb85c, #3d8b3d); color: white; border: 1px solid #2a5f2a; padding: 2px 10px 2px 6px; font-size: 12px; font-weight: bold; cursor: pointer; height: 24px; border-radius: 10px; display: flex; align-items: center; gap: 4px; }
.taskbar-sep { width: 1px; background: rgba(255,255,255,0.3); height: 20px; margin: 0 2px; }
.tb-btn { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 2px 8px; font-size: 11px; cursor: pointer; height: 22px; min-width: 80px; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.tb-btn:hover { background: rgba(255,255,255,0.25); }
#taskbarClock { margin-left: auto; color: white; font-size: 11px; padding: 2px 8px; border: 1px solid rgba(255,255,255,0.3); background: rgba(0,0,0,0.2); }

#startMenu { display: none; position: fixed; bottom: 30px; left: 0; width: 200px; background: #ece9d8; border: 1px solid #fff; outline: 1px solid #848484; box-shadow: 3px -3px 8px rgba(0,0,0,0.4); z-index: 999; }
.sm-stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 26px; background: linear-gradient(to bottom, #2e5ead, #1a3d8a); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; }
.sm-stripe span { color: rgba(255,255,255,0.7); font-size: 11px; font-weight: bold; writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: 2px; }
.sm-items { margin-left: 26px; }
.sm-item { padding: 6px 10px; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.sm-item:hover { background: #316ac5; color: white; }
.sm-sep { border: none; border-top: 1px solid #aaa; margin: 2px 0; }

.xp-window { position: absolute; background: #ece9d8; min-width: 300px; border: 1px solid #fff; outline: 1px solid #848484; box-shadow: 3px 3px 8px rgba(0,0,0,0.4); display: none; z-index: 10; border-radius: 6px 6px 0 0; }
.xp-window.open { display: flex; flex-direction: column; }
.xp-window.focused { z-index: 100; }

.titlebar { background: linear-gradient(to bottom, #0a246a 0%, #3c82d8 3%, #245cdb 6%, #245cdb 93%, #1640b8 97%, #0a246a 100%); color: white; padding: 4px 6px; display: flex; align-items: center; justify-content: space-between; cursor: move; user-select: none; font-size: 12px; font-weight: bold; border-radius: 6px 6px 0 0; }
.titlebar-inactive { background: linear-gradient(to bottom, #7a96c2 0%, #9db5d8 4%, #7a96c2 97%); }
.tb-controls { display: flex; gap: 2px; }
.tb-ctrl { width: 21px; height: 21px; cursor: pointer; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: bold; background: linear-gradient(to bottom, #e4e0d4, #bdb9ae); border: 1px solid #888; color: #000; }
.tb-ctrl:hover { background: linear-gradient(to bottom, #f0ede5, #ccc8bc); }
.tb-ctrl.close { background: linear-gradient(to bottom, #e05252, #c03030); color: white; border-color: #800; }
.tb-ctrl.close:hover { background: linear-gradient(to bottom, #f07070, #e04040); }

.avatar-image {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}


.win-menubar { background: #ece9d8; padding: 2px 4px; display: flex; border-bottom: 1px solid #aaa; font-size: 12px; }
.win-menu-item { padding: 2px 6px; cursor: default; }
.win-menu-item:hover { background: #316ac5; color: white; }
.win-body { padding: 8px; }

.xp-btn { background: linear-gradient(to bottom, #f4f2ec, #d9d6cc); border: 1px solid #7a7a7a; padding: 4px 14px; font-size: 12px; cursor: pointer; border-radius: 3px; }
.xp-btn:hover { background: linear-gradient(to bottom, #e8f0fd, #c5d5f5); border-color: #316ac5; }
.xp-btn:active { background: linear-gradient(to bottom, #d0d8f0, #b8c8e8); }
.xp-btn:disabled { color: #aaa; cursor: default; }
.xp-btn.primary { background: linear-gradient(to bottom, #4a8ee8, #1248c8); color: white; border-color: #0a30a0; }
.xp-btn.primary:hover { background: linear-gradient(to bottom, #5a9ef8, #2258d8); }
.xp-btn.danger { background: linear-gradient(to bottom, #e85252, #c03030); color: white; border-color: #800; }
.xp-btn.danger:hover { background: linear-gradient(to bottom, #f07070, #e04040); }
.xp-btn.sm { padding: 2px 8px; font-size: 11px; }

.xp-input, .xp-select, .xp-textarea { border: 1px solid #7a7a7a; padding: 3px 6px; font-size: 12px; background: white; border-radius: 2px; font-family: 'Tahoma', sans-serif; }
.xp-input:focus, .xp-select:focus { outline: none; border-color: #316ac5; box-shadow: 0 0 0 1px #316ac5; }
.xp-textarea { resize: vertical; }

.xp-listbox { border: 1px solid #7a7a7a; background: white; overflow-y: auto; font-size: 12px; }
.lb-item { padding: 3px 6px; cursor: pointer; }
.lb-item:hover { background: #316ac5; color: white; }

.tab-bar { display: flex; border-bottom: 2px solid #316ac5; flex-wrap: wrap; }
.tab { padding: 4px 12px; font-size: 12px; cursor: pointer; background: #d9d6cc; border: 1px solid #aaa; border-bottom: none; margin-right: 2px; border-radius: 3px 3px 0 0; }
.tab:hover { background: #e8e4d8; }
.tab.active { background: #ece9d8; border-color: #316ac5; font-weight: bold; margin-bottom: -2px; z-index: 1; position: relative; }
.tab-panel { display: none; padding: 8px; border: 1px solid #aaa; border-top: none; border-radius: 0 3px 3px 3px; }
.tab-panel.active { display: block; }

.groupbox { border: 1px solid #aaa; padding: 8px; margin: 6px 0; position: relative; border-radius: 3px; }
.groupbox-label { position: absolute; top: -9px; left: 8px; background: #ece9d8; padding: 0 4px; font-size: 12px; font-weight: bold; }

.statusbar { display: flex; gap: 2px; padding: 2px 4px; border-top: 1px solid #aaa; font-size: 11px; margin-top: 4px; }
.sb-panel { border: 1px solid #aaa; padding: 1px 6px; border-radius: 2px; }

.ach-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px solid #e0ddd5; font-size: 12px; }
.ach-row:last-child { border-bottom: none; }
.ach-icon { font-size: 20px; width: 28px; text-align: center; }
.ach-info { flex: 1; min-width: 0; }
.ach-name { font-weight: bold; }
.ach-desc { color: #555; font-size: 11px; }
.ach-reward { font-size: 11px; color: #0a246a; margin-top: 2px; }

.loot-box { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 2px solid #aaa; background: white; cursor: pointer; width: 90px; text-align: center; border-radius: 4px; }
.loot-box:hover { border-color: #316ac5; background: #e8f0fd; }
.loot-box .box-icon { font-size: 32px; }
.loot-box .box-name { font-size: 10px; font-weight: bold; line-height: 1.2; }

.inv-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; padding: 6px; background: #c8c4b8; border: 1px solid #888; border-radius: 3px; max-height: 280px; overflow-y: auto; }
.inv-slot { position: relative; width: 66px; height: 66px; border: 2px solid #888; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 9px; text-align: center; cursor: pointer; padding: 2px; overflow: visible; border-radius: 3px; }
.inv-slot:hover { border-color: #316ac5; }
.inv-slot.empty { background: #d4d0c8; border-color: #b0aba0; cursor: default; }
.si-icon { font-size: 26px; }
.si-name { font-size: 9px; line-height: 1.1; overflow: hidden; }

.dm-warning { background: #fff0c0; border: 1px solid #cc8800; padding: 6px 10px; font-size: 12px; margin-bottom: 8px; border-radius: 3px; }

.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; align-items: center; justify-content: center; }
.modal-bg.open { display: flex; }
.modal-win { background: #ece9d8; min-width: 340px; max-width: 500px; border: 1px solid #fff; outline: 1px solid #848484; box-shadow: 4px 4px 12px rgba(0,0,0,0.5); border-radius: 6px 6px 0 0; }
.modal-body { padding: 16px; }
.modal-box-items { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; min-height: 60px; }
.modal-item { background: white; padding: 10px; text-align: center; min-width: 90px; border-radius: 4px; border: 2px solid #aaa; }
.modal-item .mi-icon { font-size: 28px; }
.modal-item .mi-name { font-size: 11px; font-weight: bold; margin-top: 4px; }
.modal-item .mi-rarity { font-size: 10px; text-transform: uppercase; }
.modal-btns { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

/* DM Alert Modal */
.modal-win.alert-win {
  border: 2px solid #c03030;
  box-shadow: 4px 4px 16px rgba(192,48,48,0.4);
}
#dmAlertMessage {
  min-height: 60px;
  padding: 8px;
  background: #fff8e8;
  border: 1px solid #cc8800;
  border-radius: 3px;
}

#notif { display: none; position: fixed; bottom: 36px; right: 8px; background: #ffffcc; border: 1px solid #cc8800; padding: 8px 12px; font-size: 12px; z-index: 2000; max-width: 280px; border-radius: 3px; box-shadow: 2px 2px 6px rgba(0,0,0,0.3); border-left: 4px solid #316ac5; }
#notif.show { display: block; }

.char-card { background: #0a246a; color: white; padding: 6px 10px; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; border-radius: 3px; font-size: 12px; }
.char-avatar { width: 36px; height: 36px; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.5); display: flex; align-items: center; justify-content: center; font-size: 20px; border-radius: 50%; }

.char-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}


#connStatus { font-size: 10px; color: rgba(255,255,255,0.8); padding: 0 6px; }
#connStatus.offline { color: #ff6060; }

/* Gold Panel */
.inv-gold-panel { width: 130px; min-width: 130px; background: linear-gradient(to bottom, #fffbe6, #fff3c0); border: 1px solid #c8a84a; border-radius: 3px; margin-left: 6px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.inv-gold-title { font-size: 11px; font-weight: bold; color: #7a6010; margin-bottom: 6px; }
.inv-gold-amount { font-size: 13px; font-weight: bold; color: #3a2800; font-family: 'Courier New', monospace; word-break: break-all; min-width: 72px; text-align: center; }
.inv-gold-label { font-size: 10px; color: #9a8030; margin-top: 2px; }
.config-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.config-table th { background: #316ac5; color: white; padding: 4px 8px; text-align: left; font-weight: normal; }
.config-table td { padding: 4px 8px; border-bottom: 1px solid #ddd; vertical-align: middle; }
.config-table tr:hover td { background: #eef3fc; }

.pool-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid #eee; font-size: 12px; }
.pool-row:last-child { border-bottom: none; }

.rarity-common    { color: #555; font-weight: bold; }
.rarity-uncommon  { color: #2a7a2a; font-weight: bold; }
.rarity-rare      { color: #1a4aaa; font-weight: bold; }
.rarity-mythic    { color: #8a00cc; font-weight: bold; }
.rarity-legendary { color: #b8860b; font-weight: bold; }
.rarity-celestial { color: #007a87; font-weight: bold; }

.tier-bronze  { color: #cd7f32; font-weight: bold; }
.tier-silver  { color: #888; font-weight: bold; }
.tier-gold    { color: #daa520; font-weight: bold; }
.tier-platinum  { color: #8a00cc; font-weight: bold; }
.tier-legendary { color: #6a0dad; font-weight: bold; }
.tier-celestial { color: #007a87; font-weight: bold; }

/* Quest Log */
.quest-row { border: 1px solid #c8c4b8; background: white; border-radius: 3px; margin-bottom: 6px; font-size: 12px; overflow: hidden; }
.quest-row.completed { opacity: 0.6; }
.quest-header { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #f0ede5; border-bottom: 1px solid #ddd; cursor: pointer; }
.quest-header:hover { background: #e8f0fd; }
.quest-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.quest-status-dot.active { background: #f5a623; border: 1px solid #c8810a; }
.quest-status-dot.completed { background: #4a9e4a; border: 1px solid #2a6e2a; }
.quest-title-text { font-weight: bold; flex: 1; }
.quest-badge { font-size: 10px; padding: 1px 5px; border-radius: 8px; background: #316ac5; color: white; }
.quest-body { padding: 8px 10px; display: none; }
.quest-body.open { display: block; }
.quest-field { margin-bottom: 5px; }
.quest-field-label { font-size: 10px; font-weight: bold; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.quest-field-value { margin-top: 1px; }
.quest-actions { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee; }

::-webkit-scrollbar-track { background: #d4d0c8; border: 1px solid #aaa; }
::-webkit-scrollbar-thumb { background: linear-gradient(to right, #f4f2ec, #c4c0b4); border: 1px solid #888; }

/* Notebook */
.nb-layout { display: flex; height: 100%; gap: 0; }
.nb-sidebar { width: 200px; min-width: 140px; max-width: 300px; background: #ddd9cc; border-right: 1px solid #aaa; display: flex; flex-direction: column; overflow: hidden; resize: none; }
.nb-sidebar-header { background: #316ac5; color: white; padding: 5px 8px; font-size: 12px; font-weight: bold; display: flex; align-items: center; justify-content: space-between; }
.nb-page-tree { flex: 1; overflow-y: auto; padding: 4px 0; }
.nb-page-item { display: flex; align-items: center; gap: 0; font-size: 12px; cursor: pointer; user-select: none; border-left: 3px solid transparent; }
.nb-page-item:hover { background: rgba(49,106,197,0.12); }
.nb-page-item.active { background: rgba(49,106,197,0.2); border-left-color: #316ac5; }
.nb-page-item.subpage { }
.nb-page-label { flex: 1; padding: 5px 6px 5px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-page-label.editing { padding: 2px; }
.nb-page-label input { width: 100%; font-size: 12px; border: 1px solid #316ac5; padding: 1px 4px; font-family: 'Tahoma', sans-serif; }
.nb-expand-btn { width: 18px; text-align: center; font-size: 10px; color: #888; flex-shrink: 0; }
.nb-drag-handle { color: #bbb; font-size: 10px; padding: 0 2px; cursor: grab; }
.nb-drag-handle:active { cursor: grabbing; }
.nb-page-actions { display: none; gap: 2px; padding-right: 4px; }
.nb-page-item:hover .nb-page-actions { display: flex; }
.nb-page-action-btn { background: none; border: none; cursor: pointer; font-size: 11px; padding: 1px 2px; color: #666; border-radius: 2px; }
.nb-page-action-btn:hover { background: rgba(0,0,0,0.12); }
.nb-editor-pane { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.nb-page-title-bar { padding: 8px 10px 4px; border-bottom: 1px solid #ccc; background: #f5f3ed; }
.nb-page-title-input { font-size: 18px; font-weight: bold; border: none; background: transparent; width: 100%; font-family: 'Tahoma', sans-serif; color: #0a246a; outline: none; }
.nb-page-title-input:focus { border-bottom: 2px solid #316ac5; }
.nb-page-meta { font-size: 10px; color: #999; margin-top: 2px; }
.nb-editor { flex: 1; padding: 10px; overflow-y: auto; background: white; }
.nb-editor textarea { width: 100%; height: 100%; border: none; resize: none; font-size: 13px; font-family: 'Tahoma', 'Segoe UI', sans-serif; line-height: 1.6; outline: none; background: white; color: #222; }
.nb-editor-toolbar { display: flex; gap: 4px; padding: 4px 8px; border-bottom: 1px solid #ddd; background: #f5f3ed; flex-wrap: wrap; }
.nb-toolbar-btn { background: linear-gradient(to bottom, #f4f2ec, #d9d6cc); border: 1px solid #7a7a7a; padding: 2px 8px; font-size: 11px; cursor: pointer; border-radius: 2px; }
.nb-toolbar-btn:hover { background: linear-gradient(to bottom, #e8f0fd, #c5d5f5); border-color: #316ac5; }
.nb-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: #999; font-size: 13px; gap: 8px; }
.nb-drop-indicator { height: 2px; background: #316ac5; margin: 0; display: none; }
.nb-drop-indicator.visible { display: block; }

/* Notification */
.notif-group { border-bottom: 1px solid #ccc; }
.notif-group-header { 
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px; background: #dcdbd0; 
  cursor: pointer; font-size: 11px; font-weight: bold;
  user-select: none; border-bottom: 1px solid #bbb;
}
.notif-group-header:hover { background: #c8d4ec; }
.notif-group-header .notif-group-arrow { font-size: 9px; margin-right: 2px; }
.notif-group-header .notif-group-count { 
  margin-left: auto; background: #316ac5; color: white; 
  font-size: 10px; padding: 1px 5px; border-radius: 8px;
}
.notif-group-body { }
.notif-item-dm { border-left: 3px solid #316ac5; }
.notif-item-player { border-left: 3px solid #2a7a2a; }
.notif-item-self { border-left: 3px solid #aaa; background: #f5f5f0; }

/* Responsive — splash & login (≤600px) */
@media (max-width: 600px) {
  #splashScreen .splash-logo {
    max-width: 90vw;
    max-height: 80vh;
  }
  .login-box {
    width: 90vw;
    max-width: 340px;
    padding: 16px;
  }
  .login-body { padding: 14px; }
}

/* Responsive — desktop UI (≤768px) */
@media (max-width: 768px) {
  .xp-window {
    min-width: 0;
    width: 95vw !important;
    max-width: 95vw !important;
  }
  .inv-grid { grid-template-columns: repeat(4, 1fr); }
  #notif { max-width: 200px; }
  .tb-ctrl { min-width: 44px; width: 44px; height: 32px; font-size: 14px; }
  .start-btn { min-width: 60px; height: 36px; font-size: 13px; }
  .desktop-icon { touch-action: manipulation; }
}
