@font-face {
  font-family: "Dreadful Rust";
  src: url("assets/Dreadful-Rust.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --ink: #080808;
  --paper: #fff;
  --border: #9d9d9d;
  --page-width: 793px;
  --page-height: 1122px;
  --spread-gap: 28px;
  --spread-width: 1614px;
  --section-font: "Dreadful Rust", "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  --display-font: "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
  --body-font: "Trebuchet MS", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e7e7e7;
  font-family: var(--body-font);
  font-size: 16px;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

input,
textarea {
  border-radius: 0;
}

textarea {
  resize: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #1769aa;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

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

.toolbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 56px;
  padding: 8px max(16px, calc((100vw - var(--page-width)) / 2));
  color: #fff;
  background: #111;
  box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
}

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

.toolbar-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #777;
  color: #fff;
  background: #232323;
  font-family: var(--display-font);
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.toolbar-button:hover {
  background: #3b3b3b;
}

.toolbar-button {
  cursor: pointer;
}

.save-status {
  min-width: 8.5rem;
  color: #d7d7d7;
  font-size: 0.875rem;
  text-align: right;
}

#character-sheet {
  display: grid;
  grid-template-columns: minmax(0, var(--page-width));
  justify-content: center;
  gap: var(--spread-gap);
  padding-block: 28px;
}

.sheet {
  width: var(--page-width);
  min-height: var(--page-height);
  padding: 24px;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 5px 20px rgb(0 0 0 / 18%);
}

.sheet-one {
  display: grid;
  grid-template-rows: auto auto minmax(342px, 1fr);
}

.sheet-heading {
  display: grid;
  grid-template-columns: 184px 1fr;
  gap: 22px;
  min-height: 141px;
}

.sheet-logo,
.tree-logo {
  display: block;
  width: 184px;
  height: 141px;
  object-fit: contain;
}

.identity-card,
.bordered-card {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 2px solid var(--border);
}

.identity-card {
  display: grid;
  grid-template-columns: 1fr 1.03fr;
  grid-auto-rows: minmax(29px, 1fr);
  gap: 0 10px;
  min-height: 141px;
  padding: 13px 10px;
}

.line-field {
  display: flex;
  align-items: end;
  min-width: 0;
  gap: 5px;
  font-family: var(--display-font);
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.line-field input,
.line-field select {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 1px 3px 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-family: var(--body-font);
  font-size: 18px;
  font-weight: 400;
}

.identity-trope,
.physical-other {
  grid-column: 1 / -1;
}

.page-one-grid,
.mechanics-grid {
  display: grid;
  grid-template-columns: 442px 277px;
  gap: 23px;
  margin-top: 23px;
}

.mechanics-heading {
  display: grid;
  grid-template-columns: 184px 1fr;
  gap: 22px;
  min-height: 141px;
}

.mechanics-title {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 141px;
  padding: 8px;
  margin: 0;
  color: #fff;
  background: var(--ink);
  font-family: var(--section-font);
  font-size: 52px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.mechanics-column .resource-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 0;
}

.mechanics-column .resource-card .section-title {
  font-size: 23px;
}

.mechanics-column .token-counter {
  gap: 6px;
}

.mechanics-column .token-counter button {
  width: 55px;
}

.mechanics-column .token-counter output {
  min-width: 50px;
}

.mechanics-traits {
  padding-top: 20px;
}

.character-column,
.utility-column,
.mechanics-column,
.mechanics-stats-column {
  min-width: 0;
}

.traits-card {
  padding: 0 9px 9px;
}

.traits-card > .section-title,
.trope-questions-card > .section-title,
.strength-actions-card > .section-title {
  width: calc(100% + 18px);
  margin-inline: -9px;
}

.structured-traits {
  display: grid;
  gap: 10px;
  padding: 12px 0 8px;
}

.structured-traits select,
.structured-traits input,
.structured-traits textarea,
.question-fields textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: #fff;
  font-family: var(--body-font);
  font-size: 15px;
}

.structured-traits select,
.structured-traits input {
  height: 34px;
  padding: 3px 4px;
}

.structured-traits textarea {
  min-height: 64px;
  padding: 4px;
  line-height: 27px;
}

.trait-choice-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(155px, 2fr);
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.trait-choice-row:has(.custom-trait-name:not([hidden])) {
  grid-template-columns: minmax(115px, 0.75fr) minmax(105px, 0.7fr) minmax(145px, 1fr);
}

.cape-power-row {
  grid-template-columns: 1fr 1fr;
}

.trait-choice-row label,
.structured-line {
  min-width: 0;
}

.custom-trait-name,
.trait-description {
  display: grid;
  gap: 2px;
  font-family: var(--display-font);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.cape-power-row label,
.structured-line {
  display: grid;
  gap: 2px;
  font-family: var(--display-font);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.trait-choices {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  margin: 0;
  border: 2px solid var(--border);
}

.trait-choices legend {
  padding: 0 5px;
  font-family: var(--display-font);
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
}

.age-benefits {
  padding: 9px;
  border: 2px solid var(--ink);
  background: #f1f1f1;
}

.age-benefits h3,
.age-benefits p {
  margin: 0;
}

.age-benefits h3 {
  font-family: var(--display-font);
  font-size: 16px;
  text-transform: uppercase;
}

.age-benefits p,
.choice-help,
.effect-detail {
  font-size: 13px;
  line-height: 1.35;
}

.choice-help {
  min-height: 1.2em;
  margin: 0;
}

.lined-entry {
  position: relative;
  display: block;
  height: 67px;
  font-family: var(--display-font);
  font-size: 20px;
  font-weight: 800;
}

.lined-entry > span {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  padding: 1px 5px 0 0;
  background: var(--paper);
  line-height: 31px;
}

.lined-entry textarea {
  display: block;
  width: 100%;
  height: 65px;
  padding: 1px 3px 0;
  overflow: hidden;
  border: 0;
  background-color: transparent;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 29px,
    var(--ink) 29px,
    var(--ink) 31px,
    transparent 31px,
    transparent 33px
  );
  font-family: var(--body-font);
  font-size: 18px;
  font-weight: 400;
  line-height: 33px;
  text-indent: var(--label-indent);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 49px;
  padding: 3px 8px 0;
  margin: 0;
  border: 0;
  color: #fff;
  background: #030303;
  font-family: var(--section-font);
  font-size: 31px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}

.trope-questions-card,
.strength-actions-card {
  padding: 0 9px 12px;
  margin-top: 20px;
}

.question-fields {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.question-fields label {
  display: grid;
  gap: 5px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.question-fields textarea {
  min-height: 62px;
  padding: 4px;
  resize: vertical;
}

.sheet-action,
.strength-action {
  min-height: 34px;
  padding: 5px 9px;
  border: 2px solid var(--ink);
  color: #fff;
  background: var(--ink);
  font-family: var(--display-font);
  font-weight: 900;
  cursor: pointer;
}

.sheet-action {
  margin-top: 12px;
}

.sheet-action:hover:not(:disabled),
.strength-action:hover:not(:disabled) {
  color: var(--ink);
  background: #fff;
}

.sheet-action:disabled,
.strength-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.resource-cards {
  display: grid;
  gap: 14px;
  margin-top: 21px;
}

.resource-card {
  min-height: 100px;
}

.resource-card .section-title {
  float: none;
}

.strength-actions-content {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.strength-rule {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.strength-rule:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.strength-rule h3,
.strength-rule p {
  margin: 0;
}

.strength-rule h3 {
  font-family: var(--display-font);
  font-size: 17px;
}

.strength-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.token-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 49px;
}

.token-counter button {
  width: 70px;
  height: 34px;
  padding: 1px 8px 0;
  border: 2px solid var(--ink);
  background: #fff;
  font-family: var(--display-font);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}

.token-counter button:hover:not(:disabled) {
  color: #fff;
  background: var(--ink);
}

.token-counter button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.token-counter output {
  min-width: 66px;
  font-family: var(--display-font);
  font-size: 29px;
  font-weight: 900;
  text-align: center;
}

.writing-card {
  overflow: hidden;
}

.writing-card > label {
  display: block;
  height: calc(100% - 49px);
  padding: 0 8px;
}

.ruled-textarea {
  display: block;
  width: 100%;
  height: 100%;
  padding: 3px 2px 0;
  overflow: hidden;
  border: 0;
  background-color: transparent;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 37px,
    var(--ink) 37px,
    var(--ink) 39px,
    transparent 39px,
    transparent 40px
  );
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 40px;
}

.description-card {
  min-height: 342px;
  margin-top: 20px;
}

.stats-card {
  height: 640px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 96px);
  height: 288px;
}

.stat-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  border-top: 2px solid var(--border);
  border-right: 2px solid var(--border);
  font-size: 19px;
  text-transform: uppercase;
}

.stat-field:nth-child(even) {
  border-right: 0;
}

.stat-value-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px;
  grid-template-rows: 35px 20px;
  gap: 1px 4px;
  width: 100%;
  height: 58px;
  padding: 2px 6px 0;
}

.stat-value-fields select {
  width: 100%;
  min-width: 0;
  height: 35px;
  padding: 2px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.stat-adjustment {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 35px;
  border-bottom: 1px solid var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.stat-adjustment input {
  width: 100%;
  min-width: 0;
  height: 33px;
  padding: 2px;
  border: 0;
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.age-stat-bonus,
.stress-stat-indicator {
  color: #b31717;
  font-weight: 900;
}

.age-stat-bonus {
  grid-column: 1 / -1;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  text-transform: uppercase;
}

.stress-stat-indicator {
  margin-left: 0.2em;
  font-family: var(--display-font);
}

.stat-field button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 37px;
  padding: 0 4px 5px;
  border: 0;
  background: transparent;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.stat-field button:hover {
  color: #fff;
  background: var(--ink);
}

.die-roller-button {
  width: 100%;
  min-height: 46px;
  padding: 7px 12px;
  border: 0;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  background: #fff;
  font-family: var(--display-font);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.die-roller-button:hover {
  color: #fff;
  background: var(--ink);
}

.stat-modifiers {
  display: grid;
  grid-template-rows: repeat(3, 84px);
  border-top: 2px solid var(--border);
}

.stacked-line-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 31px 0;
  font-family: var(--display-font);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.stacked-line-field input,
.stacked-line-field select {
  width: 100%;
  height: 35px;
  padding: 2px 3px 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-family: var(--body-font);
  font-size: 18px;
  font-weight: 400;
  text-align: center;
}

.cape-stat-field {
  padding-top: 0;
}

.utility-card {
  height: 535px;
  margin-top: 24px;
  overflow: hidden;
}

.utility-column .utility-card {
  margin-top: 0;
}

.utility-list {
  display: grid;
  grid-template-rows: repeat(12, 1fr);
  height: 484px;
  padding: 0 9px 3px;
  margin: 0;
  list-style: none;
}

.utility-list li,
.utility-list label {
  display: block;
  min-height: 0;
}

.utility-list input {
  width: 100%;
  height: 100%;
  padding: 4px 2px 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  font-size: 18px;
}

/* Dice roller */

.dice-dialog {
  width: min(650px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: auto;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 10px 45px rgb(0 0 0 / 40%);
}

.dice-dialog::backdrop {
  background: rgb(0 0 0 / 58%);
}

.roll-form {
  margin: 0;
}

.roller-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 10px 16px;
  color: #fff;
  background: var(--ink);
}

.roller-eyebrow,
.roller-heading h2 {
  margin: 0;
  font-family: var(--display-font);
  font-weight: 900;
  text-transform: uppercase;
}

.roller-eyebrow {
  font-size: 13px;
  letter-spacing: 0.12em;
}

.roller-heading h2 {
  margin-top: 2px;
  font-size: 29px;
  line-height: 1;
}

.roller-close {
  width: 44px;
  height: 44px;
  padding: 0 0 4px;
  border: 2px solid #fff;
  color: #fff;
  background: transparent;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}

.roller-close:hover {
  color: var(--ink);
  background: #fff;
}

.roller-body {
  padding: 16px;
}

.roller-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.roller-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-family: var(--display-font);
  font-weight: 800;
}

.roller-fields .wide-field {
  grid-column: 1 / -1;
}

.roller-fields input,
.roller-fields select,
.roller-fields output {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: #fff;
  font-family: var(--body-font);
  font-weight: 400;
}

.roller-fields output {
  display: flex;
  align-items: center;
  background: #ededed;
  font-weight: 800;
}

.roller-fields small {
  font-family: var(--body-font);
  font-size: 0.78em;
  font-weight: 400;
}

.roller-fields .segmented-field {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.segmented-field legend {
  padding: 0;
  margin-bottom: 5px;
  font-family: var(--display-font);
  font-weight: 800;
}

.segmented-control {
  display: grid;
  min-width: 0;
}

.segmented-control-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-control-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.roller-fields .segmented-control label {
  display: block;
  min-width: 0;
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 0;
  opacity: 0;
}

.segmented-control span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 6px 5px;
  border: 2px solid var(--ink);
  background: #fff;
  font-family: var(--display-font);
  font-weight: 800;
  text-align: center;
}

.segmented-control label + label span {
  border-left: 0;
}

.segmented-control input:checked + span {
  color: #fff;
  background: var(--ink);
}

.segmented-control input:focus-visible {
  outline: 0;
}

.segmented-control input:focus-visible + span {
  position: relative;
  z-index: 1;
  outline: 3px solid #1769aa;
  outline-offset: 2px;
}

.segmented-control input:disabled + span {
  color: #777;
  background: #e8e8e8;
  cursor: not-allowed;
}

.roller-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  font-family: var(--display-font);
  font-weight: 800;
  cursor: pointer;
}

.roller-check input {
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: var(--ink);
}

.character-roll-effects,
.power-fields {
  padding: 8px 12px 12px;
  margin: 8px 0 0;
  border: 2px solid var(--border);
}

.character-roll-effects > legend,
.power-fields legend {
  padding: 0 6px;
  font-family: var(--display-font);
  font-weight: 900;
  text-transform: uppercase;
}

.character-effect-fields {
  margin-top: 8px;
}

.inline-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-check-label input {
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: var(--ink);
}

.power-fields:has(#roller-use-power:not(:checked)) .roller-fields {
  opacity: 0.45;
}

.stress-summary {
  min-height: 1.35em;
  margin: 12px 0;
  font-size: 14px;
  font-weight: 700;
}

.roll-button,
.copy-roll-button,
.roll-actions button {
  min-height: 42px;
  padding: 7px 14px;
  border: 2px solid var(--ink);
  color: #fff;
  background: var(--ink);
  font-family: var(--display-font);
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.roll-submit-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}

.roll-button,
.copy-roll-button {
  width: 100%;
  font-size: 20px;
}

.copy-roll-button {
  color: var(--ink);
  background: #fff;
  overflow-wrap: anywhere;
  text-transform: none;
}

.roll-button:hover:not(:disabled),
.roll-actions button:hover:not(:disabled) {
  color: var(--ink);
  background: #fff;
}

.copy-roll-button:hover:not(:disabled) {
  color: #fff;
  background: var(--ink);
}

.roll-button:disabled,
.copy-roll-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.roll-result {
  padding: 14px;
  margin-top: 14px;
  border: 2px solid var(--ink);
  background: #f1f1f1;
}

.roll-score,
.roll-outcome,
.roll-breakdown,
.roll-consequence {
  margin: 0;
}

.roll-score strong {
  display: block;
  font-family: var(--display-font);
  font-size: 36px;
  line-height: 1;
}

.roll-comparison,
.roll-outcome {
  font-weight: 800;
}

.roll-outcome,
.roll-breakdown,
.roll-consequence {
  margin-top: 8px;
  line-height: 1.35;
}

.roll-consequence {
  color: #8f1212;
  font-weight: 800;
}

.flaw-failure-control {
  margin-top: 10px;
}

.roll-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.roll-actions button {
  min-height: 36px;
  padding: 5px 9px;
  font-size: 13px;
}

.roll-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#adversity-spent {
  font-size: 14px;
  font-weight: 700;
}

/* Page three */

.physical-card {
  grid-template-columns: 1fr 1fr;
  padding-top: 19px;
}

.details-sections {
  display: grid;
  gap: 23px;
  margin-top: 23px;
}

.detail-card {
  height: 189px;
}

.relationship-card,
.notes-card {
  height: 225px;
}

/* Page four */

.sheet-four {
  padding: 24px 25px 19px;
}

.progression-scroll {
  width: 100%;
  overflow: visible;
}

.progression-tree {
  position: relative;
  width: 743px;
  height: 1055px;
  margin: 0 auto;
  background: #fff;
}

.tree-logo {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
}

.tree-lines {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 743px;
  height: 1055px;
  overflow: visible;
}

.column-lines line {
  stroke: #666;
  stroke-width: 1;
}

.skill-link {
  cursor: pointer;
}

.skill-link-hit,
.skill-link-line {
  fill: none;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.skill-link-hit {
  stroke: transparent;
  stroke-width: 30;
  pointer-events: stroke;
}

.skill-link-line {
  stroke: #dedede;
  stroke-width: 18;
  transition: stroke 120ms ease;
  pointer-events: none;
}

.skill-link[data-skill-state="available"] .skill-link-line {
  stroke: #888;
}

.skill-link[data-skill-state="active"] .skill-link-line {
  stroke: #111;
}

.skill-link[aria-disabled="true"] {
  cursor: not-allowed;
}

.skill-link:focus-visible {
  outline: none;
}

.skill-link:focus-visible .skill-link-line {
  stroke: #1769aa;
}

.tier-label {
  position: absolute;
  z-index: 2;
  font-family: Arial, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.tier-starting {
  top: 15px;
  left: 278px;
}

.tier-intermediate {
  top: 14px;
  left: 443px;
}

.tier-advanced {
  top: 15px;
  left: 600px;
}

.tier-final {
  top: 510px;
  left: 706px;
  writing-mode: horizontal-tb;
  transform: none;
}

.tree-node {
  --skill-state-color: #dedede;

  position: absolute;
  z-index: 4;
  display: block;
  width: 140px;
  margin: 0;
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 18px;
  text-align: center;
}

.tree-node[data-skill-state="available"] {
  --skill-state-color: #888;
}

.tree-node[data-skill-state="active"] {
  --skill-state-color: #111;
}

.tree-node textarea[data-skill-detail],
.tree-node select[data-skill-detail] {
  display: block;
  width: 100%;
  border: 4px solid var(--skill-state-color);
  background-color: #fff;
  font-family: var(--body-font);
  font-size: 16px;
  text-align: center;
  transition: border-color 120ms ease;
}

.tree-node [data-skill-detail]:disabled {
  color: #777;
  background-color: #f3f3f3;
  opacity: 1;
}

.skill-node-toggle {
  position: absolute;
  z-index: 2;
  top: -18px;
  right: 0;
  display: block;
  cursor: pointer;
}

.skill-node-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  border: 0;
  opacity: 0;
}

.skill-node-state {
  display: block;
  min-width: 52px;
  min-height: 20px;
  padding: 1px 5px;
  border: 2px solid var(--skill-state-color);
  color: #555;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  text-transform: uppercase;
}

.tree-node[data-skill-state="active"] .skill-node-state {
  color: #fff;
  background: #111;
}

.tree-node[data-skill-state="locked"] .skill-node-toggle {
  cursor: not-allowed;
}

.skill-node-badge,
.tree-node[data-skill-state="locked"] .skill-node-badge {
  cursor: default;
}

.skill-node-toggle input:focus-visible {
  outline: 0;
}

.skill-node-toggle input:focus-visible + .skill-node-state {
  outline: 3px solid #1769aa;
  outline-offset: 2px;
}

.skill-node-story {
  height: 56px;
  padding: 3px 7px 0;
  overflow: hidden;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 22px,
    #111 22px,
    #111 24px
  );
  line-height: 24px;
  resize: none;
}

.compact-node select[data-skill-detail] {
  height: 40px;
  padding: 3px 6px;
  line-height: 26px;
}

.compact-node select[data-skill-detail] + .skill-node-story {
  border-top-width: 0;
}

.node-caption {
  display: block;
  margin-top: 7px;
  text-align: center;
}

.root-node {
  width: 128px;
}

.root-title {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0.05em 0 0 0.5em;
  color: #fff;
  background: var(--skill-state-color);
  font-family: var(--section-font);
  font-size: 27px;
  font-weight: 400;
  text-align: left;
  text-transform: uppercase;
  transition: background 120ms ease;
}

.tree-node[data-skill-state="locked"] .root-title {
  color: #444;
}

.root-node textarea[data-skill-detail] {
  padding: 2px 7px;
  overflow: hidden;
  border-width: 0 4px 4px;
}

.root-node .node-caption {
  margin-top: 12px;
}

.cape-root {
  top: 285px;
  left: 0;
}

.cape-ability-starting {
  top: 184px;
  left: 146px;
}

.cape-ability-intermediate-one {
  top: 112px;
  left: 303px;
}

.cape-ability-intermediate-two {
  top: 235px;
  left: 303px;
}

.cape-ability-advanced {
  top: 278px;
  left: 464px;
}

.cape-final {
  top: 528px;
  left: 618px;
}

.cape-stat-two {
  top: 375px;
  left: 146px;
}

.cape-stat-three {
  top: 394px;
  left: 303px;
}

.cape-all-stats {
  top: 455px;
  left: 464px;
}

.cape-power-die {
  top: 558px;
  left: 303px;
}

.power-root {
  top: 732px;
  left: 0;
}

.power-die-six {
  top: 644px;
  left: 146px;
}

.power-die-eight {
  top: 690px;
  left: 303px;
}

.power-die-ten {
  top: 716px;
  left: 464px;
}

.power-use-starting {
  top: 860px;
  left: 146px;
}

.power-use-intermediate {
  top: 818px;
  left: 303px;
}

.team-tactic-intermediate {
  top: 955px;
  left: 303px;
}

.team-tactic-advanced {
  top: 926px;
  left: 464px;
}

@media (min-width: 1630px) {
  .toolbar {
    padding-inline: max(8px, calc((100vw - var(--spread-width)) / 2));
  }

  #character-sheet {
    grid-template-columns: repeat(2, var(--page-width));
  }
}

@media (max-width: 830px) {
  .toolbar {
    padding-inline: 12px;
  }

  #character-sheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding-block: 18px;
  }

  .sheet {
    justify-self: center;
    width: calc(100% - 24px);
  }

  .sheet-one,
  .sheet-two,
  .sheet-three,
  .sheet-four {
    min-height: 0;
  }

  .page-one-grid,
  .mechanics-grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr);
  }

  .sheet-four {
    padding: 24px;
  }

  .progression-tree {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 16px;
    width: 100%;
    height: auto;
    margin: 0;
  }

  .tree-logo {
    position: static;
    grid-column: 1 / -1;
    justify-self: center;
  }

  .tree-lines {
    display: none;
  }

  .tier-label {
    position: static;
    z-index: auto;
    padding: 6px;
    border: 1px solid var(--border);
    background: #f1f1f1;
    font-size: 12px;
    text-align: center;
    writing-mode: horizontal-tb;
    transform: none;
  }

  .tree-node,
  .root-node {
    position: relative;
    inset: auto;
    width: 100%;
  }

  .tree-node::before {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: left;
    text-transform: uppercase;
    content: attr(data-track) " · " attr(data-tier);
  }

  .tree-node [data-skill-detail] {
    min-width: 0;
    max-width: 100%;
  }

  .skill-node-toggle {
    top: -10px;
    right: -2px;
  }
}

