/* character-sheet.css
   Styles used only by the character sheet page. (The modals - Talents / Traits browsers, Notes - are in modal.css.)
   Load after core.css. */

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand .mark {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent-glow);
}

.brand .sub {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
  text-transform: uppercase;
}

/* Narrow screens: the brand and the account button share the first line (account button
   in the top right corner); Refresh and Edit sit together at the left of the second.
   The button group's box is dropped (display: contents) so its children can be placed
   individually. The brand leaves room for the 38px account button plus the 16px gap. */
@media (max-width: 720px) {
  .brand {
    flex: 1 1 calc(100% - 54px);
    min-width: 0;
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .brand ~ .top-bar-right {
    display: contents;
  }

  .brand ~ .top-bar-right .account-dropdown {
    order: 1;
    align-self: flex-start;
    margin-left: 0;
  }

  .brand ~ .top-bar-right .edit-toggle-btn {
    order: 2;
  }

  .brand ~ .top-bar-right #toast {
    order: 3;
    flex: 1 1 0;
    min-width: 0;
  }
}

.edit-toggle-btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.edit-toggle-btn:hover {
  border-color: var(--accent);
  color: #fff;
}

.edit-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0a12;
}

.menu-dropdown-panel {
  position: absolute;
  top: 44px;
  left: 0;
  min-width: 180px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}

