.character-content {
  font-family: var(--font-primary);
  font-size: calc(var(--font-size-standard) * 1);
  color: var(--color-dark-1);
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: scroll;

  nav.tabs {
    background-image: url("../assets/ui/prism_rpg_background.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 2px 0;
  }

  nav.tabs [data-tab] {
    color: #636060;
    font-size: calc(var(--font-size-standard) * 1.1);
    font-family: var(--font-secondary);
    font-weight: bold;
    padding: 3px 16px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;

    &:hover {
      background-color: rgba(255, 255, 255, 0.7);
      color: #1a1a1a;
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
      border-color: rgba(107, 107, 107, 0.3);
    }
  }

  nav.tabs [data-tab].active {
    color: #000000;
    background-color: rgba(255, 255, 255, 0.85);
    text-shadow: 1px 1px 3px rgba(255, 255, 255, 1);
    border: 2px solid #6b6b6b;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);

    &:hover {
      background-color: rgba(255, 255, 255, 0.95);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
      transform: translateY(-2px);
      border-color: #4a4a4a;
    }
  }

  input:disabled,
  select:disabled {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: transparent;
    color: var(--color-dark-3);
  }

  input,
  select {
    height: 1.5rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-color: var(--color-dark-6);
    color: var(--color-dark-2);
  }

  input[name="name"] {
    height: 2.5rem;
    margin-right: 4px;
    font-family: var(--font-secondary);
    font-size: calc(var(--font-size-standard) * 1.2);
    font-weight: bold;
    border: none;
  }

  fieldset {
    margin-bottom: 4px;
    border-radius: 4px;
  }

  .form-fields {
    input,
    select {
      text-align: center;
      font-size: calc(var(--font-size-standard) * 1);
    }
    select {
      font-family: var(--font-secondary);
      font-size: calc(var(--font-size-standard) * 1);
    }
  }

  legend {
    font-family: var(--font-secondary);
    font-size: calc(var(--font-size-standard) * 1.2);
    font-weight: bold;
    letter-spacing: 1px;
  }

  .character-sheet-common();
}

.character-main {
  display: flex;

  .character-pc {
    display: flex;
    gap: 10px;
    flex: 1;

    .character-left {
      min-width: 200px;
      max-width: 200px;
      display: flex;
      flex-direction: column;

      .character-left-image {
        display: flex;
        justify-content: center;
        align-items: center;
        padding-bottom: 8px;
        .character-img {
          height: 140px;
          width: 140px;
          width: auto;
          border: none;
        }
      }
      .character-hp {
        display: flex;
        gap: 4px;
        align-items: center;
        margin-bottom: 4px;
        .name {
          flex: none;
          min-width: 2.5rem;
          max-width: 2.5rem;
        }
        input {
          flex: none;
          min-width: 2.2rem;
          max-width: 2.2rem;
          margin-left: 4px;
          font-size: calc(var(--font-size-standard) * 1);
        }
        .character-hp-max {
          clear: both;
          display: flex;
          flex-direction: row;
          flex-wrap: wrap;
          margin: 4px 0;
          align-items: center;
          input {
            width: 3.2rem;
            text-align: center;
            font-size: calc(var(--font-size-standard) * 1);
          }
        }
      }
    }

    .character-right {
      display: flex;
      flex-direction: column;
      gap: 4px;

      .character-name {
        display: flex;
        input {
          width: 400px;
        }
      }
    }
  }

  .character-pc-play {
    min-width: 320px;
  }

  .character-pc-edit {
    min-width: 320px;
  }

  .character-characteristics {
    display: flex;
    flex-direction: column;
    gap: 4px;

    .character-characteristic {
      display: flex;
      align-items: center;
      span {
        min-width: 2.2rem;
        max-width: 2.2rem;
      }
      .rollable:hover,
      .rollable:focus {
        text-shadow: 0 0 8px var(--color-shadow-primary);
        cursor: pointer;
      }
      .form-group {
        flex: 1;
        padding-left: 4px;
        .form-fields {
          flex: none;
          width: 3rem;
        }
      }
    }
  }

  .character-challenges {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;

    .character-challenge {
      display: flex;
      align-items: center;
      margin-right: 0.5rem;
      .rollable:hover,
      .rollable:focus {
        text-shadow: 0 0 8px var(--color-shadow-primary);
        cursor: pointer;
      }
      .name {
        flex: 1;
        min-width: 3rem;
        margin-left: 0.5rem;
      }
      .form-group {
        flex: 1;
        padding-left: 4px;
        .form-fields {
          flex: none;
          width: 50px;
        }
      }
    }
  }

  .character-movements {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;

    .character-movement {
      display: flex;
      align-items: center;
      margin-right: 0.5rem;
      .rollable:hover,
      .rollable:focus {
        text-shadow: 0 0 8px var(--color-shadow-primary);
        cursor: pointer;
      }
      .name {
        flex: 1;
        min-width: 3rem;
        margin-left: 0.5rem;
      }
      .form-group {
        flex: 1;
        padding-left: 4px;
        .form-fields {
          flex: none;
          width: 50px;
        }
      }
    }
  }

  .character-saves {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;

    .character-save {
      display: flex;
      align-items: center;
      margin-right: 0.5rem;
      .rollable:hover,
      .rollable:focus {
        text-shadow: 0 0 8px var(--color-shadow-primary);
        cursor: pointer;
      }
      .name {
        flex: 0;
        min-width: 5rem;
        max-width: 5rem;
        margin-left: 0.5rem;
      }
      .name-pain {
        flex: 0;
        min-width: 3rem;
        max-width: 3rem;
        margin-left: 0.5rem;
      }
      .form-group {
        flex: 0;
        padding-left: 4px;
        .form-fields {
          flex: none;
          width: 50px;
        }
      }
    }
  }

  .character-characteristics-play {
    min-width: 160px;
  }

  .character-characteristic-edit {
    min-width: 160px;
  }
}

.tab.character-biography .main-div {
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 8px 10px;
  min-height: 100%;

  .biodata {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    .biodata-elem {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        width: 24px;
        height: 24px;
        margin: 4px 0 0 0;
      }
      .name {
        min-width: 8rem;
      }
    }
  }
}

