/* Force GM Notes editor to only resize vertically */
#gm-notes-editor {
  resize: vertical !important;
}
.db-explorer {
  margin: 0;
  padding: 0;
  font-size: 15px;
  user-select: none;
  background: #f7f8fa;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1.5px solid var(--border);
}
.db-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 7px 10px 7px 0;
  margin-bottom: 2px;
  transition: background 0.18s, box-shadow 0.18s;
  position: relative;
}
.db-row:hover {
  background: #eaf3ff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.07);
}
.db-folder-row {
  font-weight: 600;
  color: var(--accent);
  background: #f2f6ff;
}
.db-folder-row:hover {
  background: #e0eaff;
}
.db-card-row {
  color: #222;
  cursor: grab;
  background: #fff;
}
.db-card-row:hover {
  background: #eaf3ff;
}
.db-icon {
  width: 24px;
  text-align: center;
  font-size: 18px;
  opacity: 0.92;
  margin-right: 2px;
}
.db-folder-name, .db-card-name {
  flex: 1;
  outline: none;
  border: none;
  background: none;
  font-size: 15px;
  min-width: 32px;
  padding: 2px 0;
  border-radius: 4px;
  transition: background 0.13s;
}
.db-folder-name:focus, .db-card-name:focus {
  background: #eaf3ff;
}
.db-btn-delete {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: #e57373;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  opacity: 0.6;
  margin-left: 8px;
  box-sizing: border-box;
  display: inline-block;
}
.db-btn-delete.active {
  opacity: 1;
  cursor: pointer;
}
.db-btn-delete.active:hover {
  background: #ffeaea;
  color: #b91c1c;
}
/* Database area fixed height and scrollable */
.db-area {
  height: 340px;
  background: #f7f8fa;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1.5px solid var(--border);
  margin-bottom: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.db-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  overflow-y: auto;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
}
/* Card item styling unchanged */
/* Database buttons row */
.db-btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.db-btn-top {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.db-btn-top:hover {
  background: #eaf3ff;
  color: #2563eb;
}
.db-btn-bottom {
  height: 32px;
  padding: 0 16px;
  font-size: 13px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: #222;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s, color 0.15s;
}
.db-btn-bottom.x-red {
  color: #e57373;
  border: 1.5px solid #e57373 !important;
  background: transparent;
  font-size: 13px;
}
.db-btn-bottom.x-red:hover {
  background: #ffeaea;
  color: #b91c1c;
}
.db-btn-bottom:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f7f7f7;
  color: #999;
  border: 1.5px solid var(--border);
}
.db-card-item:nth-child(even) {
  background: #f3f6fb;
}
.db-card-item:hover {
  background: #eaf3ff !important;
}
.db-card-item:active {
  background: #dbeafe !important;
}
.db-card-item::before {
  content: '\1F4C4'; /* 📄 */
  font-size: 15px;
  margin-right: 7px;
  color: #2563eb;
  opacity: 0.8;
}
.db-card-row .db-icon {
  color: #888;
}
.db-card-row .db-card-name {
  color: #222;
}
.checkbox.pending-reset {
  animation: fadeHighlight 1.2s linear;
  box-shadow: 0 0 0 2px var(--accent-2), 0 0 8px 2px var(--accent-2);
/* Database Explorer Modern Look */
.db-explorer {
  margin: 0;
  padding: 0;
  font-size: 15px;
  user-select: none;
}
.db-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  padding: 2.5px 0 2.5px 0;
  margin-bottom: 1.5px;
  transition: background 0.13s;
}
.db-row:hover {
  background: #eaf3ff;
}
.db-folder-row {
  font-weight: 600;
  color: #2563eb;
}
.db-card-row {
  color: #222;
  cursor: grab;
}
.db-icon {
  width: 22px;
  text-align: center;
  font-size: 17px;
  opacity: 0.85;
}
.db-folder-name, .db-card-name {
  flex: 1;
  outline: none;
  border: none;
  background: none;
  font-size: 15px;
  min-width: 32px;
}
.db-btn {
  background: none;
  border: none;
  color: #b0b4ba;
  font-size: 15px;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 2px;
  transition: background 0.13s, color 0.13s;
}
.db-btn:hover {
  background: #f0f4fa;
  color: #e57373;
}
.db-btn-x {
  font-size: 16px;
  color: #e57373;
}
}