@media (max-width: 760px) {
  .save-controls {
    justify-content: flex-end;
  }

  .save-status {
    flex: 1 1 100%;
    min-width: 0;
    text-align: right;
  }

  .toolbar-button {
    padding-inline: 8px;
    font-size: 0.78rem;
  }

  .sheet {
    width: calc(100% - 16px);
    padding: 16px;
  }

  .sheet-heading,
  .mechanics-heading {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: auto;
  }

  .mechanics-title {
    width: 100%;
    min-height: 96px;
    font-size: clamp(40px, 12vw, 52px);
  }

  .sheet-logo {
    width: 170px;
    height: 130px;
  }

  .identity-card {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 8px;
    width: 100%;
    height: auto;
    padding: 14px;
  }

  .identity-trope,
  .physical-other {
    grid-column: auto;
  }

  .page-one-grid,
  .mechanics-grid {
    grid-template-columns: 1fr;
  }

  .traits-card,
  .stats-card,
  .description-card,
  .utility-card,
  .detail-card,
  .relationship-card,
  .notes-card {
    height: auto;
  }

  .traits-card {
    padding-bottom: 9px;
  }

  .trait-choice-row,
  .trait-choice-row:has(.custom-trait-name:not([hidden])),
  .cape-power-row {
    grid-template-columns: 1fr;
  }

  .description-card > label,
  .detail-card > label {
    height: auto;
  }

  .description-card .ruled-textarea {
    height: 300px;
  }

  .utility-column,
  .mechanics-column,
  .mechanics-stats-column {
    display: grid;
    gap: 20px;
  }

  .stats-card {
    min-height: 592px;
  }

  .utility-card {
    margin-top: 0;
  }

  .details-sections {
    gap: 20px;
  }

  .detail-card .ruled-textarea {
    height: 140px;
  }

  .relationship-card .ruled-textarea,
  .notes-card .ruled-textarea {
    height: 180px;
  }

  .section-title {
    font-size: clamp(23px, 7vw, 31px);
  }

  .roller-fields {
    grid-template-columns: 1fr;
  }

  .roller-fields .wide-field {
    grid-column: auto;
  }

  .roller-heading h2 {
    font-size: 24px;
  }

  .roll-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .mechanics-column .strength-actions-card {
    margin-top: 0;
  }
}

@media (max-width: 430px) {
  .mechanics-column .resource-cards,
  .progression-tree,
  .roll-submit-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .lined-entry {
    font-size: 17px;
  }

  .lined-entry textarea {
    font-size: 16px;
  }

  .line-field {
    font-size: 18px;
  }

  .stacked-line-field {
    padding-inline: 18px;
    font-size: 18px;
  }
}