.character-biography {
  prose-mirror.inactive {
    min-height: 40px;
  }
  prose-mirror.active {
    min-height: 150px;
  }
}

.tab.character-skills .main-div {
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 8px 10px;
  min-height: 100%;

  display: grid;
  grid-template-columns: 1fr;
  legend {
    a {
      font-size: calc(var(--font-size-standard) * 1);
      padding-left: 4px;
    }
  }
  .skills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    .skill {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      background: rgba(255, 255, 255, 0.3);
      border: 2px solid #6b6b6b;
      border-radius: 6px;
      transition: all 0.2s;

      &:hover {
        background: rgba(255, 255, 255, 0.5);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      }

      &.is-core-skill {
        background: rgba(255, 235, 180, 0.4);
        border-color: #d4a017;

        &:hover {
          background: rgba(255, 235, 180, 0.6);
        }
      }

      .item-img {
        width: 32px;
        height: 32px;
        border: 2px solid #6b6b6b;
        border-radius: 4px;
        object-fit: cover;
        flex-shrink: 0;
      }

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

        a {
          font-family: "Cinzel", serif;
          font-size: 14px;
          font-weight: 600;
          color: #2c2c2c;

          i {
            margin-right: 6px;
            color: #6b6b6b;
          }

          &:hover {
            color: #000;
          }
        }
      }

      .score {
        font-family: "Cinzel", serif;
        font-size: 16px;
        font-weight: bold;
        color: #2c2c2c;
        min-width: 50px;
        text-align: center;

        .advanced-icon {
          color: #d4a017;
          font-size: 18px;
          margin-left: 4px;
        }
      }

      .controls {
        display: flex;
        gap: 8px;
        flex-shrink: 0;

        a {
          color: #6b6b6b;
          font-size: 14px;
          transition: color 0.2s;

          &:hover {
            color: #2c2c2c;
          }
        }
      }
    }
  }
  .racial-abilities {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    .racial-ability {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      background: rgba(200, 255, 200, 0.2);
      border: 2px solid #6b9b6b;
      border-radius: 6px;
      transition: all 0.2s;

      &:hover {
        background: rgba(200, 255, 200, 0.4);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      }

      .item-img {
        width: 32px;
        height: 32px;
        border: 2px solid #6b9b6b;
        border-radius: 4px;
        object-fit: cover;
        flex-shrink: 0;
      }

      .name {
        flex: 1;
        min-width: 0;
        font-family: "Cinzel", serif;
        font-size: 14px;
        font-weight: 600;
        color: #2c2c2c;
      }

      .controls {
        display: flex;
        gap: 8px;
        flex-shrink: 0;

        a {
          color: #6b9b6b;
          font-size: 14px;
          transition: color 0.2s;

          &:hover {
            color: #3c6b3c;
          }
        }
      }
    }
  }
  .vulnerabilities {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    .vulnerability {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      background: rgba(255, 200, 200, 0.2);
      border: 2px solid #9b6b6b;
      border-radius: 6px;
      transition: all 0.2s;

      &:hover {
        background: rgba(255, 200, 200, 0.4);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      }

      .item-img {
        width: 32px;
        height: 32px;
        border: 2px solid #9b6b6b;
        border-radius: 4px;
        object-fit: cover;
        flex-shrink: 0;
      }

      .name {
        flex: 1;
        min-width: 0;
        font-family: "Cinzel", serif;
        font-size: 14px;
        font-weight: 600;
        color: #2c2c2c;
      }

      .controls {
        display: flex;
        gap: 8px;
        flex-shrink: 0;

        a {
          color: #9b6b6b;
          font-size: 14px;
          transition: color 0.2s;

          &:hover {
            color: #6b3c3c;
          }
        }
      }
    }
  }
}

