html {
  height: 100%;
  width: 100%;
}

body {
  margin: 20px;
  font-family: Arial, sans-serif;
}

.tab-container {
  width: 100%;
}

.tab-buttons {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  border-bottom: 2px solid #ddd;
}

.tab-button {
  padding: 10px 20px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-bottom: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.tab-button:hover {
  background-color: #e0e0e0;
}

.tab-button.active {
  background-color: #add8e6;
  border-bottom: 2px solid #add8e6;
  margin-bottom: -2px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.name-section {
  width: 100%;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #ddd;
}

td {
  padding: 3px;
  vertical-align: middle;
  border: 1px solid #ddd;
  font-size: 14px;
}

/* Smaller font for specific header cells */
td:has(.barehand-input),
td:has(.dagger-input),
td:has(.NatArmordef) {
  font-size: 11px;
}

.label-cell {
  font-weight: bold;
  text-align: right;
  padding-right: 10px;
}

td {
  text-align: left;
}

td:has(+ td > .weightInPack) {
  text-align: right;
}

.name-input {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
}

.race-dropdown,
.class-dropdown {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
}

td:has(.race-dropdown),
td:has(.class-dropdown) {
  background-color: #add8e6;
}

.points-input {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
}

input,
select {
  border: 1px solid #ccc;
  /* border-radius: 4px; */
}

.base-stats-section {
  width: 100%;
  margin: 20px 0;
}

.light-blue-header {
  background-color: #add8e6;
  font-weight: bold;
  text-align: center;
}

.light-blue-field {
  background-color: #add8e6;
}

input[readonly] {
  background-color: #f0f0f0;
  cursor: not-allowed;
}

.ST-base,
.ST-inputval,
.racial-points-value,
.DX-base,
.DX-inputval,
.weap1finemagic,
.weap1cost,
.weap1strmin,
.weap1tohit,
.weap1wt,
.armor1def,
.armor1wt,
.armor1dexmod,
.armor1magicarmor,
.armor1cost {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.barehand-input,
.dagger-input {
  width: 6ch;
  padding: 3px;
  box-sizing: border-box;
}

.weap1dam {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.weapon-dropdown,
.armor1dropdown,
.weapon-dropdown2,
.armor2dropdown {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.IQ-base,
.IQ-inputval,
.adjDex1,
.weap2finemagic,
.weap2cost,
.weap2strmin,
.weap2tohit,
.weap2wt,
.armor2def,
.armor2wt,
.armor2dexmod,
.armor2cost,
.MA-base,
.MA-inputval,
.adjMA,
.weap3finemagic,
.weap3cost,
.weap3strmin,
.weap3tohit,
.weap3wt,
.NatArmordef,
.totalArmor {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.armor1magicarmor,
.armor2magicarmor {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.weap2dam,
.weap3dam {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.weapon-dropdown3,
.weapon-dropdown4 {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.weap4finemagic,
.weap4cost,
.weap4strmin,
.weap4tohit,
.weap4wt,
.weightInPack,
.pointsSpent,
.totalDexPenalty {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.pointsSpentval,
.totalCost {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.totalWt {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.weap4dam {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.racialAbilities {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.raceNotes {
  padding: 3px;
  box-sizing: border-box;
  resize: none;
  font-family: Arial, sans-serif;
  background-color: #add8e6;
}

.spell-dropdown,
.spell-dropdown2,
.spell-dropdown3,
.spell-dropdown4,
.spell-dropdown5,
.spell-dropdown6,
.spell-dropdown7,
.spell-dropdown8 {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

td.spell-type,
td.spell-type2,
td.spell-type3,
td.spell-type4,
td.spell-type5,
td.spell-type6,
td.spell-type7,
td.spell-type8,
td.spell-cost,
td.spell-cost2,
td.spell-cost3,
td.spell-cost4,
td.spell-cost5,
td.spell-cost6,
td.spell-cost7,
td.spell-cost8,
td.spell-slots,
td.spell-slots2,
td.spell-slots3,
td.spell-slots4,
td.spell-slots5,
td.spell-slots6,
td.spell-slots7,
td.spell-slots8 {
  padding: 3px;
  box-sizing: border-box;
  width: 1%;
  white-space: nowrap;
}

td.spell-explanation,
td.spell-explanation2,
td.spell-explanation3,
td.spell-explanation4,
td.spell-explanation5,
td.spell-explanation6,
td.spell-explanation7,
td.spell-explanation8 {
  padding: 3px;
  box-sizing: border-box;
}

.weap1plusdam,
.weap2plusdam,
.weap3plusdam,
.weap4plusdam {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.spell-section {
  width: 100%;
  margin: 20px 0;
}

/* Constrain table cells containing stat input fields */
td:has(.ST-inputval),
td:has(.DX-inputval),
td:has(.IQ-inputval),
td:has(.MA-inputval) {
  width: 1%;
  white-space: nowrap;
}

/* Talent table specific width constraints */
.talent1,
.talent2,
.talent3,
.talent4,
.talent5,
.talent6,
.talent7 {
  width: auto;
  min-width: 150px;
  padding: 3px;
  box-sizing: border-box;
}

.slots1,
.slots2,
.slots3,
.slots4,
.slots5,
.slots6,
.slots7,
.iqerror1,
.iqerror2,
.iqerror3,
.iqerror4,
.iqerror5,
.iqerror6,
.iqerror7 {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.explanation1,
.explanation2,
.explanation3,
.explanation4,
.explanation5,
.explanation6,
.explanation7 {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

td:has(.slots1),
td:has(.slots2),
td:has(.slots3),
td:has(.slots4),
td:has(.slots5),
td:has(.slots6),
td:has(.slots7),
td:has(.iqerror1),
td:has(.iqerror2),
td:has(.iqerror3),
td:has(.iqerror4),
td:has(.iqerror5),
td:has(.iqerror6),
td:has(.iqerror7) {
  width: 1%;
  white-space: nowrap;
}

td:has(.talent1),
td:has(.talent2),
td:has(.talent3),
td:has(.talent4),
td:has(.talent5),
td:has(.talent6),
td:has(.talent7) {
  width: 1%;
  white-space: nowrap;
}

/* Word wrap for Magic Armor header */
td {
  white-space: normal;
  word-wrap: break-word;
}

/* Equipment section styles */
.equipment-section {
  width: 100%;
  margin: 20px 0;
}

.equip-quan1,
.equip-quan2,
.equip-quan3,
.equip-quan4,
.equip-quan5,
.equip-quan6,
.equip-quan7,
.equip-quan8,
.equip-quan9,
.equip-quan10 {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.equip-dropdown1,
.equip-dropdown2,
.equip-dropdown3,
.equip-dropdown4,
.equip-dropdown5,
.equip-dropdown6,
.equip-dropdown7,
.equip-dropdown8,
.equip-dropdown9,
.equip-dropdown10 {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.equip-cost1,
.equip-cost2,
.equip-cost3,
.equip-cost4,
.equip-cost5,
.equip-cost6,
.equip-cost7,
.equip-cost8,
.equip-cost9,
.equip-cost10,
.equip-wgt1,
.equip-wgt2,
.equip-wgt3,
.equip-wgt4,
.equip-wgt5,
.equip-wgt6,
.equip-wgt7,
.equip-wgt8,
.equip-wgt9,
.equip-wgt10 {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.equip-notes1,
.equip-notes2,
.equip-notes3,
.equip-notes4,
.equip-notes5,
.equip-notes6,
.equip-notes7,
.equip-notes8,
.equip-notes9,
.equip-notes10 {
  padding: 3px;
  box-sizing: border-box;
}

td:has(.equip-quan1),
td:has(.equip-quan2),
td:has(.equip-quan3),
td:has(.equip-quan4),
td:has(.equip-quan5),
td:has(.equip-quan6),
td:has(.equip-quan7),
td:has(.equip-quan8),
td:has(.equip-quan9),
td:has(.equip-quan10) {
  width: 1%;
  white-space: nowrap;
}

td:has(.equip-cost1),
td:has(.equip-cost2),
td:has(.equip-cost3),
td:has(.equip-cost4),
td:has(.equip-cost5),
td:has(.equip-cost6),
td:has(.equip-cost7),
td:has(.equip-cost8),
td:has(.equip-cost9),
td:has(.equip-cost10),
td:has(.equip-wgt1),
td:has(.equip-wgt2),
td:has(.equip-wgt3),
td:has(.equip-wgt4),
td:has(.equip-wgt5),
td:has(.equip-wgt6),
td:has(.equip-wgt7),
td:has(.equip-wgt8),
td:has(.equip-wgt9),
td:has(.equip-wgt10) {
  width: 1%;
  white-space: nowrap;
}

/* Monster tab styles - matching character generator styles */
.monster-name-input {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
}

.monster-race-dropdown {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
}

td:has(.monster-race-dropdown) {
  background-color: #add8e6;
}

.monster-ST-base,
.monster-ST-inputval,
.monster-racial-points-value,
.monster-DX-base,
.monster-DX-inputval,
.monster-weap1finemagic,
.monster-weap1cost,
.monster-weap1strmin,
.monster-weap1tohit,
.monster-weap1wt,
.monster-armor1def,
.monster-armor1wt,
.monster-armor1dexmod,
.monster-armor1magicarmor,
.monster-armor1cost {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-barehand-input,
.monster-dagger-input {
  width: 6ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-weap1dam {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-weapon-dropdown,
.monster-armor1dropdown,
.monster-weapon-dropdown2,
.monster-armor2dropdown {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.monster-IQ-base,
.monster-IQ-inputval,
.monster-adjDex1,
.monster-weap2finemagic,
.monster-weap2cost,
.monster-weap2strmin,
.monster-weap2tohit,
.monster-weap2wt,
.monster-armor2def,
.monster-armor2wt,
.monster-armor2dexmod,
.monster-armor2cost,
.monster-MA-base,
.monster-MA-inputval,
.monster-adjMA,
.monster-weap3finemagic,
.monster-weap3cost,
.monster-weap3strmin,
.monster-weap3tohit,
.monster-weap3wt,
.monster-NatArmordef,
.monster-totalArmor {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-armor1magicarmor,
.monster-armor2magicarmor {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.monster-weap2dam,
.monster-weap3dam {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-weapon-dropdown3,
.monster-weapon-dropdown4 {
  width: 100%;
  padding: 3px;
  box-sizing: border-box;
}

.monster-weap4finemagic,
.monster-weap4cost,
.monster-weap4strmin,
.monster-weap4tohit,
.monster-weap4wt {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-pointsSpentval,
.monster-totalCost {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-totalWt {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

.monster-weap4dam {
  width: 8ch;
  padding: 3px;
  box-sizing: border-box;
}

#hex-map-container {
  max-width: 1000px;
  max-height: 600px;
  overflow: auto;
  border: 2px solid #333;
  background-color: #fff;
  display: inline-block;
  margin-bottom: 20px;
}

.monster-raceNotes {
  padding: 3px;
  box-sizing: border-box;
  resize: none;
  font-family: Arial, sans-serif;
  background-color: #add8e6;
}

.monster-totalArmorDexPenalty {
  width: 4ch;
  padding: 3px;
  box-sizing: border-box;
}

td:has(.monster-ST-inputval),
td:has(.monster-DX-inputval),
td:has(.monster-IQ-inputval),
td:has(.monster-MA-inputval) {
  width: 1%;
  white-space: nowrap;
}

/* Character Cards tab styles */
.charholder {
  width: 100%;
  margin: 8px 0;
  display: flex;
  gap: 8px;
}

.dice-container {
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.dice-btn {
  padding: 3px;
  background-color: #4CAF50;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
}

.dice-btn:hover {
  background-color: #45a049;
}

.cardHolder {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: min-content;
  gap: 4px;
}

.character-card {
  border: 2px solid #333;
  padding: 2px;
  background-color: #f9f9f9;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 310px;
}

.character-card.hidden {
  display: none;
}

.character-card table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

/* Critter Editor styles */
.editor-container {
  max-width: 100%;
  margin: 0 auto;
  background: white;
  padding: 6px;
  border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.1);
}

.main-layout {
  display: flex;
  gap: 6px;
  margin-top: 3px;
}

.race-list-sidebar {
  width: 15%;
  min-width: 150px;
}

.race-list {
  width: 100%;
  height: 600px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 11px;
  overflow-y: auto;
}

.race-list option {
  padding: 4px 8px;
  cursor: pointer;
}

.race-list option:hover {
  background-color: #e9ecef;
}

.editor-form-area {
  width: 80%;
  flex: 1;
}

.header {
  background-color: darkblue;
  color: white;
  padding: 4px;
  margin: -6px -6px 3px -6px;
  border-radius: 4px 4px 0 0;
  text-align: center;
}

.header h1 {
  font-size: 18px;
  margin: 0 0 2px 0;
}

.header p {
  font-size: 11px;
  margin: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  margin-bottom: 2px;
}

.form-group {
  margin-bottom: 2px;
}

.form-group label {
  font-weight: bold;
  display: block;
  margin-bottom: 2px;
  color: #333;
  font-size: 11px;
}

.form-control {
  width: 100%;
  padding: 2px 3px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
}

textarea.form-control {
  min-height: 50px;
  resize: vertical;
}

.button-group {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 3px 6px;
  font-size: 12px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #218838;
}

.btn-warning {
  background-color: #ffc107;
  color: #333;
}

.btn-warning:hover {
  background-color: #e0a800;
}

.btn-info {
  background-color: #17a2b8;
  color: white;
}

.btn-info:hover {
  background-color: #138496;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
}

.btn-danger:hover {
  background-color: #c82333;
}

.current-critter {
  text-align: center;
  font-size: 13px;
  margin-bottom: 2px;
  color: #666;
}

.stat-input {
  text-align: center;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table-sm td {
  padding: 2px;
}

.table-bordered td {
  border: 1px solid #dee2e6;
}

.character-card .card-stat-table {
  width: fit-content !important;
}

.character-card td {
  padding: 1px;
  text-align: left;
  border: 1px solid #ccc;
  font-size: 12px;
}

.card-name-race {
  background-color: #e8f4f8;
}

.card-name-race td:nth-child(odd) {
  font-weight: bold;
  width: 15%;
}

.card-name-race input {
  width: 100%;
  padding: px;
  box-sizing: border-box;
}


.card-stat-table tr:first-child {
  background-color: #d4e9f7;
  font-weight: bold;
  text-align: center;
}

.card-stat-table td:first-child {
  font-weight: bold;
  width: 30%;
}

.card-stat-table input {
  width: 100%;
  padding: 1px;
  box-sizing: border-box;
  text-align: center;
}

.card-equip-table select,
.card-equip-table input {
  width: 100%;
  padding: 1px;
  box-sizing: border-box;
  font-size: 11px;
}

.card-equip-table td:first-child {
  width: 50%;
}


.card-radio-group {
  flex-wrap: wrap;
  max-width: 100%;
}

.card-radio-group input[type="radio"] {
  flex: 0 0 calc(8% - 4px);
}

.action-btn {
  padding: 2px 6px;
  font-size: 10px;
  background-color: #28a745;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 3px;
  width: 100%;
}

.action-btn:hover {
  background-color: #218838;
}

.hex-context-menu {
  position: fixed;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  min-width: 120px;
  display: none;
}

.hex-context-menu.visible {
  display: block;
}

.hex-context-menu-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #eee;
}

.hex-context-menu-item:last-child {
  border-bottom: none;
}

.hex-context-menu-item:hover {
  background-color: #f0f0f0;
}

.hex-context-menu-item.text-option {
  font-style: italic;
  color: #666;
}