/* Page base */
html, body {
  margin: 0;
  padding: 0;
}
body {
  background: #f7f7f7;
  color: #222;
  font-family: 'Georgia', 'Times New Roman', serif;
}

/* Base link styles: no underline, dark/strong weight, prevent purple visited, subtle hover */
a, a:link, a:visited {
  color: #181818;
  text-decoration: none;
  font-weight: 700;
  transition: color .14s ease, opacity .14s ease;
}
a:visited { color: #181818; }
a:hover, a:focus { color: #111; opacity: 0.95; }

/* Header container and link/button defaults */
.lakeblood-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.lakeblood-header h1 { margin: 0; font-size: 2em; text-align: left; color: #181818; font-family: inherit; }
.lakeblood-header nav { text-align: right; }
.lakeblood-header nav a { margin-left: 2em; text-decoration: none; }
.lakeblood-header .header-login { background: #4169E1; color: #fff; border: none; padding: 0.5em 1.2em; border-radius: 4px; cursor: pointer; font-weight: bold; margin-left: 2em; }
.lakeblood-header.scrolled { box-shadow: 0 8px 30px rgba(0,0,0,0.06); background: rgba(255,255,255,0.98); }
.lakeblood-header nav a.active { text-decoration: underline; font-weight: 700; }

/* Header tweaks to match light theme */
.lakeblood-header nav a {
  color: #222 !important;
  text-decoration: none;
}
.lakeblood-header nav a + a { margin-left: 2em; }
.lakeblood-header nav button {
  background: #fff !important;
  color: #222 !important;
  border-radius: 0 !important;
  border: 1px solid #888 !important;
  padding: 0.3em 0.8em !important;
  font-size: 1em !important;
  font-weight: 500 !important;
  margin-left: 2em !important;
  cursor: pointer;
}

/* Layout */
.dossier-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 48px;
}
.character-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin: 24px 0;
  background: #fff;
  border: 2px solid #222;
  box-shadow: 4px 4px 0 #222;
}
.character-controls .controls-left,
.character-controls .controls-right { display: flex; align-items: center; gap: 10px; }
.character-controls label { font-size: 0.9em; color: #222; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.character-controls select, .character-controls input[type="search"] {
  padding: 10px 12px;
  border: 2px solid #222;
  background: #fff;
  border-radius: 0;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: 500;
}
.character-controls select:focus, .character-controls input[type="search"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.1);
}
.character-controls input[type="search"] { min-width: 240px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
}

/* Card */
.character-card {
  --character-color: #888;
  background: #fff;
  border: 2px solid #222;
  box-shadow: 6px 6px 0 #222;
  padding: 20px;
  border-radius: 0;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}
.character-card::before {
  content: "";
  position: absolute;
  left: 0; 
  top: 0; 
  bottom: 0;
  width: 6px;
  background: var(--character-color);
  opacity: 1;
}
.character-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #222;
  cursor: pointer;
}
.character-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 10px;
}
.char-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #eee center/cover no-repeat;
  flex: 0 0 64px;
  background-size: cover;
  border: 3px solid #222;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.character-name {
  margin: 0 0 4px 0;
  font-size: 1.3em;
  color: #181818;
  font-weight: 700;
  line-height: 1.2;
}
.character-meta {
  margin: 0;
  font-size: 0.95em;
  color: #555;
  font-weight: 500;
}
.character-title {
  margin: 4px 0 0 0;
  color: #666;
  font-style: italic;
  font-size: 0.9em;
}