.tab.character-equipment .main-div {
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 8px 10px;
  min-height: 100%;

  display: grid;
  grid-template-columns: 1fr;
  legend {
    a {
      font-size: calc(var(--font-size-standard) * 1.4);
      padding-left: 4px;
    }
  }

  .moneys {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .equipments {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    .equipment {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        width: 24px;
        height: 24px;
        margin: 4px 0 0 0;
      }
      .name {
        min-width: 12rem;
      }
    }
    .name {
      min-width: 12rem;
    }
  }

  .inv-section {
    margin-bottom: 6px;
    .inv-items {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .inv-item {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 2px 4px;
      border-radius: 3px;
      background: rgba(255,255,255,0.15);
      &:hover { background: rgba(255,255,255,0.25); }
      .item-img {
        width: 24px;
        height: 24px;
        cursor: pointer;
        flex-shrink: 0;
      }
      .inv-name {
        flex: 1;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .inv-qty {
        display: flex;
        align-items: center;
        gap: 2px;
        font-size: 11px;
        min-width: 48px;
        justify-content: center;
        a {
          font-size: 9px;
          cursor: pointer;
          color: rgba(0,0,0,0.4);
          &:hover { color: rgba(0,0,0,0.8); }
        }
        span {
          min-width: 16px;
          text-align: center;
        }
      }
      .inv-enc, .inv-uses, .inv-capacity {
        font-size: 11px;
        color: #555;
        min-width: 30px;
        text-align: center;
        white-space: nowrap;
      }
      .controls {
        display: flex;
        gap: 4px;
        a { font-size: 12px; cursor: pointer; }
      }
    }
    .inv-empty {
      font-style: italic;
      color: rgba(0,0,0,0.4);
      text-align: center;
      font-size: 11px;
      padding: 4px;
    }

    // Container drag-drop highlight
    .inv-container[data-container-id] {
      border: 1px dashed transparent;
      transition: border-color 0.15s, background 0.15s;
      &.drag-over {
        border-color: rgba(100, 150, 255, 0.7);
        background: rgba(100, 150, 255, 0.12);
      }
    }

    // Items nested inside a container
    .inv-container-items {
      margin: 2px 0 6px 28px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      border-left: 2px solid rgba(0,0,0,0.15);
      padding-left: 8px;
    }

    .inv-container-item {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 2px 4px;
      border-radius: 3px;
      background: rgba(0,0,0,0.06);
      &:hover { background: rgba(0,0,0,0.12); }
      .item-img {
        width: 20px;
        height: 20px;
        cursor: pointer;
        flex-shrink: 0;
      }
      .inv-name {
        flex: 1;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .inv-qty {
        display: flex;
        align-items: center;
        gap: 2px;
        font-size: 10px;
        min-width: 40px;
        justify-content: center;
        a {
          font-size: 8px;
          cursor: pointer;
          color: rgba(0,0,0,0.4);
          &:hover { color: rgba(0,0,0,0.8); }
        }
        span {
          min-width: 14px;
          text-align: center;
        }
      }
      .inv-enc {
        font-size: 10px;
        color: #555;
        min-width: 24px;
        text-align: center;
      }
      .inv-container-type-badge {
        font-size: 9px;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: rgba(0,0,0,0.45);
        background: rgba(0,0,0,0.07);
        border-radius: 3px;
        padding: 1px 4px;
        flex-shrink: 0;
      }
      .controls {
        display: flex;
        gap: 4px;
        a { font-size: 11px; cursor: pointer; }
      }
    }

    .inv-container-empty {
      margin: 2px 0 4px 36px;
      font-size: 10px;
      font-style: italic;
      color: rgba(0,0,0,0.35);
    }
  }

  .pack-burden-fieldset {
    .pack-burden-display {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 0;
      font-size: 13px;

      .pack-burden-label {
        font-weight: bold;
      }
      .pack-burden-value {
        font-weight: bold;
        .pack-burden-used { color: #e6a817; }
        .pack-burden-sep { color: rgba(0,0,0,0.4); }
        .pack-burden-max { color: rgba(0,0,0,0.7); }
      }
    }
    .pack-burden-used { color: #e6a817; font-weight: bold; }
    .pack-burden-sep { color: rgba(0,0,0,0.4); margin: 0 2px; }
    .pack-burden-max { color: rgba(0,0,0,0.7); font-weight: bold; }
  }
}

.tab.character-combat .main-div {
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 8px 10px;
  min-height: 100%;

  display: grid;
  grid-template-columns: 1fr;
  legend {
    a {
      font-size: calc(var(--font-size-standard) * 1.4);
      padding-left: 4px;
    }
  }

  .combat-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    .combat-detail {
      display: flex;
      align-items: center;
      gap: 4px;
      .input {
        min-width: 2.5rem;
        max-width: 2.5rem;
      }
      .ranged-attack-button {
        font-size: 0.8rem;
      }
      button {
        min-width: 9rem;
      }
      .armor-hp {
        margin-right: 4px;
        .name {
          min-width: 6rem;
          max-width: 6rem;
        }
        min-width: 10rem;
        max-width: 10rem;
        .input {
          min-width: 2.5rem;
          max-width: 2.5rem;
        }
      }
      .granted {
        min-width: 8rem;
        max-width: 8rem;
        .input {
          min-width: 2.5rem;
          max-width: 2.5rem;
        }
      }
    }
  }

  .wounds {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    .wound {
      display: flex;
      align-items: center;
      gap: 4px;
      .wound-description {
        min-width: 14rem;
        max-width: 14rem;
      }
      .wound-duration {
        min-width: 3rem;
        max-width: 3rem;
      }
      .wound-value {
        min-width: 3rem;
        max-width: 3rem;
      }
      .item-img {
        width: 24px;
        height: 24px;
        margin: 4px 0 0 0;
      }
      .name {
        min-width: 12rem;
      }
    }
  }

  .weapons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    .weapon {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        width: 24px;
        height: 24px;
        margin: 4px 0 0 0;
      }
      .name {
        min-width: 12rem;
      }
      .attack-icons a {
        margin-left: 8px;
        margin-right: 8px;
      }
    }
  }
  .armors {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    .armor {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        width: 24px;
        height: 24px;
        margin: 4px 0 0 0;
      }
    }
    .name {
      min-width: 12rem;
    }
    .item-detail {
      min-width: 2rem;
    }
  }
  .shields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    min-width: 20rem;
    .shield {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        width: 24px;
        height: 24px;
        margin: 4px 0 0 0;
      }
    }
    .item-detail {
      min-width: 2.5rem;
    }
    .name {
      min-width: 12rem;
    }
  }
}

