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

body {
  background-color: #0d0c0b;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: Georgia, 'Times New Roman', serif;
  overflow: hidden;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: calc(100% - 40px);
  max-width: calc(100vw - 40px);
}

#info-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 20px;
  background-color: #2a2622;
  border: 2px solid #3d3a35;
  border-radius: 4px;
  color: #c4b59d;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#left-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#account-menu {
  position: relative;
}

#player-name {
  font-weight: bold;
  color: #c9a855;
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
}

#player-name:hover {
  border-color: #3d3a35;
  background-color: #332f2a;
}

#account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background-color: #2a2622;
  border: 2px solid #3d3a35;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  z-index: 100;
}

#account-dropdown.hidden {
  display: none;
}

#account-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: #c4b59d;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

#account-dropdown button:hover {
  background-color: #3d3a35;
  color: #c9a855;
}

#account-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#account-modal {
  width: 320px;
  background-color: #2a2622;
  border: 2px solid #3d3a35;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.7);
  padding: 16px 20px;
  color: #c4b59d;
  font-size: 13px;
}

#account-modal-title {
  color: #c9a855;
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 12px;
  text-align: center;
}

#account-modal label {
  display: block;
  margin-bottom: 10px;
}

#account-modal input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 6px 8px;
  background-color: #1c1917;
  border: 1px solid #3d3a35;
  border-radius: 3px;
  color: #e8ddc8;
  font-family: inherit;
}

#account-modal-message {
  min-height: 16px;
  margin: 4px 0 10px;
  font-size: 12px;
}

#account-modal-message.account-modal-error {
  color: #d06a5a;
}

#account-modal-message.account-modal-success {
  color: #7fae6a;
}

#account-modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

#account-modal-buttons button {
  padding: 6px 16px;
  background-color: #3d3a35;
  border: 1px solid #55504a;
  border-radius: 3px;
  color: #c4b59d;
  font-family: inherit;
  cursor: pointer;
}

#account-modal-buttons button:hover {
  color: #c9a855;
  border-color: #c9a855;
}

/* "N online" indicator (top bar + work-mode status bar); hover/focus shows
   the roster. Populated by js/ui/onlinePlayers.js. */
.online-indicator {
  position: relative;
  cursor: default;
  outline: none;
}

#player-count {
  color: #a89880;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
}

#player-count:hover,
#player-count:focus-within {
  border-color: #3d3a35;
  color: #c9a855;
}

#player-count .online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fbf4a;
  box-shadow: 0 0 4px rgba(111, 191, 74, 0.6);
}

.online-popover {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 160px;
  max-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background-color: #2a2622;
  border: 2px solid #3d3a35;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.6);
  padding: 6px 0;
  z-index: 100;
  text-align: left;
}

.online-indicator:hover .online-popover,
.online-indicator:focus-within .online-popover {
  display: block;
}

.online-popover-title {
  padding: 2px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a7d68;
  border-bottom: 1px solid #3d3a35;
  margin-bottom: 4px;
}

.online-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.online-list li {
  padding: 3px 12px;
  font-size: 13px;
  color: #c4b59d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-list li.away {
  color: #7a6f5e;
  font-style: italic;
}

.online-list li.away::after {
  content: ' (away)';
}

#logout-btn {
  background: linear-gradient(to bottom, #8b3a3a 0%, #6a2a2a 100%);
  color: #e8e0d4;
  border: 1px solid #5a2020;
  border-top-color: #a04a4a;
  border-left-color: #a04a4a;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-family: Georgia, serif;
  box-shadow: 0 2px 3px rgba(0,0,0,0.4);
}

#logout-btn:hover {
  background: linear-gradient(to bottom, #9a4a4a 0%, #7a3a3a 100%);
}

#logout-btn:active {
  border-top-color: #5a2020;
  border-left-color: #5a2020;
  border-bottom-color: #a04a4a;
  border-right-color: #a04a4a;
}

#right-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

