:root {
  --bg: #100d17;
  --panel: #1b1623;
  --panel2: #241d2d;
  --gold: #d8b46a;
  --bright: #ffe1a0;
  --text: #f1e9dc;
  --muted: #a79aab;
  --red: #e65e63;
  --green: #74c69d;
  --border: rgba(216, 180, 106, .25);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Trebuchet MS", Arial, sans-serif;
  scrollbar-color: #816638 var(--bg);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: #816638;
  border-radius: 8px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  color: var(--text);
}

button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--bright);
  outline-offset: 2px;
}

.app {
  max-width: 1700px;
  margin: auto;
  padding: 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 5px 2px 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid var(--gold);
  border-radius: 12px;
  color: var(--bright);
  font-size: 27px;
  background: linear-gradient(135deg, #382b3b, #17121d);
}

h1 {
  font: clamp(17px, 2.4vw, 28px) Georgia, serif;
  letter-spacing: 1px;
  margin: 0;
}

.subtitle,
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  color: var(--muted);
}

.subtitle {
  margin-top: 5px;
}

.btn {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
}

.btn:hover {
  border-color: var(--gold);
  background: #332738;
}

.btn.gold {
  background: #6c5127;
  border-color: var(--gold);
  color: #fff1ce;
}

.btn.danger {
  color: #ffaaaa;
  border-color: #a33c46;
}