/* More economical notes section */
.notes-row {
  display: flex;
  gap: 2px;
  align-items: center;
  margin-top: 2px;
}
.notes-row textarea.card-notes {
  flex: 1;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  min-height: 24px;
  max-height: 60px;
  resize: vertical;
}
/* FATE NPC Manager Styles */
:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-2: #06b6d4;
  --border: #b0b4ba; /* neutral mid-grey */
}
html,body{
  height: 100vh;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Roboto, 'Segoe UI', Arial;
  color: #0f1724;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
}
.layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}
.sidebar {
  width: 333px;
  min-width: 333px;
  max-width: 480px;
    position: fixed;
      overflow-x: hidden;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  transition: width 0.15s;
  flex-shrink: 0;
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1.5px 0 #fff inset;
  z-index: 100;
  border-right: 2px solid var(--border);
}
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 12px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  border-radius: 6px;
  transition: background 0.13s;
}
.sidebar-resizer:hover, .sidebar-resizer:active {
  background: #eaf3ff;
}
.sidebar-tabs {
  display: flex;
  flex-direction: row;
  gap: 0;
  margin: 0;
  border-bottom: 1.5px solid var(--border);
  background: #f2f4f8;
  padding-left: 0;
  position: relative;
  z-index: 2;
}
.sidebar-tab {
  flex: 1 1 0;
  background: #f2f4f8;
  border: none;
  border-bottom: 3px solid transparent;
  color: #444;
  text-align: center;
  padding: 12px 0 10px 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  z-index: 1;
  position: relative;
  box-shadow: none;
}
.sidebar-tab:not(.active) {
  opacity: 0.85;
  background: #f2f4f8;
  box-shadow: none;
}
.sidebar-tab.active {
  background: #fff;
  border-bottom: 3px solid var(--accent);
  color: var(--accent);
  z-index: 3;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1.5px 0 #fff inset;
  margin-bottom: -7px;
}
.sidebar-content {
  flex: 1 1 auto;
  padding: 32px 24px;
  overflow: visible;
  font-size: 15px;
  color: #333;
  background: transparent;
  border-top-left-radius: 12px;
  box-shadow: none;
  z-index: 1;
  position: relative;
}
.app {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 333px; /* offset for fixed sidebar */
  width: calc(100vw - 333px);
  max-width: calc(100vw - 333px);
  overflow-x: hidden;
}
.app-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: none;
  margin: 32px 0 0 0; /* add top gap */
  padding: 0;
  max-width: 100vw;
  width: 100%;
  max-width: 100%;
}
header, main, footer {
  width: 100%;
  max-width: 100%;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
  margin: 0 auto;
  min-height: 120px;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  max-width: 100%;
}
.cards-grid.wide-view {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1200px) {
  .cards-grid, .cards-grid.wide-view {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 700px) {
  .cards-grid, .cards-grid.wide-view {
    grid-template-columns: 1fr;
  }
}
header{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-bottom:18px}
h1{font-size:20px;margin:0}
p.lead{margin:0;color:var(--muted);font-size:13px}
.controls{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.btn, .btn.ghost {
  background: #f7f8fa;
  color: #222;
  border: 1.5px solid var(--border);
  padding: 7px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.btn:hover, .btn.ghost:hover {
  background: #eaf3ff;
  color: var(--accent);
  border-color: var(--accent);
}
.btn.ghost {
  background: #fff;
  color: #444;
}
#wideViewToggle.active {
  background: #06b6d4;
  color: #fff;
  border-color: #06b6d4;
}
.search{padding:6px 10px;border-radius:8px;border:1px solid var(--border);background:var(--card);color:#0f1724;width:240px}
.cards-grid.empty-dropzone {
  min-height: 120px;
  background: #f0f4fa;
  border: 2px dashed #06b6d4;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-drop-msg {
  color: #06b6d4;
  font-size: 18px;
  opacity: 0.7;
  text-align: center;
  width: 100%;
}
.card{background:var(--card);padding:12px;border-radius:12px;border:1px solid var(--border);box-shadow:0 6px 18px rgba(15,23,36,0.04);display:flex;flex-direction:column;gap:8px;cursor:grab;position:relative;}
.card.dragging{opacity:0.6;transform:scale(0.98)}
.card-header{display:flex;justify-content:space-between;align-items:center;gap:8px}
.card-title{font-weight:700;font-size:16px;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.card-title input{font-weight:700;font-size:16px;border:none;background:transparent;width:100%}
.tiny{font-size:12px;color:var(--muted)}
.section{margin-top:6px}
.section-title{display:flex;justify-content:space-between;align-items:center;gap:8px}
.section-title h4{margin:0;font-size:12px;color:var(--muted);letter-spacing:0.6px;font-family: inherit;font-weight: 600;}
.section-title .sec-actions{display:flex;gap:6px}
.items{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.skill-row,.stunt-row,.aspect-row,.consequence-row{display:flex;gap:4px;align-items:center}
/* Make text inputs fill available space, number inputs fixed width */
.skill-row input[type=text], .stunt-row input, .aspect-row input, .consequence-row input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card);
  font-family: inherit;
  color: #222;
  box-sizing: border-box;
}
.skill-row input[type=number], .consequence-row input[type=number] {
  width: 32px;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card);
  font-family: inherit;
  color: #222;
  text-align: center;
  box-sizing: border-box;
  -moz-appearance: textfield;
}
.skill-row input[type=number]::-webkit-outer-spin-button,
.skill-row input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.skill-row button,.stunt-row button,.aspect-row button,.consequence-row button{padding:4px 6px;border-radius:6px;border:1px solid var(--border);background:transparent;font-size:13px;}
.stress-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.stress-box {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  background: var(--card);
}
.stress-box.filled::after {
  content: 'X';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #222;
  background: none;
  border-radius: 0;
  font-size: 20px;
  font-weight: bold;
}
.card-checkboxes{display:flex;justify-content:flex-end;gap:6px;margin-top:auto}
.checkbox{width:16px;height:16px;border:1px solid var(--border);border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:bold;}
.checkbox.boost{background:var(--accent-2);color:white;}
.checkbox.acted{background:#000;color:white;}
.checkbox.active{opacity:1;}
.checkbox.inactive{opacity:0.3;}
.stress-controls{display:flex;gap:6px;margin-top:4px}
.sortable-ghost {opacity:0.4;}
.sortable-chosen {background-color:#f0f0f0;}
.sortable-drag {border:2px dashed #007bff;}
footer{margin-top:18px;color:var(--muted);font-size:12px}
@media(max-width:880px){.cards-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:600px){.cards-grid{grid-template-columns:1fr}}
@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; min-height: unset; border-right: none; border-bottom: 1.5px solid var(--border); flex-direction: column; }
  .sidebar-tabs { flex-direction: row; }
  .sidebar-tab { border-bottom: 3px solid transparent; border-left: none; }
  .sidebar-tab.active { background: #e8eaf0; border-bottom: 3px solid var(--accent); border-left: none; }
}

/* --- DARK MODE FIXES --- */
body.dark-mode .sidebar-tabs,
body.dark-mode .sidebar-tab {
  background: #23262e !important;
  color: #e5e7eb !important;
  border-color: var(--border) !important;
}
body.dark-mode .sidebar-tab.active {
  background: #181a20 !important;
  color: var(--accent) !important;
  border-bottom: 3px solid var(--accent) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 1.5px 0 #23262e inset !important;
}
body.dark-mode .sidebar-tab:not(.active) {
  background: #23262e !important;
  color: #a0aec0 !important;
}

/* Dice roller fixes for dark mode */
body.dark-mode .gm-section {
  background: #23262e !important;
  color: #e5e7eb !important;
}
body.dark-mode .gm-section .dice-row,
body.dark-mode .gm-section .dice-container,
body.dark-mode .gm-section .dice-display-row {
  background: transparent !important;
}
body.dark-mode .gm-section .dice-row div,
body.dark-mode .gm-section .dice-container div,
body.dark-mode .gm-section .dice-display-row div {
  color: #e5e7eb !important;
}
body.dark-mode .gm-section .dice-display-row div {
  background: #23262e !important;
  color: #e5e7eb !important;
  border: 1.5px solid var(--border) !important;
}
body.dark-mode .gm-section .dice-display-row div[style*="background-color"] {
  background-color: #23262e !important;
  color: #e5e7eb !important;
}
body.dark-mode .gm-section .dice-container .result-box,
body.dark-mode .gm-section .result-box {
  background: #181a20 !important;
  color: #60a5fa !important;
  border: 1.5px solid var(--border) !important;
}

/* Dedicated style for x (remove) buttons: red, no border */
button.x-red {
  color: #e57373 !important;
  border: none !important;
  background: transparent;
}

/* All other ghost buttons (including -) keep their border */
.btn.ghost {
  color: var(--muted);
  border: 1.5px solid var(--border);
  background: transparent;
}

/* Wide View: widen the .app-inner area by about 20% more */
.app-inner {
  width: 70%;
  max-width: 1200px;
  margin: 32px auto 0 auto;
  transition: width 0.2s, max-width 0.2s;
}
.app-inner.wide-view {
  width: 95% !important;
  max-width: 95% !important;
  margin: 32px auto 0 auto !important;
  transition: width 0.2s, max-width 0.2s;
}
.app {
  max-width: 100vw;
  width: 100vw;
  margin: 0;
}
/* Smaller controls buttons */
.controls .btn, .controls .btn.ghost {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 7px;
}

/* Smaller -/+ buttons on cards */
.add-btn, .remove-btn, .x-red {
  padding: 1px 5px !important;
  font-size: 11px !important;
  border-radius: 5px !important;
  vertical-align: middle !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Hide -/+ buttons in minimal view */
.app-inner:not(.edit-mode) .add-btn,
.app-inner:not(.edit-mode) .remove-btn {
  display: none !important;
}
.app-inner:not(.edit-mode) .x-red {
  display: none !important;
}
.wa-row input {
  flex: 1;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card);
  font-family: inherit;
  color: #222;
  box-sizing: border-box;
}
.wa-row span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.6px;
  font-family: inherit;
  font-weight: 600;
}
.skill-row span,
.wa-row span {
  font-size: 12px !important;
  color: var(--muted) !important;
  letter-spacing: 0.6px !important;
  font-family: inherit !important;
  font-weight: 600 !important;
}
.app-inner.minimal-view .x-red {
  display: none !important;
}
.sidebar-content input[type="text"] {
  flex: 1;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card);
  font-family: inherit;
  color: #222;
  box-sizing: border-box;
}
.aspect-row input,
.stunt-row input {
  flex: 1;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card);
  font-family: inherit;
  color: #222;
  box-sizing: border-box;
  min-height: 32px;
  resize: none;
  overflow: hidden;
  transition: height 0.15s;
}
.aspect-row textarea,
.stunt-row textarea {
  flex: 1;
  padding: 4px 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--card);
  font-family: inherit;
  color: #222;
  box-sizing: border-box;
  min-height: 32px;
  max-height: 120px;
  resize: none;
  overflow: hidden;
  line-height: 1.2;
  transition: height 0.15s;
  white-space: normal;
  word-wrap: break-word;
}