.menu-dropdown:hover .menu-dropdown-panel,
.menu-dropdown:focus-within .menu-dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-item {
  display: block;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.menu-item:hover {
  background: var(--panel-bg-soft);
  color: var(--cyan);
}

.account-trigger {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.menu-dropdown:hover .account-trigger,
.menu-dropdown:focus-within .account-trigger {
  color: var(--cyan);
  border-color: var(--cyan-dim);
  background: var(--panel-bg);
}

.account-icon {
  width: 20px;
  height: 20px;
}

.account-icon path {
  stroke: currentColor;
}

.account-panel {
  left: auto;
  right: 0; /* keep the rightmost dropdown from overflowing off-screen */
}

/* ---------------------------------------------------------------- */
/* Meta strip (character / player / notes)                            */
/* ---------------------------------------------------------------- */
.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 16px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.meta-field {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 1 1 220px;
}

.meta-field .label {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  text-transform: uppercase;
  white-space: nowrap;
}

.meta-field .meta-text {
  flex: 1;
  border-bottom: 1px dashed var(--border-soft);
  min-height: 20px;
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--text);
}

.meta-field .meta-select {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-bottom: 1px dashed var(--border-soft);
  min-height: 20px;
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: color 0.12s ease;
}

.meta-field .meta-select:hover,
.meta-field .meta-select:focus {
  color: var(--cyan);
  outline: none;
}

.meta-field .meta-select.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-btn {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  padding: 4px 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.header-btn:hover {
  background: #fff;
  color: var(--accent-dim);
}

.panel-body {
  padding: 16px 18px 18px;
}

.panel-body.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}

.panel-column {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------------------------------------------------------------- */
/* Stat rows (stats / resources)                                      */
/* ---------------------------------------------------------------- */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
}

.stat-row.stat-gap {
  visibility: hidden;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row .label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.stat-row .text-field {
  flex: 2.5;
}

/* ---------------------------------------------------------------- */
/* Number field widget: [-]  3  [+]                                   */
/* ---------------------------------------------------------------- */
.number-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.num-value {
  min-width: 30px;
  min-height: 30px;
  text-align: center;
  font-family: var(--font-data);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 4px;
}

.num-btn {
  display: none; /* only shown in edit mode */
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  font-family: var(--font-data);
  font-size: 14px;
  line-height: 1;
  color: var(--cyan);
  background: var(--panel-bg-soft);
  border: 1px solid var(--cyan-dim);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.num-btn:hover {
  background: var(--cyan);
  color: #071a17;
}

body.edit-mode .num-btn {
  display: inline-flex;
}

/* ---------------------------------------------------------------- */
/* Pool field widget: circles in view mode, number in edit mode       */
/* ---------------------------------------------------------------- */
.pool-field {
  display: flex;
  align-items: center;
}

.pool-circles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pool-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

.pool-circle:hover {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pool-circle.filled {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.pool-edit {
  display: none;
}

body.edit-mode .pool-circles {
  display: none;
}

body.edit-mode .pool-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.edge-refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.refresh-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.refresh-inline .label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Edge gets slightly larger cyan circles to read as the "hero" pool */
.edge-pool .pool-circle {
  width: 20px;
  height: 20px;
  border-color: var(--cyan);
}

.edge-pool .pool-circle.filled {
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(56, 230, 207, 0.45);
}

/* ---------------------------------------------------------------- */
/* Text fields                                                        */
/* ---------------------------------------------------------------- */
.text-field {
  min-height: 30px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  outline: none;
  padding: 2px 2px;
  border-radius: var(--radius);
  align-content: center;
}

.text-field:empty::before {
  content: attr(data-placeholder);
  color: var(--text-faint);
}

.text-field[contenteditable='true'] {
  background: var(--panel-bg-soft);
  box-shadow: inset 0 0 0 1px var(--border);
}

.text-field[contenteditable='true']:focus {
  box-shadow: inset 0 0 0 1px var(--cyan);
}

/* ---------------------------------------------------------------- */
/* Personal Data: Description. Grows as it is typed in (edit mode); read   */
/* only it shows two lines and opens in full when clicked.                 */
/* ---------------------------------------------------------------- */
.description-block {
  padding-top: 0;
}

.description-block .label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.description-field {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 2px;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  outline: none;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

body.edit-mode .description-field {
  min-height: 30px;
  background: var(--panel-bg-soft);
  box-shadow: inset 0 0 0 1px var(--border);
}

body.edit-mode .description-field:focus {
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.description-field::placeholder {
  color: var(--text-faint);
}

.description-field.is-expandable {
  cursor: pointer;
}

.description-field.is-expandable:hover {
  background: var(--panel-bg-soft);
}

.description-toggle {
  margin-top: 2px;
  padding: 0 2px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--cyan);
  background: none;
  border: none;
  cursor: pointer;
}

.description-toggle[hidden] {
  display: none;
}

.description-toggle:focus-visible {
  outline: 1px solid var(--cyan);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- */
/* Checkbox widget - always interactive, like pool circles            */
/* ---------------------------------------------------------------- */
.checkbox-el {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  background-color: var(--cyan-dim);
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20width%3D%2224px%22%20height%3D%2224px%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http://www.w3.org/2000/svg%22%20color%3D%22%23000000%22%3E%3Cpath%20d%3D%22M7%204H4V7%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M4%2011V13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M11%204H13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M11%2020H13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M20%2011V13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M17%204H20V7%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M7%2020H4V17%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M17%2020H20V17%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3C/svg%3E")
    no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg%20width%3D%2224px%22%20height%3D%2224px%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http://www.w3.org/2000/svg%22%20color%3D%22%23000000%22%3E%3Cpath%20d%3D%22M7%204H4V7%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M4%2011V13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M11%204H13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M11%2020H13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M20%2011V13%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M17%204H20V7%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M7%2020H4V17%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3Cpath%20d%3D%22M17%2020H20V17%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3C/svg%3E")
    no-repeat center / contain;
  transition: background-color 0.12s ease;
}

.checkbox-el:hover {
  background-color: var(--cyan);
}

.checkbox-el:checked {
  background-color: var(--cyan);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224px%22%20height%3D%2224px%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http://www.w3.org/2000/svg%22%20color%3D%22%23000000%22%3E%3Cpath%20d%3D%22M3%2020.4V3.6C3%203.26863%203.26863%203%203.6%203H20.4C20.7314%203%2021%203.26863%2021%203.6V20.4C21%2020.7314%2020.7314%2021%2020.4%2021H3.6C3.26863%2021%203%2020.7314%203%2020.4Z%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%3E%3C/path%3E%3Cpath%20d%3D%22M7%2012.5L10%2015.5L17%208.5%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224px%22%20height%3D%2224px%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http://www.w3.org/2000/svg%22%20color%3D%22%23000000%22%3E%3Cpath%20d%3D%22M3%2020.4V3.6C3%203.26863%203.26863%203%203.6%203H20.4C20.7314%203%2021%203.26863%2021%203.6V20.4C21%2020.7314%2020.7314%2021%2020.4%2021H3.6C3.26863%2021%203%2020.7314%203%2020.4Z%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%3E%3C/path%3E%3Cpath%20d%3D%22M7%2012.5L10%2015.5L17%208.5%22%20stroke%3D%22%23000000%22%20stroke-width%3D%221.5%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C/path%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- */
/* Row-based list sections (shared skeleton)                          */
/* ---------------------------------------------------------------- */
.add-row-btn {
  display: none;
  margin-top: 8px;
  font-family: var(--font-data);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cyan);
  background: transparent;
  border: 1px dashed var(--cyan-dim);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
}

.add-row-btn:hover {
  border-color: var(--cyan);
  background: rgba(56, 230, 207, 0.08);
}

body.edit-mode .add-row-btn {
  display: inline-block;
}

.list-head {
  display: grid;
  gap: 10px;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.list-head span {
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* Complications */
.complication-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}

.complication-row:last-of-type {
  border-bottom: none;
}

.complication-name {
  flex: 1;
  min-width: 0;
}

/* Qualities */
.quality-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
}

.quality-row:last-of-type {
  border-bottom: none;
}

.quality-name {
  flex: 2;
  min-width: 0;
}

.quality-category {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
  font-style: italic;
}

.quality-head {
  grid-template-columns: 2fr 1fr;
}

/* Tags */
.tag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.tag-name {
  flex: 2;
  min-width: 0;
}

/* Same share of the row as a quality's Type (whose select has 7px of padding and
   border each side, which counts towards how the row's space is divided). */
.tag-source {
  flex: 1;
  min-width: 0;
  padding-left: 7px;
  padding-right: 7px;
  color: var(--text-dim);
  font-style: italic;
}

.tag-name:not(:empty)::before {
  content: '#';
  color: var(--cyan);
  margin-right: 2px;
}

.tag-head {
  grid-template-columns: 2fr 1fr;
}

/* Focuses */
/* Two columns, like Resources. Each focus is a group: one line, or (for a focus with
   subcategories) its name followed by a tucked-in line per subcategory. Groups are
   separated by a rule and ordinary spacing; lines inside a group sit close together. */
.focus-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px 24px;
}

.focus-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
}

.focus-group:last-child {
  border-bottom: none;
}

.focus-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.focus-name {
  flex: 1;
  min-width: 0;
}

/* A subcategory line: indented, with a dot marking it as part of the focus above. */
.focus-sub {
  padding-left: 14px;
  position: relative;
}

.focus-sub::before {
  content: '\2022';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1;
  color: var(--cyan);
}

/* Only shown (via the [hidden] attribute) when the selected focus has
   subcategories: true - see focusRowForDraft() in character-sheet.js. */
.focus-subcategory {
  flex: 1;
  min-width: 0;
}

/* A new focus being picked: name on the first line, its subcategory (when it has
   one) tucked in underneath. */
.focus-draft {
  flex-wrap: wrap;
}

.focus-draft .focus-name {
  flex: 1 1 0;
}

.focus-draft .row-clear-btn {
  order: 2;
}

.focus-draft .focus-subcategory {
  order: 3;
  flex: 1 0 100%;
  padding-left: 14px;
  box-sizing: border-box;
}

.focus-draft .focus-subcategory[hidden] {
  display: none;
}

/* Too narrow for two columns of focus lines. */
@media (max-width: 520px) {
  .focus-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Talents */
/* Talent / Focus / Type sit across the top row; Description spans the
   full width of a second row underneath, with no header of its own,
   and wraps/grows instead of truncating. */
.talent-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.8fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}

.talent-row:last-of-type {
  border-bottom: none;
}

.talent-name {
  grid-column: 1;
  grid-row: 1;
  font-weight: 600;
}

.talent-focus {
  grid-column: 2;
  grid-row: 1;
}

.talent-type {
  grid-column: 3;
  grid-row: 1;
}

.talent-focus,
.talent-type {
  color: var(--text-dim);
  font-family: var(--font-data);
  font-size: 13px;
}

.talent-row .row-clear-btn {
  grid-column: 4;
  grid-row: 1;
}

.talent-desc {
  grid-column: 1 / 4;
  grid-row: 2;
  color: var(--text-dim);
  font-size: 13px;
  white-space: normal;
  overflow-wrap: break-word;
  height: auto;
}

.talents-head {
  grid-template-columns: 1.2fr 0.9fr 0.8fr auto;
}

/* Conditions */
.condition-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr 20px;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-soft);
}

.condition-row:last-of-type {
  border-bottom: none;
}

.condition-type,
.condition-duration {
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--text-dim);
}

.conditions-head {
  grid-template-columns: 2.4fr 1fr 1fr 20px;
}

/* Equipment */
.equipment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-soft);
}

