.character-sheet {
  position: fixed;
  inset: 0;
  z-index: 1210;
  display: grid;
  place-items: center;
  font-family: "Courier New", monospace;
}

.character-sheet.hidden {
  display: none;
}

.character-sheet__scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 4, 5, 0.76);
  backdrop-filter: blur(8px);
}

.character-sheet__panel {
  position: relative;
  width: min(760px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 34px));
  overflow: auto;
  border: 1px solid rgba(202, 181, 145, 0.28);
  border-left: 4px solid #a44237;
  background:
    linear-gradient(145deg, rgba(37, 31, 27, 0.96), rgba(12, 14, 16, 0.985)),
    #121416;
  color: #ece5d9;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
  padding: clamp(22px, 4vw, 42px);
}

.character-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 20px;
}

.character-sheet__kicker {
  color: #a99c89;
  font-size: 10px;
  letter-spacing: 0.27em;
}

.character-sheet h2 {
  margin: 5px 0 0;
  font: 500 clamp(30px, 5vw, 52px)/1 Georgia, serif;
}

.character-sheet__close {
  border: 0;
  background: transparent;
  color: #b9ae9e;
  font: 300 34px/1 Arial, sans-serif;
  cursor: pointer;
}

.character-sheet__level {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 0 16px;
}

.character-sheet__level-number {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border: 1px solid rgba(214, 185, 132, 0.42);
  background: #191816;
  color: #d7b979;
  font: 700 32px/1 Georgia, serif;
}

.character-sheet__level-copy {
  display: grid;
  flex: 1;
  gap: 7px;
  color: #978c7c;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.character-sheet__xp-copy {
  color: #e2d8ca;
  font-size: 12px;
}

.character-sheet__xp-track,
.character-sheet__stat-track {
  position: relative;
  height: 7px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.character-sheet__xp-fill,
.character-sheet__stat-track > div {
  height: 100%;
  background: linear-gradient(90deg, #7e332d, #c06a48);
}

.character-sheet__summary {
  margin: 0 0 20px;
  color: #bcb1a3;
  font: 15px/1.55 Georgia, serif;
}

.character-sheet__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.character-sheet__stat {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
  padding: 14px;
}

.character-sheet__stat-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #dcd3c7;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.character-sheet__stat-heading span {
  color: #d7b979;
}

.character-sheet__stat-track {
  height: 5px;
}

.character-sheet__stat-track > div {
  background: #8c4939;
}

.character-sheet__stat-track i {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 9px;
  background: #e9cf99;
  opacity: 0.72;
}

.character-sheet__stat p {
  margin: 9px 0 3px;
  color: #c2b6a7;
  font: 13px/1.35 Georgia, serif;
}

.character-sheet__stat small {
  color: #746e66;
  font-size: 10px;
  line-height: 1.35;
}

.character-sheet footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 22px;
  color: #756f67;
  font-size: 10px;
}

.character-sheet footer span {
  margin-right: auto;
}

.character-sheet kbd {
  border: 1px solid #5d574f;
  padding: 3px 6px;
  background: #18191a;
  color: #c4baaa;
}

html[data-visual-style="pixel-3d"] .character-sheet {
  font-family: "VT323", "Courier New", monospace;
  font-size: 19px;
}

html[data-visual-style="pixel-3d"] .character-sheet__scrim {
  background: rgba(2, 2, 3, 0.86);
  backdrop-filter: none;
}

html[data-visual-style="pixel-3d"] .character-sheet__panel {
  border: 4px solid #d6cebf;
  border-radius: 0;
  background: #111114;
  box-shadow: 9px 9px 0 #030303;
}

html[data-visual-style="pixel-3d"] .character-sheet h2 {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(15px, 2.3vw, 24px);
  text-shadow: 4px 4px 0 #000;
}

html[data-visual-style="pixel-3d"] :is(
  .character-sheet__close,
  .character-sheet__level,
  .character-sheet__xp-track,
  .character-sheet__stat-track,
  .character-sheet__stat,
  .character-sheet kbd
) {
  border-radius: 0;
}

html[data-visual-style="pixel-3d"] .character-sheet__close {
  border: 2px solid #d6cebf;
  background: #1a1a1d;
  box-shadow: 3px 3px 0 #030303;
}

html[data-visual-style="pixel-3d"] .character-sheet__stat {
  border: 2px solid #57534d;
  background: #18181b;
  box-shadow: 4px 4px 0 #030303;
}

body.character-sheet-open #game {
  filter: saturate(0.72) brightness(0.66);
}

@media (max-width: 620px) {
  .character-sheet__stats {
    grid-template-columns: 1fr;
  }
}
