* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'Arial', sans-serif;
  background-color: #f4f1e8;
  color: #2c2416;
}

.character-sheet {
  max-width: 900px;
  margin: 10px auto;
  padding: 10px;
  background-color: #fff;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
  border: 2px solid #8b7355;
}

header {
  text-align: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 3px solid #8b7355;
}

header h1 {
  font-size: 1.5em;
  color: #5a4a3a;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

header .company {
  font-size: 0.75em;
  color: #8b7355;
  letter-spacing: 1px;
  margin-top: 2px;
}

section {
  margin-bottom: 12px;
  padding: 7px;
  background-color: #fafaf8;
  border: 1px solid #d4c4a8;
  border-radius: 5px;
}

h2 {
  font-size: 0.975em;
  color: #5a4a3a;
  margin-bottom: 7px;
  padding-bottom: 4px;
  border-bottom: 2px solid #8b7355;
  text-transform: uppercase;
  letter-spacing: 0.75px;
}

.form-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 120px;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 2px;
  color: #5a4a3a;
  font-size: 0.675em;
  text-transform: uppercase;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 4px;
  border: 1px solid #8b7355;
  border-radius: 3px;
  font-size: 0.85em;
  background-color: #fff;
}

.form-group input:focus {
  outline: none;
  border-color: #5a4a3a;
  box-shadow: 0 0 5px rgba(90,74,58,0.3);
}

/* Weapons Table */
.weapons-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.weapons-table thead {
  background-color: #5a4a3a;
  color: #fff;
}

.weapons-table th {
  padding: 5px;
  text-align: left;
  font-size: 0.675em;
  border: 1px solid #8b7355;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.weapons-table td {
  padding: 4px 5px;
  border: 1px solid #d4c4a8;
}

.weapons-table tbody tr:hover {
  background-color: #f4f1e8;
}

.weapons-table td.row-label {
  font-size: 0.71em;
  font-weight: bold;
  color: #5a4a3a;
  white-space: nowrap;
  background-color: #f4f1e8;
}

.weapons-table td input {
  width: 100%;
  padding: 3px;
  border: 1px solid #8b7355;
  border-radius: 3px;
  font-size: 0.75em;
  background-color: #fff;
}

.weapons-table td input.short {
  width: 60px;
}

.weapons-table td input:focus {
  outline: none;
  border-color: #5a4a3a;
  box-shadow: 0 0 4px rgba(90,74,58,0.3);
}

/* Items textarea */
#items-treasure {
  width: 100%;
  padding: 5px;
  border: 1px solid #8b7355;
  border-radius: 3px;
  font-family: 'Arial', sans-serif;
  font-size: 0.75em;
  resize: vertical;
  background-color: #fff;
}

#items-treasure:focus {
  outline: none;
  border-color: #5a4a3a;
  box-shadow: 0 0 5px rgba(90,74,58,0.3);
}

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
  }
  .weapons-table td input.short {
    width: 100%;
  }
}

/* Ancestry */
.ancestry-desc {
  font-size: 0.75em;
  line-height: 1.5;
  color: #2c2416;
  margin-bottom: 8px;
}

#hero-abilities {
  width: 100%;
  padding: 5px;
  border: 1px solid #8b7355;
  border-radius: 3px;
  font-family: 'Arial', sans-serif;
  font-size: 0.75em;
  resize: vertical;
  background-color: #f4f1e8;
  color: #2c2416;
}

/* Apply button inline with select */
#ancestry + button,
#apply-ancestry {
  margin-top: 4px;
  padding: 4px 10px;
  background-color: #5a4a3a;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.75em;
  font-weight: bold;
}

#apply-ancestry:hover {
  background-color: #3a2a1a;
}

/* Finalize */
#finalize-section {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #f4f1e8;
  border: 1px solid #8b7355;
}

#finalize-btn {
  background-color: #8b4513;
}

#finalize-btn:hover:not(:disabled) {
  background-color: #6b3410;
}

#finalize-btn:disabled {
  background-color: #aaa;
  cursor: not-allowed;
}

#finalize-msg {
  font-size: 0.75em;
  color: #5a4a3a;
  font-weight: bold;
}

/* Skills Table */
.skills-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.skills-table thead {
  background-color: #5a4a3a;
  color: #fff;
}

.skills-table th {
  padding: 5px;
  text-align: center;
  font-size: 0.675em;
  border: 1px solid #8b7355;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.skills-table th:first-child {
  text-align: left;
}

.skills-table td {
  padding: 5px;
  border: 1px solid #d4c4a8;
  text-align: center;
}