.equipment-row:last-of-type {
  border-bottom: none;
}

.equipment-desc {
  flex: 1;
  min-width: 0;
}

.qty-input {
  width: 48px;
  height: 30px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 2px;
  outline: none;
}

.qty-input:focus {
  border-color: var(--cyan);
}

.equipment-head {
  grid-template-columns: 1fr 48px 20px;
}

.equipment-head span:nth-child(2) {
  text-align: center;
}

/* Traits */
/* Like a Talents row: the trait's name (find-as-you-type) with the clear / remove button beside
   it, and the description underneath. The description box is the Talents one (.talent-desc), so
   its click-for-more styles apply; it is hidden when a row has no trait yet. The Browse modal
   reuses the talent browser's styles (modal.css). */
.trait-row {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  row-gap: 4px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}

.trait-row:last-of-type {
  border-bottom: none;
}

.trait-name {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  font-weight: 600;
}

.trait-row .row-clear-btn {
  grid-column: 2;
  grid-row: 1;
}

.trait-row .trait-desc {
  grid-column: 1 / -1;
  grid-row: 2;
}

.trait-row .trait-desc[hidden] {
  display: none;
}

/* ---------------------------------------------------------------- */
/* Pool extras: rating box, computed-rating pools, edit-only fills    */
/* ---------------------------------------------------------------- */
.pool-rating {
  margin-left: 12px;
  flex-shrink: 0;
}