/* Quick stats row */
.card-top { display:flex; gap:12px; align-items:center; flex-wrap: wrap; }
.card-subbar { display:flex; gap:10px; align-items:center; flex-wrap: wrap; }
.character-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  align-items: start;
  padding-left: 10px;
}
.card-left { 
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-right { 
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.character-stats {
  display: flex;
  gap: 10px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.hp-ac-row { display:flex; gap:10px; align-items:center; margin:10px 0; flex-wrap: wrap; }
.badge { 
  padding: 8px 12px; 
  border-radius: 0; 
  background: #fafafa; 
  border: 2px solid #222; 
  font-weight: 700; 
  font-size: 0.9em;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}
.badge.small { 
  padding: 6px 10px; 
  font-weight: 600; 
  font-size: 0.85em; 
}
.stat-box {
  background: #fff;
  border: 2px solid #222;
  padding: 12px;
  text-align: center;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.stat-label { font-size: 0.75em; color: #666; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-weight: 700; font-size: 1.1em; margin-top: 4px; }

/* Ability scores mini grid */
.ability-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ability-score {
  background: #fff;
  border: 2px solid #222;
  padding: 10px;
  text-align: center;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.ability-label { 
  font-size: 0.7em; 
  color: #666; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
  font-weight: 700;
}
.ability-value { 
  font-weight: 700; 
  font-size: 1.2em; 
  margin-top: 4px;
}
.ability-value .modifier { 
  margin-left: 6px; 
  color: #888; 
  font-weight: 600; 
  font-size: 0.85em; 
}

.saves-row { display:flex; gap:8px; align-items:center; flex-wrap: wrap; }
.save-item { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  background: #fff; 
  border: 2px solid #222; 
  padding: 8px 12px; 
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.save-label { font-size: 0.8em; color: #666; font-weight: 600; text-transform: uppercase; }
.save-value { font-weight: 700; }
.save-value.proficient { color: var(--character-color); }

/* Saving throws layout: title centered over number */
.saves-grid .save-item { display: flex; flex-direction: column; align-items: center; padding: 6px 10px; gap: 6px; border-radius: 0; }
.saves-grid .save-title { font-size: 0.8em; color: #333; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.saves-grid .save-value { font-size: 1.1em; color: #111; }
.saves-section {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 6px;
}
.skills-box {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Inline currency under HP/AC */
.currency-inline { display: flex; gap: 8px; margin-left: 12px; align-items: center; }
.currency-inline .currency-item.small { border: 1px solid #222; padding: 4px 6px; background: #fff; font-weight: 700; font-size: 0.85em; box-shadow: 1px 1px 0 rgba(0,0,0,0.06); }
.currency-inline .currency-label { margin-right: 6px; color: #444; font-weight: 600; }

/* Make skill names smaller and prevent wrapping */
.skill-cell .skill-name { font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 70%; }
.skill-cell .skill-bonus { font-size: 0.95em; margin-left: 8px; }

.skills-list.compact .skill-row { 
  display: flex; 
  justify-content: space-between; 
  padding: 8px 10px; 
  border-bottom: 1px solid #e0e0e0; 
  background: #fafafa;
  margin-bottom: 4px;
}
.skills-list.compact .skill-row:last-child { border-bottom: none; margin-bottom: 0; }
.skills-list.compact .skill-name { color: #333; font-weight: 500; }
.skills-list.compact .skill-bonus { font-weight: 700; }

/* Skills box: tight grid for top 6 skills */
.skills-box .skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.skills-box .skill-cell { display: flex; justify-content: space-between; padding: 6px 8px; border: 1px solid #e6e6e6; background: #fff; }
.skills-box h4 { margin: 0 0 8px 0; text-transform: uppercase; letter-spacing: 0.6px; }

.currency-vertical.compact { display: grid; gap: 8px; }
.currency-item { 
  display: flex; 
  justify-content: space-between; 
  border: 2px solid #222; 
  padding: 8px 12px; 
  border-radius: 0;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.saves-grid { display:grid; grid-template-columns: repeat(3, 1fr); gap:8px; margin-top:8px; }
.save-item { justify-content:space-between; }
.ability-label { font-size: 0.8em; color: #777; }
.ability-value { font-weight: 700; }
.ability-value .modifier { margin-left: 6px; color: #888; font-weight: 500; }

/* Expanded sheet */
.character-card.expanded {
  position: fixed;
  z-index: 1000;
  left: 50%;
  top: 5vh;
  transform: translateX(-50%);
  width: min(1100px, 94vw);
  max-height: 90vh;
  overflow: auto;
  padding: 32px;
  box-shadow: 12px 12px 0 #222, 0 0 0 100vmax rgba(0,0,0,0.4);
  border: 3px solid #222;
  background: #fff;
}
.sheet-header { margin-left: 0; padding-bottom: 20px; border-bottom: 3px solid #222; margin-bottom: 24px; }
.sheet-header .character-name { font-size: 2em; margin-bottom: 8px; }
.sheet-header .header-row { display: flex; gap: 16px; flex-wrap: wrap; color: #555; font-weight: 500; }

.sheet-content { display: grid; grid-template-columns: 1fr; gap: 24px; }
.stats-row { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr; gap: 20px; }
.stat-section { 
  background: #fafafa; 
  border: 2px solid #222; 
  padding: 16px; 
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}
.stat-section h3 {
  margin: 0 0 12px 0;
  font-size: 1.1em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #222;
  padding-bottom: 8px;
}

/* Utility class to remove boxing around simple inline sections */
.stat-section.no-box {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Compact presentation for saving throws and skills (no surrounding box) */
.stat-section.no-box .saves-grid { margin-top: 6px; }
.stat-section.no-box .save-item {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  gap: 8px;
  justify-content: flex-start;
}
.stat-section.no-box .save-label { font-weight: 700; color: #333; margin-right: 8px; }
.stat-section.no-box .save-value { font-weight: 700; color: #111; }

.stat-section.no-box.skills-section .skills-list.compact .skill-row {
  border: none;
  background: transparent;
  padding: 6px 0;
  display: flex;
  justify-content: space-between;
}
.skills-section .skill-name { color: #333; font-weight: 600; }
.skills-section .skill-bonus { font-weight: 700; }

/* Compact currency container used opposite saving throws */
.currency-compact {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 8px;
}
.currency-compact .currency-vertical {
  display: flex;
  gap: 8px;
}
.currency-compact .currency-item {
  border: 1px solid #222;
  padding: 6px 8px;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.08);
  font-weight: 700;
  font-size: 0.95em;
}
.currency-compact .currency-label { margin-right: 6px; color: #444; font-weight: 600; }
.currency-compact .currency-value { color: #111; }

/* full styling restored for expanded character sheet */
.character-card.expanded .stat-section { background: #fafafa; border: 2px solid #222; padding: 16px; }

.ability-scores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ability-full { 
  display: grid; 
  grid-template-columns: 1fr auto; 
  align-items: center; 
  gap: 12px; 
  border: 2px solid #222; 
  padding: 12px; 
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.ability-name { font-weight: 700; color: #222; text-transform: uppercase; font-size: 0.85em; letter-spacing: 0.5px; }
.ability-score-large { font-size: 1.6em; font-weight: 700; }
.ability-modifier-large { font-size: 1.2em; color: #666; text-align: right; font-weight: 600; }
.save-bonus.proficient { color: var(--character-color); font-weight: 700; }

.combat-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.combat-stat { 
  border: 2px solid #222; 
  padding: 14px; 
  text-align: center; 
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.stat-value-large { font-size: 1.6em; font-weight: 700; margin-top: 6px; }

.currency-box .currency-vertical { display: grid; gap: 10px; }
.currency-item { 
  display: flex; 
  justify-content: space-between; 
  border: 2px solid #222; 
  padding: 10px 14px; 
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.currency-item.gold .currency-label { color: #b8860b; font-weight: 700; }
.currency-item.silver .currency-label { color: #666; font-weight: 700; }
.currency-item.copper .currency-label { color: #a0522d; font-weight: 700; }

.skills-list { display: grid; gap: 8px; }
.skill-row { 
  display: grid; 
  grid-template-columns: auto 1fr auto; 
  align-items: center; 
  gap: 10px; 
  border: 2px solid #e0e0e0; 
  padding: 10px 12px; 
  background: #fff;
}
.skill-row.proficient { border-color: var(--character-color); border-width: 2px; background: #fafafa; }
.skill-prof { color: var(--character-color); font-weight: 700; }
.skill-name { color: #333; font-weight: 500; }
.skill-bonus { font-weight: 700; }

.equipment-list, .features-list { display: grid; gap: 10px; }
.equipment-item, .feature-item { 
  border: 2px solid #e0e0e0; 
  padding: 12px; 
  background: #fff;
}
.equipment-item h4, .feature-item h4 {
  margin: 0 0 6px 0;
  font-size: 1em;
  font-weight: 700;
}

/* Remove inner box footprint overrides - we want proper boxes now */
.character-card .skill-row, 
.character-card .currency-item, 
.character-card .save-item {
  /* restored to default styling above */
}

/* Make inner wrappers behave properly with newspaper aesthetic */
.card-top-text { display: flex; flex-direction: column; gap: 4px; }
.card-top, .card-subbar { gap: 10px; align-items: center; }

/* Ensure images and avatar backgrounds never overflow their containers */
.character-card img, .char-avatar { max-width: 100%; height: auto; box-sizing: border-box; }

/* Spacing normalization for clean layout */
.character-card > * { margin: 0; }

/* Overlay backdrop when expanded */
body.character-expanded::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 900;
}

/* Close button for expanded view */
.character-card.expanded::after {
  content: "×";
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 2.5em;
  font-weight: 300;
  color: #222;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #222;
  background: #fff;
  line-height: 1;
  transition: all 0.2s ease;
}
.character-card.expanded::after:hover {
  background: #222;
  color: #fff;
}

/* Name color references for floating moments and elsewhere */
.name-color { opacity: 0.82; }
.char-soot { color: #3E2A23; }
.char-skillet { color: #3D3D3D; }
.char-nereus-flo, .char-nereus { color: #87CEEB; }
.char-scutebeard-iii, .char-scutebeard { color: #2E8B57; }
.char-briar-snug, .char-briar { color: #9370DB; }
.char-amon-blank, .char-amon { color: #8B0000; }
.char-hadarai-elf-man, .char-hadarai { color: #9FBC9F; }
.char-balasaar-of-the-grove, .char-balasaar { color: #D2691E; }
.char-enforcer-lox, .char-lox { color: #4169E1; }

/* Make sure colored names inside floating bits don't look like links */
.moment-bit .name-color { text-decoration: none; font-weight: 500; }

@media (max-width: 980px) {
  .stats-row { grid-template-columns: 1fr; }
  .character-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 760px) {
  .character-card { flex-direction: column; }
  .character-body { grid-template-columns: 1fr; }
  .card-right { width: 100%; }
  .character-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .character-controls .controls-left,
  .character-controls .controls-right {
    width: 100%;
    justify-content: space-between;
  }
  .ability-scores {
    grid-template-columns: repeat(2, 1fr);
  }
  .character-grid {
    grid-template-columns: 1fr;
  }
  .character-card.expanded {
    width: 96vw;
    padding: 20px;
  }
}