.skills-table td.row-label {
  text-align: left;
  font-size: 0.75em;
  font-weight: bold;
  color: #5a4a3a;
  background-color: #f4f1e8;
}

.skills-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #5a4a3a;
}

/* Attribute points banner */
.attr-points-banner {
  font-size: 0.8em;
  font-weight: bold;
  color: #5a4a3a;
  background-color: #f4f1e8;
  border: 1px dashed #8b7355;
  border-radius: 3px;
  padding: 4px 8px;
  margin-bottom: 8px;
  display: inline-block;
}

/* Weapon notes */
.weapon-notes {
  font-size: 0.71em;
  line-height: 1.5;
  color: #2c2416;
  background-color: #f4f1e8;
  border: 1px solid #d4c4a8;
  border-radius: 3px;
  padding: 7px;
  margin-bottom: 10px;
}

.weapon-notes ul {
  margin: 4px 0 6px 16px;
}

.weapon-notes li {
  margin-bottom: 2px;
}

/* Starting weapons picker */
.starting-weapons {
  margin-bottom: 12px;
  padding: 7px;
  background-color: #fafaf8;
  border: 1px dashed #8b7355;
  border-radius: 4px;
}

.starting-weapons h3 {
  font-size: 0.875em;
  color: #5a4a3a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.starting-note {
  font-size: 0.71em;
  color: #5a4a3a;
  margin-bottom: 6px;
}

.radio-label {
  font-size: 0.75em;
  font-weight: bold;
  color: #5a4a3a;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.start-weapon-select.mt-fail {
  color: #cc0000;
  font-weight: bold;
}
  background-color: #f4f1e8 !important;
  color: #8b7355;
  font-style: italic;
}

/* Gear stats */
.gear-stats {
  display: block;
  font-size: 0.65em;
  color: #8b4513;
  margin-top: 2px;
  font-weight: bold;
}

/* Section notes */
.section-note {
  font-size: 0.71em;
  color: #5a4a3a;
  margin-bottom: 6px;
  line-height: 1.4;
}

#disciplines, #spells {
  width: 100%;
  padding: 5px;
  border: 1px solid #8b7355;
  border-radius: 3px;
  font-family: 'Arial', sans-serif;
  font-size: 0.75em;
  resize: vertical;
  background-color: #fff;
}

#disciplines:focus, #spells:focus {
  outline: none;
  border-color: #5a4a3a;
  box-shadow: 0 0 5px rgba(90,74,58,0.3);
}

/* Calculated readonly fields */
input[readonly] {
  background-color: #f4f1e8;
  color: #5a4a3a;
  font-weight: bold;
}

/* Discipline Picker */
.disc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 6px;
}

.disc-tab {
  padding: 3px 8px;
  font-size: 0.68em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: #e8e0d0;
  border: 1px solid #8b7355;
  border-radius: 3px;
  cursor: pointer;
  color: #5a4a3a;
}

.disc-tab.active {
  background-color: #5a4a3a;
  color: #fff;
}

.disc-list {
  border: 1px solid #d4c4a8;
  border-radius: 3px;
  background-color: #fff;
  max-height: 220px;
  overflow-y: auto;
}

.disc-entry {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 7px;
  border-bottom: 1px solid #ede8dc;
  font-size: 0.72em;
  line-height: 1.4;
}

.disc-entry:last-child { border-bottom: none; }

.disc-entry:hover { background-color: #f4f1e8; }

.disc-entry input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #5a4a3a;
  cursor: pointer;
}

.disc-entry.learned { background-color: #eef4e8; }
.disc-entry.ineligible { opacity: 0.45; }

.disc-meta {
  flex: 1;
}

.disc-name {
  font-weight: bold;
  color: #5a4a3a;
}

.disc-cost {
  color: #8b4513;
  font-size: 0.92em;
  margin-left: 4px;
}

.disc-prereq {
  font-style: italic;
  color: #8b7355;
  font-size: 0.9em;
}

.disc-desc {
  color: #2c2416;
  margin-top: 1px;
}

.disc-learned {
  margin-top: 8px;
  padding: 6px 8px;
  background-color: #f4f1e8;
  border: 1px solid #d4c4a8;
  border-radius: 3px;
  min-height: 28px;
}

.disc-learned-title {
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #5a4a3a;
  display: block;
  margin-bottom: 4px;
}

#disc-learned-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#disc-learned-list li {
  font-size: 0.7em;
  background-color: #5a4a3a;
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
}