#quality-select {
  background: linear-gradient(to bottom, #4a4540 0%, #3a3530 100%);
  color: #e8e0d4;
  border: 1px solid #2a2622;
  border-top-color: #5a5550;
  border-left-color: #5a5550;
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-family: Georgia, serif;
  box-shadow: 0 2px 3px rgba(0,0,0,0.4);
}

#quality-select:hover {
  background: linear-gradient(to bottom, #5a5550 0%, #4a4540 100%);
}

#quality-select:focus {
  outline: none;
  border-color: #c9a855;
}

#quality-select option {
  background-color: #3a3530;
  color: #e8e0d4;
}

#canvas-wrapper {
  position: relative;
}

#game-canvas {
  border: 4px solid #3d3a35;
  border-top-color: #4a4540;
  border-left-color: #4a4540;
  border-bottom-color: #1a1816;
  border-right-color: #1a1816;
  border-radius: 4px;
  background-color: #1a1816;
  box-shadow: 0 4px 8px rgba(0,0,0,0.6), inset 0 0 20px rgba(0,0,0,0.3);
}

/* Zone 1 — top-bar buttons (Wiki / Terminal / Work / Logout) */
#right-controls button,
#left-controls #chat-sidebar-btn {
  padding: 5px 12px;
  background: linear-gradient(to bottom, #3d3a35 0%, #2a2622 100%);
  color: #c9a855;
  border: 1px solid #1a1816;
  border-top-color: #4a4540;
  border-left-color: #4a4540;
  border-radius: 3px;
  font-size: 12px;
  font-family: Georgia, serif;
  cursor: pointer;
  box-shadow: 0 2px 3px rgba(0,0,0,0.4);
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

#right-controls button:hover,
#left-controls #chat-sidebar-btn:hover {
  background: linear-gradient(to bottom, #4a4540 0%, #3d3a35 100%);
  color: #dfc070;
}

#right-controls button:active,
#left-controls #chat-sidebar-btn:active {
  border-top-color: #1a1816;
  border-left-color: #1a1816;
  border-bottom-color: #4a4540;
  border-right-color: #4a4540;
}

#right-controls #logout-btn {
  background: linear-gradient(to bottom, #6a2a2a 0%, #4a1a1a 100%);
  color: #f0c0c0;
  border-color: #2a0a0a;
  border-top-color: #8a3a3a;
  border-left-color: #8a3a3a;
}

#right-controls #logout-btn:hover {
  background: linear-gradient(to bottom, #8a3a3a 0%, #6a2a2a 100%);
  color: #ffe0e0;
}

#right-controls #work-mode-btn-top.active,
#left-controls #chat-sidebar-btn.active,
#right-controls #legacy-renderer-btn.active {
  background: linear-gradient(to bottom, #2a5a2a 0%, #1a3a1a 100%);
  color: #4ade80;
  border-color: #1a4a1a;
  border-top-color: #3a6a3a;
  border-left-color: #3a6a3a;
}

/* Zone 2 — top-right popup grid */
#canvas-top-right {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: 36px;
  gap: 4px;
  padding: 6px;
  background: rgba(26, 24, 22, 0.7);
  border: 2px solid #3d3a35;
  border-top-color: #4a4540;
  border-left-color: #4a4540;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  z-index: 4;
}

#canvas-top-right .ctr-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  background: linear-gradient(to bottom, #3d3a35 0%, #2a2622 100%);
  color: #c9a855;
  border: 2px solid #1a1816;
  border-top-color: #4a4540;
  border-left-color: #4a4540;
  border-radius: 3px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

#canvas-top-right .ctr-btn:hover {
  background: linear-gradient(to bottom, #4a4540 0%, #3d3a35 100%);
  color: #dfc070;
}

#canvas-top-right .ctr-btn:active {
  border-top-color: #1a1816;
  border-left-color: #1a1816;
  border-bottom-color: #4a4540;
  border-right-color: #4a4540;
}

/* Zone 3 — bottom-right tab cluster (tab strip only; panel body is canvas-drawn) */
#panel-cluster {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 280px;
  z-index: 4;
  pointer-events: none;
}