body.edit-mode .pool-rating {
  display: none;
}

/* Pools whose rating is computed (Edge, Complications) have no rating
   editor, so keep their circles visible in edit mode too. */
body.edit-mode .pool-field[data-rating-base] .pool-circles {
  display: flex;
}

.pool-field[data-fill-edit-only='true'] .pool-circle {
  cursor: default;
}

.pool-field[data-fill-edit-only='true'] .pool-circle:hover {
  box-shadow: none;
}

body.edit-mode .pool-field[data-fill-edit-only='true'] .pool-circle {
  cursor: pointer;
}

body.edit-mode .pool-field[data-fill-edit-only='true'] .pool-circle:hover {
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Talent Focus / Type are comboboxes now */
.talent-focus .meta-combo-input,
.talent-type .meta-combo-input {
  font-family: var(--font-data);
  font-size: 13px;
  color: var(--text-dim);
}

/* ---------------------------------------------------------------- */
/* Per-line remove button (Effects / Equipment)                       */
/* Plain square X, 30px high x 20px wide, same look as a text field.  */
/* ---------------------------------------------------------------- */
.row-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
  width: 20px;
  height: 30px;
  padding: 0;
  color: var(--text-dim);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.row-clear-btn:hover {
  color: var(--danger);
  border-color: var(--danger-dim);
}

/* ---------------------------------------------------------------- */
/* Disabled top-bar buttons (Refresh / Edit with no character loaded) */
/* ---------------------------------------------------------------- */
.edit-toggle-btn:disabled {
  opacity: 0.22;
  cursor: not-allowed;
}

.edit-toggle-btn:disabled:hover {
  border-color: var(--border);
  color: var(--text);
}

/* ---------------------------------------------------------------- */
/* No-character terminal placeholder                                  */
/* ---------------------------------------------------------------- */
.terminal-wrap {
  max-width: 1280px;
  margin: 8px auto 40px;
  padding: 0 24px;
}

.terminal-body {
  min-height: 340px;
  padding: 18px 22px 24px;
  background: rgba(9, 6, 13, 0.55);
  font-family: var(--font-data);
  font-size: 13px;
  line-height: 1.75;
  color: var(--cyan);
}

.terminal-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 1.75em;
  text-shadow: 0 0 8px rgba(56, 230, 207, 0.35);
}

.terminal-line.dim {
  color: var(--text-faint);
  text-shadow: none;
}

.terminal-line.warn {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}

.terminal-line.err {
  color: var(--danger);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

.terminal-line.active::after {
  content: '\2588';
  margin-left: 2px;
  animation: terminal-blink 1s steps(1) infinite;
}

@keyframes terminal-blink {
  50% {
    opacity: 0;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- */
/* Experience panel: XP pool, Advances and Unspent on one row         */
/* ---------------------------------------------------------------- */
.experience-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.experience-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.experience-field .label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* Players (and GMs outside edit mode) can look but not touch. */
#xp-pool.xp-locked .pool-circle {
  cursor: default;
}

#xp-pool.xp-locked .pool-circle:hover {
  box-shadow: none;
}

#xp-pool.xp-locked .pool-circle.filled:hover {
  box-shadow: 0 0 8px var(--accent-glow);
}