/* Greyed out card for out of combat state */
.card.card-out-of-combat {
  opacity: 0.5;
  filter: grayscale(0.7);
}

/* GM Screen sections styling */
.gm-section {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.gm-section:last-child {
  margin-bottom: 0;
}

/* Minimalistic scrollbar styling for all scrollbars */
::-webkit-scrollbar {
  width: 2px;
  height: 2px;
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #dbeafe;
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: #b6d0f7;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* For Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: #dbeafe transparent;
}

/* Dark Mode Theme */
body.dark-mode {
  --bg: #181a20;
  --card: #23262e;
  --muted: #a0aec0;
  --accent: #60a5fa;
  --accent-2: #38bdf8;
  --border: #353945;
  color: #e5e7eb;
  background: var(--bg);
}
body.dark-mode .card,
body.dark-mode .db-explorer,
body.dark-mode .db-area,
body.dark-mode .sidebar,
body.dark-mode .controls,
body.dark-mode .gm-section {
  background: var(--card) !important;
  color: #e5e7eb !important;
  border-color: var(--border) !important;
}
body.dark-mode .db-row,
body.dark-mode .db-card-row,
body.dark-mode .db-folder-row,
body.dark-mode .db-card-item {
  background: var(--card) !important;
  color: #e5e7eb !important;
}
body.dark-mode .db-row:hover,
body.dark-mode .db-card-row:hover,
body.dark-mode .db-card-item:hover {
  background: #23262e !important;
}
body.dark-mode .db-btn,
body.dark-mode .db-btn-top,
body.dark-mode .db-btn-bottom {
  background: #23262e !important;
  color: var(--accent) !important;
  border-color: var(--border) !important;
}
body.dark-mode .db-btn:hover,
body.dark-mode .db-btn-top:hover,
body.dark-mode .db-btn-bottom:hover {
  background: #323644 !important;
  color: #38bdf8 !important;
}
body.dark-mode .card-header,
body.dark-mode .section-title {
  background: #23262e !important;
  color: #e5e7eb !important;
}
body.dark-mode .stress-box {
  background: #23262e !important;
  border-color: var(--border) !important;
}
body.dark-mode .stress-box.filled {
  background: #60a5fa !important;
  color: #181a20 !important;
}
body.dark-mode .consequence-row input {
  background: #23262e !important;
  color: #e5e7eb !important;
  border-color: var(--border) !important;
}
body.dark-mode textarea,
body.dark-mode input[type="text"],
body.dark-mode input[type="number"] {
  background: #23262e !important;
  color: #e5e7eb !important;
  border-color: var(--border) !important;
}
body.dark-mode .card-out-of-combat {
  opacity: 0.45 !important;
}
body.dark-mode .die-box {
  background: #23262e !important;
  color: #e5e7eb !important;
  border: 1.5px solid var(--border) !important;
}
body.dark-mode .result-box {
  background: #181a20 !important;
  color: #60a5fa !important;
  border: 1.5px solid var(--border) !important;
}