.btn.small {
  padding: 6px 9px;
  font-size: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row>* {
  min-width: 0;
}

.nav {
  display: flex;
  gap: 7px;
  padding: 14px 0;
  overflow-x: auto;
}

.nav button {
  flex: 1;
  min-width: max-content;
  background: #1b1623;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 15px;
  color: var(--muted);
}

.nav button.active {
  background: #4a3545;
  border-color: var(--gold);
  color: var(--bright);
}

.nav-icon {
  margin-right: 7px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fade .2s ease;
}

@keyframes fade {
  from {
    opacity: .5;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.panel {
  background: linear-gradient(145deg, #211a2a, #17131e 80%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.panel+.panel {
  margin-top: 15px;
}

.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.heading h2 {
  font: 20px Georgia, serif;
  color: var(--bright);
  margin: 3px 0 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 15px;
}

.stat {
  text-align: center;
  padding: 12px 4px;
  background: #100d17;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stat strong {
  display: block;
  font: 26px Georgia, serif;
  color: var(--bright);
}

.stat span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
}

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

.character {
  background: linear-gradient(135deg, #292130, #19151f);
  border: 1px solid #443347;
  border-radius: 10px;
  padding: 12px;
  min-width: 0;
}

.character.active-turn {
  border-color: var(--gold);
  box-shadow: 0 0 17px #d8b46a12;
}

.character.down {
  border-color: #a83f49;
  background: #301b26;
}

.char-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.avatar {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #34283b;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 23px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-name {
  font: 17px Georgia, serif;
  overflow-wrap: anywhere;
}

.char-class {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.init-badge {
  margin-left: auto;
  text-align: center;
  flex-shrink: 0;
}

.init-badge strong {
  font-size: 19px;
  color: var(--bright);
}

.init-badge small,
.ac-badge small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
}

.ac-badge {
  min-width: 48px;
  text-align: center;
  padding: 5px 7px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #100d17;
  flex-shrink: 0;
}

.ac-badge strong {
  display: block;
  font: 22px Georgia, serif;
  color: var(--bright);
}

.ac-badge small {
  letter-spacing: 1px;
}

.hp-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.hp-value {
  font-weight: bold;
  font-size: 20px;
}

.hp-value small {
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
}

.hp-track {
  height: 9px;
  border-radius: 8px;
  background: #0d0a11;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  background: var(--green);
  transition: width .3s, background .3s;
}

.hp-fill.mid {
  background: #e7bd60;
}

.hp-fill.low {
  background: var(--red);
}

.ac-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin: 12px 0 5px;
}

.ac-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ac-actions .btn {
  min-width: 32px;
  padding: 5px 9px;
}

.ac-number {
  font-weight: bold;
  color: var(--bright);
  font-size: 14px;
  min-width: 42px;
  text-align: center;
}

.conditions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.condition {
  font-size: 10px;
  color: #f0d8a2;
  background: #5b452d;
  border-radius: 4px;
  padding: 4px 6px;
}

.char-actions {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.char-actions .btn {
  flex: 1;
  padding: 7px 3px;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 28px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

input,
select {
  width: 100%;
  min-width: 0;
  background: #100d17;
  color: var(--text);
  border: 1px solid #4b3b51;
  border-radius: 6px;
  padding: 10px;
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field label {
  font-size: 11px;
  color: var(--muted);
}

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

.full {
  grid-column: 1 / -1;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 15px 0;
}

.message {
  font-size: 11px;
  color: var(--green);
  min-height: 16px;
  margin-top: 8px;
}

.initiative-list {
  display: grid;
  gap: 7px;
}

.initiative-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #100d17;
  border: 1px solid #392d40;
  border-radius: 7px;
  padding: 9px;
}

.initiative-row.current {
  border-color: var(--gold);
  background: #46342155;
}

.init-number {
  width: 37px;
  height: 37px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #312438;
  color: var(--bright);
  font-weight: bold;
}

.initiative-row.current .init-number {
  background: #76572b;
}

.init-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.init-name small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}

.round {
  font: 34px Georgia, serif;
  color: var(--bright);
  text-align: center;
  background: #100d17;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.round small {
  display: block;
  font: 10px Arial, sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.dice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 15px;
}

.dice-stage {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(ellipse at center, #49304d66, transparent 65%), #100d17;
  border: 1px solid #48364f;
  border-radius: 10px;
  padding: 16px;
}

.dice-visuals {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.die {
  width: 67px;
  height: 67px;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 17px;
  background: linear-gradient(145deg, #453047, #1d1728);
  color: var(--bright);
  font-size: 29px;
  font-weight: bold;
  box-shadow: 0 0 22px #d8b46a18;
}

.die.rolling {
  animation: roll .65s ease-in-out;
}

@keyframes roll {
  0% {
    transform: rotate(0) scale(1);
  }

  25% {
    transform: rotate(100deg) scale(.8);
  }

  50% {
    transform: rotate(220deg) scale(1.1);
  }

  75% {
    transform: rotate(310deg) scale(.9);
  }

  100% {
    transform: rotate(360deg) scale(1);
  }
}

.dice-result {
  font: 28px Georgia, serif;
  color: var(--bright);
  margin-top: 14px;
}

.dice-detail {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  min-height: 15px;
  overflow-wrap: anywhere;
}

.dice-types {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.dice-btn {
  background: #201927;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 4px;
}

.dice-btn.selected,
.dice-btn:hover {
  border-color: var(--gold);
  background: #4a3545;
  color: var(--bright);
}

.dice-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0;
}

.mode-btn {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #201927;
  padding: 10px 3px;
  font-size: 12px;
}

.mode-btn.selected {
  background: #5b452d;
  border-color: var(--gold);
  color: var(--bright);
}

.roll-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.roll-chip {
  border: 1px solid #45364b;
  border-radius: 5px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
}

.roll-chip.critical {
  color: var(--bright);
  border-color: var(--gold);
}

.roll-chip.fumble {
  color: #ff9999;
  border-color: #9e444b;
}

.encounter-title {
  font: clamp(22px, 3vw, 34px) Georgia, serif;
  color: var(--bright);
  margin: 0;
  overflow-wrap: anywhere;
}

.encounter-banner {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: radial-gradient(ellipse at top, #49304d66, transparent 80%), #100d17;
}

.hidden {
  display: none !important;
}

/* D&D lookup reference */
.lookup-description {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 8px 0 14px;
}

.lookup-frame {
  margin-top: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #100d17;
}

.lookup-frame-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
}

.lookup-frame-header span {
  color: var(--bright);
  font-size: 12px;
}

.lookup-frame iframe {
  display: block;
  width: 100%;
  height: 75vh;
  min-height: 400px;
  border: 0;
  background: #fff;
}

.lookup-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

body.player-view .dm-only {
  display: none !important;
}

body.player-view .app {
  padding: 10px;
}

body.player-view .panel {
  padding: 12px;
}

footer {
  text-align: center;
  color: #74677a;
  font-size: 10px;
  letter-spacing: 1px;
  padding: 20px 0 5px;
}

footer a {
  color: var(--gold);
  margin-left: 8px;
}

@media (max-width: 700px) {
  .dice-layout {
    grid-template-columns: 1fr;
  }

  .party {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .lookup-frame iframe {
    height: 70vh;
    min-height: 350px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 10px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
  }

  header {
    align-items: flex-start;
  }

  .subtitle {
    letter-spacing: 1px;
  }

  .header-action {
    padding: 7px;
    font-size: 11px;
  }

  .panel {
    padding: 12px;
  }

  .nav button {
    padding: 11px 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full {
    grid-column: auto;
  }
}

/* Page-specific styles moved from the D&D page. */
.join-code-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 204, 102, .45);
  border-radius: 9px;
  background: rgba(255, 204, 102, .09);
  color: #ffcc66;
  font-weight: 700;
  letter-spacing: .08em;
  white-space: nowrap;
  cursor: pointer;
}

.join-code-display.hidden {
  display: none;
}

.player-view #hostButton {
  display: none !important;
}

#hostButton {
  flex: 0 1 210px;
  width: auto;
  min-width: 0;
  max-width: 210px;
  min-height: 40px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
}

#joinButton {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 10px 14px;
  font-size: 13px;
}

body.remote-player #viewButton {
  display: none !important;
}

body.remote-player .nav button[data-page="tools"],
body.remote-player #page-tools {
  display: none !important;
}

@media (max-width: 560px) {
  header>.row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  #hostButton,
  #joinButton {
    flex: 1 1 140px;
    max-width: none;
  }

  #joinCodeDisplay {
    flex: 1 1 100%;
    justify-content: center;
  }
}