#panel-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: linear-gradient(to bottom, #3d3a35 0%, #2a2622 100%);
  border: 2px solid #1a1816;
  border-top: none;
  border-left-color: #4a4540;
  border-bottom-color: #1a1816;
  border-right-color: #1a1816;
  border-radius: 0 0 4px 4px;
  pointer-events: auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

#panel-tabs .ptab {
  flex: 1;
  height: 28px;
  padding: 0;
  background: linear-gradient(to bottom, #2a2622 0%, #1a1816 100%);
  border: 1px solid #1a1816;
  border-top-color: #3a3530;
  border-left-color: #3a3530;
  border-radius: 2px;
  color: #c9a855;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#panel-tabs .ptab:hover {
  background: linear-gradient(to bottom, #3d3a35 0%, #2a2622 100%);
}

#panel-tabs .ptab.active {
  background: linear-gradient(to bottom, #8b5a2b 0%, #5c3d2e 100%);
  border-color: #a87c4f;
  border-top-color: #c49660;
  border-left-color: #c49660;
  color: #fff5e0;
}

#instructions {
  color: #706860;
  font-size: 12px;
  margin-top: 5px;
}

/* Work Mode - Outlook Disguise */
#game-canvas.work-mode {
  filter: grayscale(1) contrast(0.7) brightness(1.5);
  transition: filter 0.3s ease;
  border-color: #d1d1d1 !important;
  box-shadow: none !important;
}

/* Work mode: position game in reading pane area */
body.work-mode-active {
  background-color: #f0f0f0;
  justify-content: flex-start;
  align-items: flex-start;
}

body.work-mode-active #game-container {
  /* Position canvas to align with the reading pane content area */
  /* Sidebar=180px + EmailList=280px = 460px from left */
  /* Titlebar+Ribbon+Toolbar ≈ 116px from top (no email header) */
  position: fixed;
  left: 460px;
  top: 116px;
  width: calc(100vw - 460px);
  height: calc(100vh - 116px - 24px);
  max-width: none;
  gap: 0;
  padding: 0;
}

body.work-mode-active #info-panel {
  display: none;
}

body.work-mode-active #instructions {
  display: none;
}

body.work-mode-active #canvas-wrapper button {
  background: #f0f0f0;
  border: 1px solid #d1d1d1;
  color: #333;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  text-shadow: none;
  box-shadow: none;
  font-weight: normal;
  font-size: 11px;
}

body.work-mode-active #canvas-wrapper button:hover {
  background: #e5e5e5;
  color: #0078d4;
}

/* Hide all floating game buttons in work mode */
body.work-mode-active #canvas-top-right,
body.work-mode-active #panel-cluster {
  display: none !important;
}

body.work-mode-active #canvas-wrapper {
  width: 100%;
  height: 100%;
}

body.work-mode-active #game-canvas {
  border: none !important;
  border-radius: 0 !important;
}

#work-mode-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 13px;
  color: #333;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

/* Explicit pointer-events: only chrome elements catch clicks, reading pane passes through */
.wm-titlebar,
.wm-ribbon-tabs,
.wm-ribbon-toolbar,
.wm-statusbar {
  pointer-events: auto;
}

/* Make all emojis in the overlay monochrome */
#work-mode-overlay .wm-folder,
#work-mode-overlay .wm-ribbon-btn,
#work-mode-overlay .wm-outlook-icon {
  filter: grayscale(1);
}