.tab.character-spells .main-div {
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 8px 10px;
  min-height: 100%;

  display: grid;
  grid-template-columns: 1fr;
  legend {
    a {
      font-size: calc(var(--font-size-standard) * 1.4);
      padding-left: 4px;
    }
  }

  .spell-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    .spell-detail {
      display: flex;
      align-items: center;
      gap: 4px;
      button {
        min-width: 10rem;
      }
      .armor-hp {
        min-width: 12rem;
        max-width: 12rem;
        .input {
          flex: 0;
          min-width: 3rem;
          max-width: 3rem;
        }
      }
    }
  }

  .spells {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    min-width: 18rem;
    .spell {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        min-width: 24px;
        max-width: 24px;
        height: 24px;
      }
      .name {
        min-width: 12rem;
      }
    }
  }

  prose-mirror.inactive {
    min-height: 40px;
  }
  prose-mirror.active {
    min-height: 150px;
  }
}

.tab.character-miracles .main-div {
  background-image: url("../assets/ui/prism_rpg_background.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 8px 10px;
  min-height: 100%;

  display: grid;
  grid-template-columns: 1fr;
  legend {
    a {
      font-size: calc(var(--font-size-standard) * 1.4);
      padding-left: 4px;
    }
  }

  .miracle-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    .miracle-detail {
      display: flex;
      align-items: center;
      gap: 4px;
      button {
        min-width: 10rem;
      }
      .armor-hp {
        min-width: 20rem;
        max-width: 20rem;
        .input {
          min-width: 3rem;
          max-width: 3rem;
        }
      }
    }
  }

  .miracles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    min-width: 18rem;
    .miracle {
      display: flex;
      align-items: center;
      gap: 4px;
      .item-img {
        width: 24px;
        height: 24px;
      }
      .name {
        min-width: 12rem;
      }
    }
  }

  prose-mirror.inactive {
    min-height: 40px;
  }
  prose-mirror.active {
    min-height: 150px;
  }
}

// Equipped item visual feedback
.inv-item {
  &.is-equipped {
    background: rgba(100, 180, 100, 0.12);
    border-left: 2px solid rgba(80, 160, 80, 0.6);
  }
  .equipped-icon {
    color: #5a9e6a;
  }
  .unequipped-icon {
    color: rgba(0, 0, 0, 0.25);
  }
}

// Burden overload warning
.burden-excess {
  font-size: 0.75em;
  color: #ff5c5c;
  margin-left: 4px;
  white-space: nowrap;
}

// Depleted consumable button
.controls a.disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}