.init-edit {
  color: inherit;
  font: inherit;
  cursor: pointer;
  border: 1px solid rgba(216, 180, 106, .25);
  background: rgba(216, 180, 106, .08);
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid rgba(216, 180, 106, .42);
  border-radius: 999px;
  color: var(--bright, #ffe1a0);
  background: rgba(216, 180, 106, .10);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.sheet-actions .btn {
  flex: 1;
}

.sheet-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2vw, 24px);
  background: rgba(4, 3, 8, .88);
}

.sheet-modal.hidden {
  display: none !important;
}

.sheet-modal-panel {
  display: flex;
  flex-direction: column;
  width: min(1500px, 100%);
  height: min(94vh, 1100px);
  background: var(--panel, #1b1623);
  border: 1px solid rgba(216, 180, 106, .45);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px #0009;
}

.sheet-modal-header,
.sheet-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.sheet-modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.sheet-modal-header h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

#fullSheetFrame {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}

.sheet-modal-footer {
  border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: 12px;
  color: var(--muted, #b7b0c4);
}

body.sheet-open {
  overflow: hidden;
}

@media(max-width:600px) {
  .sheet-modal {
    padding: 0;
  }

  .sheet-modal-panel {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .sheet-modal-header h2 {
    font-size: 16px;
  }

  .sheet-modal-footer {
    padding: 8px;
  }
}

.initiative-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.initiative-portrait {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(216, 180, 106, .12);
  border: 1px solid rgba(216, 180, 106, .3);
  font-size: 24px;
}

.initiative-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.initiative-row .init-name {
  flex: 1;
  min-width: 0;
}

.initiative-hp-track {
  width: 100%;
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .10);
}

.initiative-hp-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gold, #d8b46a);
  transition: width .2s ease;
}

.initiative-hp-fill.mid {
  background: #e7a64b;
}

.initiative-hp-fill.low {
  background: #d65c68;
}

.initiative-claim {
  flex: 0 0 auto;
  white-space: nowrap;
}

.player-claim-actions {
  margin-top: 10px;
  justify-content: flex-end;
}

.player-claim-actions .initiative-claim {
  min-width: 105px;
}

.encounter-creatures {
  margin-top: 14px;
}

.creature-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(216, 180, 106, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  margin-top: 8px;
}

.creature-card .creature-info {
  flex: 1;
  min-width: 0;
}

.creature-card .creature-info strong {
  display: block;
}

.creature-card .creature-info small {
  color: var(--muted, #b7b0c4);
}

.creature-card .creature-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.creature-card .creature-icon {
  font-size: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  max-width: 64px;
  max-height: 64px;
  overflow: hidden;
}

.creature-card .creature-icon img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
}

.ac-line {
  display: none !important;
}

.adventure-text-display {
  margin-top: 14px;
  padding: 16px;
  min-height: 72px;
  border: 1px solid rgba(216, 180, 106, .25);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  color: var(--text, #eee7f7);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.adventure-text-display:empty::before {
  content: "No adventure details have been added yet.";
  color: var(--muted, #b7b0c4);
}

.battlemap-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start
}

.battlemap-controls {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(216, 180, 106, .24);
  border-radius: 12px;
  background: rgba(0, 0, 0, .12)
}

.battlemap-controls .field {
  margin: 0
}

.battlemap-controls .btn {
  width: 100%
}

.battlemap-controls .row {
  display: flex;
  gap: 8px
}

.battlemap-controls .row>* {
  flex: 1;
  min-width: 0
}

.battlemap-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px
}

.battlemap-check input {
  accent-color: var(--gold, #d8b46a);
  width: 17px;
  height: 17px
}

.battlemap-board-wrap {
  min-width: 0
}

.battlemap-board {
  position: relative;
  isolation: isolate;
  min-height: 500px;
  height: min(72vh, 850px);
  overflow: hidden;
  border: 1px solid rgba(216, 180, 106, .4);
  border-radius: 12px;
  background-color: #15121b;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  touch-action: none
}

.battlemap-grid,
.battlemap-tokens {
  position: absolute;
  inset: 0
}

.battlemap-grid {
  pointer-events: none;
  z-index: 1;
  background-image: linear-gradient(to right, rgba(255, 255, 255, .3) 1px, transparent 1px), linear-gradient(to bottom,
      rgba(255, 255, 255, .3) 1px, transparent 1px);
  background-size: 32px 32px
}

.battlemap-grid.off {
  display: none
}

.battlemap-tokens {
  z-index: 2;
  pointer-events: none
}

.battle-token {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  border: 3px solid var(--gold, #d8b46a);
  border-radius: 50%;
  background: #191323;
  color: white;
  box-shadow: 0 3px 12px #000b;
  cursor: grab;
  user-select: none;
  touch-action: none;
  pointer-events: auto;
  padding: 2px
}

.battle-token.hero {
  border-color: #62b9ff
}

.battle-token.creature {
  border-color: #e96b73
}

.battle-token:active {
  cursor: grabbing;
  z-index: 20;
  box-shadow: 0 0 0 3px #ffcc6688, 0 6px 18px #000c
}

.battle-token img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none
}

.battle-token .token-emoji {
  font-size: 28px;
  line-height: 1;
  pointer-events: none
}

.battle-token .token-label {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 5px;
  border-radius: 4px;
  background: #100d17ef;
  color: #fff;
  font-size: 10px;
  line-height: 1.3;
  pointer-events: none
}

.battlemap-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
  color: #b7b0c4;
  pointer-events: none;
  z-index: 0
}

.battlemap-empty.hidden {
  display: none
}

.battlemap-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 2px;
  color: var(--muted, #b7b0c4);
  font-size: 12px
}

@media(max-width:850px) {
  .battlemap-layout {
    grid-template-columns: 1fr
  }

  .battlemap-board {
    height: 62vh;
    min-height: 360px
  }

  .battlemap-controls {
    order: 2
  }

  .battlemap-board-wrap {
    order: 1
  }
}

/* Mobile app-style bottom navigation, inspired by the linked animated tab bar. */
@media (max-width: 700px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }

  .app {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .nav {
    position: fixed !important;
    z-index: 9990;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto !important;
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    gap: 2px;
    margin: 0 !important;
    padding: 8px 5px 7px !important;
    border: 1px solid rgba(216, 180, 106, .3);
    border-radius: 22px;
    background: rgba(20, 15, 31, .96) !important;
    box-shadow: 0 8px 30px #0009, inset 0 1px rgba(255, 255, 255, .06);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .nav button {
    position: relative;
    min-width: 0 !important;
    min-height: 55px;
    margin: 0 !important;
    padding: 7px 1px 5px !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0 !important;
    border-radius: 15px !important;
    background: transparent !important;
    color: #b7b0c4 !important;
    font-size: 9px !important;
    line-height: 1.1;
    font-weight: 700;
    white-space: nowrap;
    overflow: visible;
    box-shadow: none !important;
    transition: transform .22s ease, color .22s ease, background .22s ease;
  }

  .nav button .nav-icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 30px;
    border-radius: 11px;
    font-size: 19px;
    line-height: 1;
    transition: transform .22s ease, background .22s ease, box-shadow .22s ease;
  }

  .nav button.active {
    color: #ffe1a0 !important;
    transform: translateY(-5px);
    background: transparent !important;
  }

  .nav button.active .nav-icon {
    transform: translateY(-2px) scale(1.08);
    background: linear-gradient(145deg, #d8b46a, #8d6bce);
    color: #100d17;
    box-shadow: 0 4px 14px rgba(216, 180, 106, .3);
  }

  .nav button:focus-visible {
    outline: 2px solid #ffe1a0;
    outline-offset: -2px;
  }

  body.remote-player .nav button[data-page="tools"] {
    display: none !important;
  }

  body.remote-player .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  header {
    padding-bottom: 10px;
  }

  main {
    padding-bottom: 8px;
  }

  footer {
    margin-bottom: 8px;
  }
}

@media (max-width: 370px) {
  .nav {
    left: 5px;
    right: 5px;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  .nav button {
    font-size: 8px !important;
  }

  .nav button .nav-icon {
    width: 28px;
    font-size: 17px;
  }
}

/* Former inline style attributes */
.header-session-actions {
  margin-bottom: 12px;
  align-items: center;
}

.mt-15 {
  margin-top: 15px;
}

.roll-button-large {
  width: 100%;
  padding: 13px;
}

.mt-20 {
  margin-top: 20px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-10 {
  margin-top: 10px;
}

.mt-6 {
  margin-top: 6px;
}

.text-no-decoration {
  text-decoration: none;
}

.flex-fill-min-zero {
  flex: 1;
  min-width: 0;
}