.wm-titlebar {
  background: #0078d4;
  color: white;
  padding: 4px 12px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.wm-titlebar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wm-outlook-icon {
  font-size: 14px;
}

.wm-titlebar-controls {
  display: flex;
  gap: 12px;
  font-size: 14px;
  cursor: default;
}

.wm-ribbon-tabs {
  background: #f8f8f8;
  border-bottom: 1px solid #d1d1d1;
  padding: 4px 12px 0;
  display: flex;
  align-items: flex-end;
  gap: 0;
  flex-shrink: 0;
}

.wm-tab {
  padding: 4px 12px 6px;
  font-size: 12px;
  color: #666;
  cursor: default;
  border-bottom: 2px solid transparent;
}

.wm-tab-active {
  color: #0078d4;
  border-bottom: 2px solid #0078d4;
}

.wm-tab-file {
  background: #0078d4;
  color: white;
  padding: 4px 14px 6px;
  margin-right: 4px;
}

.wm-ribbon-search {
  margin-left: auto;
}

.wm-ribbon-search input {
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 11px;
  width: 180px;
  color: #999;
  background: white;
}

.wm-ribbon-toolbar {
  background: #f8f8f8;
  border-bottom: 1px solid #d1d1d1;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.wm-ribbon-btn {
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: default;
  white-space: nowrap;
}

.wm-ribbon-btn:hover {
  background: #e5e5e5;
  border-color: #ccc;
}

.wm-ribbon-btn-primary {
  background: #0078d4;
  color: white;
  border-color: #0078d4;
}

.wm-ribbon-btn-primary:hover {
  background: #106ebe;
}

.wm-ribbon-sep {
  width: 1px;
  height: 20px;
  background: #d1d1d1;
  margin: 0 4px;
}

.wm-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  pointer-events: none;
}

.wm-sidebar {
  width: 180px;
  background: #f3f3f3;
  border-right: 1px solid #d1d1d1;
  padding: 8px 0;
  flex-shrink: 0;
  overflow-y: auto;
  pointer-events: auto;
}

.wm-folder-header {
  padding: 6px 16px 2px;
  font-weight: 600;
  font-size: 12px;
  color: #333;
}

.wm-folder {
  padding: 3px 16px 3px 24px;
  font-size: 12px;
  color: #444;
  cursor: default;
  display: flex;
  justify-content: space-between;
}

.wm-folder:hover {
  background: #e8e8e8;
}

.wm-folder-selected {
  background: #cde4f7;
  color: #0078d4;
  font-weight: 600;
}

.wm-folder-selected:hover {
  background: #b8d4ef;
}

.wm-badge {
  background: #0078d4;
  color: white;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
}

.wm-email-list {
  width: 280px;
  background: white;
  border-right: 1px solid #d1d1d1;
  flex-shrink: 0;
  overflow-y: auto;
  pointer-events: auto;
}

.wm-email-search {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 6px;
}

.wm-email-search input {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  color: #999;
  background: white;
}

#wm-sort-btn {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1;
  color: #555;
  background: white;
  cursor: pointer;
  flex-shrink: 0;
}

#wm-sort-btn:hover {
  background: #f0f0f0;
}

.wm-email {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: default;
  position: relative;
}

.wm-email:hover {
  background: #f5f5f5;
}

.wm-email-selected {
  background: #e5f1fb;
  border-left: 3px solid #0078d4;
  padding-left: 9px;
}

.wm-email-selected:hover {
  background: #d6eaf8;
}

.wm-email-unread .wm-email-sender,
.wm-email-unread .wm-email-subject {
  font-weight: 700;
}

.wm-email-sender {
  font-size: 13px;
  color: #333;
  font-weight: 600;
}

.wm-email-subject {
  font-size: 12px;
  color: #333;
  margin-top: 1px;
}

.wm-email-preview {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wm-email-time {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  color: #999;
}

.wm-reading-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  pointer-events: none;
}

.wm-email-header {
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  pointer-events: auto;
  flex-shrink: 0;
}