/* Always show the circles (the generic pool hides them in edit mode). */
body.edit-mode #xp-pool .pool-circles {
  display: flex;
}

.xp-warning {
  white-space: pre-line;
  margin: 12px 0 0;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #ffb4a8;
  background: rgba(255, 90, 70, 0.1);
  border: 1px solid rgba(255, 90, 70, 0.55);
  border-radius: var(--radius);
}

.xp-warning::before {
  content: '\26A0\00a0';
}

.xp-warning[hidden] {
  display: none;
}

/* Veteran / Rookie pool label and its hidden state (the build type itself is set in the
   Characters menu, so the sheet only shows the pool, when the build has one). */
.experience-rule[hidden] {
  display: none;
}

.experience-rule-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

/* Veteran / Rookie pool, laid out like a complication row */
.experience-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

/* "-2 from focuses" note beside Refresh (edit mode only) */
.refresh-note {
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  white-space: nowrap;
}

.refresh-note[hidden] {
  display: none;
}

/* Talent description: read-only; click to flip to the long description */
.talent-desc.is-expandable {
  cursor: pointer;
  border-radius: var(--radius);
}

.talent-desc.is-expandable:hover {
  background: var(--panel-bg-soft);
}

.talent-desc.is-expandable:focus-visible {
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.talent-desc[data-state='short']::after {
  content: ' \25B8 more';
  color: var(--cyan);
  font-size: 12px;
}

.talent-desc[data-state='long']::after {
  content: ' \25BE less';
  color: var(--cyan);
  font-size: 12px;
}

/* Clear / remove button: the one used on every row. Edit-mode only unless the
   list is always editable (Effects, Equipment), which omit .edit-only. */
.row-clear-btn.edit-only {
  display: none;
}

body.edit-mode .row-clear-btn.edit-only {
  display: inline-flex;
}

/* ---------------------------------------------------------------- */
/* Equipment Section                                                */
/* ---------------------------------------------------------------- */

/* Equipment */
/* Each item is a line (.equipment-row: description, qty, clear button) with Qualities, Tags
   and Notes lines under it (.equipment-extras). Those show while the item is selected
   (.is-open) and otherwise only the ones with something in them: character-sheet.js hides
   the rest with the [hidden] attribute. */
.equipment-item {
  border-bottom: 1px dashed var(--border-soft);
}

.equipment-item:last-of-type {
  border-bottom: none;
}

.equipment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}

.equipment-desc {
  flex: 1;
  min-width: 0;
}

.equipment-extras {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 9px;
}

.equipment-extra {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.equipment-extra .label {
  flex: 0 0 72px;
  padding-top: 8px; /* lines the label up with the first line of the box */
  font-family: var(--font-data);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.equipment-extra-input {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.qty-input {
  width: 48px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 2px;
  outline: none;
}

.qty-input:focus {
  border-color: var(--cyan);
}

.equipment-head {
  grid-template-columns: 1fr 48px 20px;
}

.equipment-head span:nth-child(2) {
  text-align: center;
}

/* Qualities and Tags: little tags. The # (Tags) or @ (Qualities) turns into a red X on hover;
   clicking it removes the tag. The box to type a new one only shows while the item is selected. */
.tag-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  min-height: 28px;
  padding: 2px;
  font-size: 13px;
  cursor: text;
}

.tag-chips {
  display: contents;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  color: var(--text);
}

.tag-chip-text {
  overflow-wrap: anywhere;
}

/* The # / @ marker. A fixed box so swapping it for the X on hover never moves anything. */
.tag-chip-x {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
  margin-right: 3px;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  line-height: 1;
  color: var(--cyan);
  cursor: pointer;
}

.tag-chip-x::before {
  content: attr(data-glyph);
}

.tag-chip:hover .tag-chip-x::before,
.tag-chip-x:focus-visible::before {
  content: '\00d7';
  width: auto;
  height: auto;
  background: none;
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1;
  color: #ff5a46;
}

.tag-chip-x:focus-visible {
  outline: none;
}

.tag-entry {
  flex: 1 1 90px;
  min-width: 90px;
  padding: 3px 4px;
  font: inherit;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: none;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--border);
  outline: none;
}

.tag-entry:focus {
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.equipment-item:not(.is-open) .tag-entry {
  display: none;
}
/* Contacts (Resources panel): built from the equipment item markup, so it shares all of the
   equipment CSS above. Only the block's spacing is its own. */
.contacts-block {
  padding-top: 0;
}

.contacts-block > .subhead:first-child {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}