.wm-email-header-subject {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.wm-email-header-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.wm-email-header-sender {
  font-size: 12px;
  color: #0078d4;
}

.wm-email-header-date {
  font-size: 12px;
  color: #999;
}

.wm-email-header-to {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

.wm-reading-pane-content {
  flex: 1;
  position: relative;
  pointer-events: none;
}

.wm-statusbar {
  background: #f3f3f3;
  border-top: 1px solid #d1d1d1;
  padding: 3px 12px;
  font-size: 11px;
  color: #888;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

#wm-status-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#wm-health-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wm-health-label {
  font-size: 10px;
  color: #333;
  font-weight: 600;
}

.wm-health-bar-track {
  display: inline-block;
  background: #e0e0e0;
  width: 60px;
  height: 6px;
  border-radius: 1px;
  overflow: hidden;
}

.wm-health-bar-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: #0078d4;
  transition: width 0.3s ease, background 0.3s ease;
}

.wm-health-bar-fill.wm-health-yellow {
  background: #f5a623;
}

.wm-health-bar-fill.wm-health-red {
  background: #d32f2f;
}

.wm-health-text {
  font-size: 10px;
  color: #333;
  font-weight: 600;
}

.wm-status-sep {
  color: #888;
}

/* Work-mode roster: reads as a "presence" readout, popover opens upward */
.wm-online {
  color: #555;
  cursor: default;
}

.wm-online:hover,
.wm-online:focus-within {
  color: #0078d4;
}

.wm-online .online-popover {
  top: auto;
  bottom: calc(100% + 6px);
  left: auto;
  right: 0;
  transform: none;
  background: #fff;
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

.wm-online .online-popover-title {
  color: #666;
  border-bottom-color: #e1e1e1;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.wm-online .online-list li {
  color: #333;
  font-size: 12px;
}

.wm-online .online-list li.away {
  color: #999;
}

#wm-dynamic-emails .wm-email-empty {
  padding: 8px 12px;
  font-size: 11px;
  color: #888;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

#wm-dynamic-emails .wm-email-sender {
  color: #333;
}

#wm-dynamic-emails .wm-email-subject {
  color: #555;
}

#wm-dynamic-emails .wm-email-preview {
  color: #666;
}

#wm-dynamic-emails .wm-email-time {
  color: #888;
}

/* Work Mode Context Menu */
.wm-context-menu {
  position: fixed;
  z-index: 100000;
  min-width: 140px;
  background: #f5f5f5;
  border: 1px solid #c8c8c8;
  border-top-color: #e0e0e0;
  border-left-color: #e0e0e0;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.25);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 13px;
  padding: 2px 0;
  border-radius: 2px;
}

.wm-context-menu-item {
  padding: 6px 18px;
  cursor: pointer;
  color: #222;
  white-space: nowrap;
}

.wm-context-menu-item:hover {
  background: #0078d4;
  color: #fff;
}

/* Login page styles */
.login-container {
  text-align: center;
}

.login-container h1 {
  color: #c9a855;
  margin-bottom: 30px;
  font-size: 32px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.auth-form {
  background: linear-gradient(to bottom, #2a2622 0%, #1a1816 100%);
  padding: 30px;
  border-radius: 6px;
  width: 320px;
  border: 3px solid #3d3a35;
  border-top-color: #4a4540;
  border-left-color: #4a4540;
  border-bottom-color: #151311;
  border-right-color: #151311;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
}

.tabs {
  display: flex;
  margin-bottom: 20px;
  gap: 10px;
}

.tab {
  flex: 1;
  padding: 10px;
  background: linear-gradient(to bottom, #2a2622 0%, #1a1816 100%);
  color: #706860;
  border: 2px solid #3d3a35;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: Georgia, serif;
  transition: all 0.2s;
}

.tab:hover {
  color: #a89880;
  background: linear-gradient(to bottom, #3d3a35 0%, #2a2622 100%);
}

.tab.active {
  background: linear-gradient(to bottom, #8b5a2b 0%, #5c3d2e 100%);
  color: #e8e0d4;
  font-weight: bold;
  border-color: #a87c4f;
  border-top-color: #c49660;
  border-left-color: #c49660;
}

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

.form-content.active {
  display: flex;
}

.form-content input {
  padding: 12px 15px;
  border: 2px solid #3d3a35;
  border-radius: 4px;
  background: #1a1816;
  color: #c4b59d;
  font-size: 14px;
  font-family: Georgia, serif;
  outline: none;
  transition: border-color 0.2s;
}

.form-content input:focus {
  border-color: #8b5a2b;
}

.form-content input::placeholder {
  color: #706860;
}

.form-content button {
  padding: 12px;
  background: linear-gradient(to bottom, #8b5a2b 0%, #5c3d2e 100%);
  color: #e8e0d4;
  border: 2px solid #5c3d2e;
  border-top-color: #a87c4f;
  border-left-color: #a87c4f;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  font-family: Georgia, serif;
  transition: background 0.2s;
  margin-top: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.form-content button:hover {
  background: linear-gradient(to bottom, #a87c4f 0%, #8b5a2b 100%);
}

.form-content button:active {
  border-top-color: #5c3d2e;
  border-left-color: #5c3d2e;
  border-bottom-color: #a87c4f;
  border-right-color: #a87c4f;
}

.error {
  color: #8b3a3a;
  font-size: 13px;
  min-height: 20px;
}

/* Landing Page Styles */
.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 20px;
}

.landing-title {
  font-size: 64px;
  font-weight: bold;
  color: #c9a855;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.5), 0 0 20px rgba(201, 168, 85, 0.3);
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.landing-btn {
  width: 300px;
  padding: 20px 40px;
  text-decoration: none;
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.5);
}

.landing-btn:active {
  transform: translateY(0);
}

/* Graphical Button - Game/Wiki style */
.graphical-btn {
  background: linear-gradient(to bottom, #3d3a35 0%, #2a2622 100%);
  color: #c9a855;
  border: 2px solid #1a1816;
  border-top-color: #4a4540;
  border-left-color: #4a4540;
  border-radius: 4px;
  font-family: Georgia, serif;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.graphical-btn:hover {
  background: linear-gradient(to bottom, #4a4540 0%, #3d3a35 100%);
  color: #dfc070;
}

.graphical-btn:active {
  border-top-color: #1a1816;
  border-left-color: #1a1816;
  border-bottom-color: #4a4540;
  border-right-color: #4a4540;
}

/* Terminal Button - Sharp, black with green */
.terminal-btn {
  background: #000000;
  color: #00ff00;
  border: 2px solid #00ff00;
  border-radius: 0;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  text-shadow: 0 0 5px #00ff00;
  letter-spacing: 1px;
}

.terminal-btn:hover {
  background: #0a0a0a;
  color: #33ff33;
  border-color: #33ff33;
  text-shadow: 0 0 8px #33ff33;
}

.terminal-btn:active {
  background: #000000;
  border-color: #00ff00;
}

/* Wiki Button - Slimmer, bland */
.wiki-btn {
  width: 200px;
  padding: 12px 30px;
  background: #2a2622;
  color: #a89880;
  border: 1px solid #3d3a35;
  border-radius: 2px;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: normal;
}

.wiki-btn:hover {
  background: #3d3a35;
  color: #c4b59d;
}

.wiki-btn:active {
  background: #2a2622;
}

/* Login on a phone: full-width form, finger-sized controls, 16px inputs so
   iOS doesn't zoom on focus. */
@media (max-width: 600px) {
  .login-container { width: 100%; padding: 0 16px; box-sizing: border-box; }
  .auth-form { width: 100%; box-sizing: border-box; padding: 20px 16px; }
  .tab { min-height: 44px; font-size: 16px; }
  .form-content input { min-height: 44px; font-size: 16px; box-sizing: border-box; }
  .form-content button { min-height: 48px; font-size: 17px; }
}

/* Responsive */
@media (max-width: 768px) {
  .landing-title {
    font-size: 48px;
  }

  .landing-btn {
    width: 250px;
    padding: 16px 32px;
    font-size: 20px;
  }

  .wiki-btn {
    width: 180px;
    padding: 10px 24px;
    font-size: 16px;
  }
}


#version-display {
  position: fixed;
  bottom: 4px;
  right: 6px;
  z-index: 9999;
  font-family: monospace;
  font-size: 11px;
  color: #6b665c;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: auto;
  user-select: none;
}

#version-display.outdated {
  color: #fff;
  background: #c8201c;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

body.work-mode-active #version-display {
  display: none;
}

/* Work-mode statusbar version (sits left of the health indicator) */
.wm-version {
  margin-right: 12px;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 11px;
  color: #555;
}

.wm-version.outdated {
  color: #fff;
  background: #c8201c;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* =========================================================================
   Work Mode — Dark Theme
   All rules scoped to body.work-mode-active.work-mode-dark so they ONLY
   apply when both work mode AND the dark toggle are active.
   ========================================================================= */

/* Page background behind the overlay */
body.work-mode-active.work-mode-dark {
  background-color: #1a1a1a;
}

/* Titlebar */
body.work-mode-active.work-mode-dark .wm-titlebar {
  background: #1f1f1f;
  color: #e6e6e6;
}

/* Ribbon tabs strip */
body.work-mode-active.work-mode-dark .wm-ribbon-tabs {
  background: #252525;
  border-bottom-color: #333;
}
body.work-mode-active.work-mode-dark .wm-tab {
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark .wm-tab-active {
  color: #4cc2ff;
  border-bottom-color: #4cc2ff;
}
body.work-mode-active.work-mode-dark .wm-tab-file {
  background: #1a6fb5;
  color: #ffffff;
}
body.work-mode-active.work-mode-dark .wm-ribbon-search input {
  background: #2d2d2d;
  color: #cfcfcf;
  border-color: #444;
}

/* Ribbon toolbar */
body.work-mode-active.work-mode-dark .wm-ribbon-toolbar {
  background: #2a2a2a;
  border-bottom-color: #333;
}
body.work-mode-active.work-mode-dark .wm-ribbon-btn {
  color: #e6e6e6;
}
body.work-mode-active.work-mode-dark .wm-ribbon-btn:hover {
  background: #3a3a3a;
  border-color: #555;
}
body.work-mode-active.work-mode-dark .wm-ribbon-btn-primary {
  background: #106ebe;
  color: #ffffff;
  border-color: #106ebe;
}
body.work-mode-active.work-mode-dark .wm-ribbon-btn-primary:hover {
  background: #1380d6;
}
body.work-mode-active.work-mode-dark .wm-ribbon-sep {
  background: #3a3a3a;
}

/* Sidebar (folder list) */
body.work-mode-active.work-mode-dark .wm-sidebar {
  background: #262626;
  border-right-color: #333;
}
body.work-mode-active.work-mode-dark .wm-folder-header {
  color: #bcbcbc;
}
body.work-mode-active.work-mode-dark .wm-folder {
  color: #d4d4d4;
}
body.work-mode-active.work-mode-dark .wm-folder:hover {
  background: #333;
}
body.work-mode-active.work-mode-dark .wm-folder-selected {
  background: #0a4a78;
  color: #ffffff;
}
body.work-mode-active.work-mode-dark .wm-folder-selected:hover {
  background: #0c5894;
}
body.work-mode-active.work-mode-dark .wm-badge {
  background: #1a6fb5;
  color: #ffffff;
}

/* Email list column */
body.work-mode-active.work-mode-dark .wm-email-list {
  background: #1f1f1f;
  border-right-color: #333;
}
body.work-mode-active.work-mode-dark .wm-email-search {
  border-bottom-color: #333;
}
body.work-mode-active.work-mode-dark .wm-email-search input {
  background: #2d2d2d;
  border-color: #444;
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark #wm-sort-btn {
  background: #2d2d2d;
  border-color: #444;
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark #wm-sort-btn:hover {
  background: #3a3a3a;
}
body.work-mode-active.work-mode-dark .wm-email {
  border-bottom-color: #2c2c2c;
}
body.work-mode-active.work-mode-dark .wm-email:hover {
  background: #2a2a2a;
}
body.work-mode-active.work-mode-dark .wm-email-selected {
  background: #0a4a78;
  border-left-color: #4cc2ff;
}
body.work-mode-active.work-mode-dark .wm-email-selected:hover {
  background: #0c5894;
}
body.work-mode-active.work-mode-dark .wm-email-sender {
  color: #e6e6e6;
}
body.work-mode-active.work-mode-dark .wm-email-subject {
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark .wm-email-preview {
  color: #9a9a9a;
}
body.work-mode-active.work-mode-dark .wm-email-time {
  color: #9a9a9a;
}

/* Dynamic email rows (#wm-dynamic-emails) inherit; override sub-text colors */
body.work-mode-active.work-mode-dark #wm-dynamic-emails .wm-email-empty {
  color: #9a9a9a;
  border-bottom-color: #2c2c2c;
}
body.work-mode-active.work-mode-dark #wm-dynamic-emails .wm-email-sender {
  color: #e6e6e6;
}
body.work-mode-active.work-mode-dark #wm-dynamic-emails .wm-email-subject {
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark #wm-dynamic-emails .wm-email-preview {
  color: #9a9a9a;
}
body.work-mode-active.work-mode-dark #wm-dynamic-emails .wm-email-time {
  color: #9a9a9a;
}

/* Reading pane + email header */
body.work-mode-active.work-mode-dark .wm-email-header {
  background: #1a1a1a;
  border-bottom-color: #333;
}
body.work-mode-active.work-mode-dark .wm-email-header-subject {
  color: #e6e6e6;
}
body.work-mode-active.work-mode-dark .wm-email-header-sender {
  color: #4cc2ff;
}
body.work-mode-active.work-mode-dark .wm-email-header-date,
body.work-mode-active.work-mode-dark .wm-email-header-to {
  color: #9a9a9a;
}

/* Status bar */
body.work-mode-active.work-mode-dark .wm-statusbar {
  background: #1f1f1f;
  border-top-color: #333;
  color: #9a9a9a;
}
body.work-mode-active.work-mode-dark .wm-health-label,
body.work-mode-active.work-mode-dark .wm-health-text {
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark .wm-health-bar-track {
  background: #333;
}
body.work-mode-active.work-mode-dark .wm-status-sep {
  color: #555;
}
body.work-mode-active.work-mode-dark .wm-online {
  color: #9a9a9a;
}
body.work-mode-active.work-mode-dark .wm-online .online-popover {
  background: #252525;
  border-color: #3a3a3a;
}
body.work-mode-active.work-mode-dark .wm-online .online-popover-title {
  color: #9a9a9a;
  border-bottom-color: #333;
}
body.work-mode-active.work-mode-dark .wm-online .online-list li {
  color: #cfcfcf;
}
body.work-mode-active.work-mode-dark .wm-online .online-list li.away {
  color: #777;
}

/* Game canvas filter — make the "embedded report" look like a dark screenshot */
body.work-mode-active.work-mode-dark #game-canvas.work-mode {
  filter: grayscale(1) contrast(1) brightness(0.55);
}

/* Canvas wrapper buttons (most are hidden in work mode; safety override) */
body.work-mode-active.work-mode-dark #canvas-wrapper button {
  background: #2d2d2d;
  border-color: #444;
  color: #e6e6e6;
}
body.work-mode-active.work-mode-dark #canvas-wrapper button:hover {
  background: #3a3a3a;
  color: #4cc2ff;
}

/* Work-mode context menu (right-click on inventory item, etc.) */
body.work-mode-active.work-mode-dark .wm-context-menu {
  background: #262626;
  border-color: #444;
  border-top-color: #555;
  border-left-color: #555;
  color: #e6e6e6;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}
body.work-mode-active.work-mode-dark .wm-context-menu-item {
  color: #e6e6e6;
}
body.work-mode-active.work-mode-dark .wm-context-menu-item:hover {
  background: #333;
  color: #ffffff;
}

/* Collection-log helpers (used by workModePanels.js) */
.wm-collection-back {
  background: #e8f4fd;
  border-left: 3px solid #0078d4;
}
.wm-collection-category-header {
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}
body.work-mode-active.work-mode-dark .wm-collection-back {
  background: #0a4a78;
  border-left-color: #4cc2ff;
}
body.work-mode-active.work-mode-dark .wm-collection-category-header {
  color: #e6e6e6;
  border-bottom-color: #333;
}
