body {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: system-ui, sans-serif;
  margin: 0;
  background: url("./assets/body_bg.png") repeat-y;
  background-position: center 0px; 
  background-size: 794px;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

.page {
  overflow: scroll;
  position: relative;
  height: 1091px;
  margin: 15px 0;
}

.page > img {
  position: relative;
  top: -1px;
  width: 794px;
  height: 1075px;
}

/* Form layer */
.form-layer {
  position: absolute;
  inset: 0;
}

.field {
  background: transparent;
  border: none;
  border-bottom: 1px dotted #999;
  padding: 2px;
  font-size: 17px;
}

.text-input {
  font-size: 17px;
  padding: 0px 4px;
  color: #000;
}

.field:focus {
  outline: none;
}

.bullet {
  display: inline-block;
  background-color: #fff;
  width: 3px;
  height: 3px;
  border: 1px solid #929292;
  border-radius: 50%;
}

.page1 .top-left {
  position: absolute;
  top: -1px;
  left: 0;
  width: 350px;
  height: 550px;
}

.page1 .top-left .field.name {
  position: relative;
  top: 89px;
  left: 98px;
  width: 136px;
  background: white;
}

.page1 .top-left .level {
  position: relative;
  top: 108px;
  left: 102px;
  background: white;
  font-size: 21px;
  font-weight: 600;
  width: 78px;
}

.page1 .upload-container {
  position: relative;
  top: 188px;
  width: 242px;
  height: 259px;
  left: 36px;
  display: flex;
  overflow: hidden;
  clip-path: polygon(    
    75% 0,
    73% 5%,
    79% 13%,
    92% 13%,
    92% 22%,
    94% 30%,
    97% 32%,
    90% 36%,
    89% 39%,
    88% 44%,
    97% 44%,
    100% 47%,
    98% 56%,
    96% 61%,
    91% 71%,
    94% 76%,
    91% 80%,
    86% 85%,
    84% 90%,
    86% 91%,
    77% 94%,
    70% 97%,
    69% 99%,
    63% 96%,
    62% 95%,
    60% 95%,
    60% 90%,
    56% 90%,
    51% 84%,
    45% 91%,
    41% 90%,
    41% 94%,
    42% 95%,
    32% 100%,
    29% 96%,
    21% 96%,
    17% 91%,
    18% 90%,
    14% 85%,
    12% 83%,
    10% 79%,
    7% 76%,
    10% 71%,
    7% 65%,
    2% 51%,
    1% 39%,
    6% 19%,
    9% 13%,
    13% 13%,
    25% 8%,
    25% 0
  );
}

.page1 .upload-label {
  display: inline-block;
  padding: 10px 15px;
  cursor: pointer;
  margin: auto;
  background-color: #b4b4b4; /* Blue background */
  color: black; /* White text and icon color */
  border-radius: 5px;
  font-size: 16px;
  text-align: center;
  transition: background-color 0.3s;
  transform: translateY(-8px);
}

.page1 .upload-label:hover {
  background-color: #aaa; /* Darker blue on hover */
}

.page1 .file-input {
  visibility: hidden;
  position: absolute;
  z-index: -1;
  opacity: 0;
  width: 0;
  height: 0;
}

.page1 #image-preview {
  width: 100%;
}

.page1 .top-right {
  position: absolute;
  width: 335px;
  height: 249px;
  background: white;
  left: 417px;
  top: 148px;
  display: flex;
  flex-flow: wrap;
  gap: 4px;
  font-size: 17px;
}
.page1 .top-right > .checkbox-with-text {
  width: calc(50% - 2px);
  display: flex;
  gap: 4px;
  flex-grow: 0;
  align-items: center;
  font-weight: 500;
}

.page1 .top-right > .checkbox-with-text.double-width {
  width: 100%;
  display: flex;
  flex-grow: 0;
  align-items: center;
}

.page1 .top-right > .checkbox-with-text > .text-input {
  width: 100px;
}

.page1 .checkbox-with-text.double-width .text-input {
  width: 70px;
}

.page1 .bottom-left {
  position: absolute;
  width: 380px;
  height: 490px;
  top: 550px;
  left: 0px;
}

.page1 .bottom-right {
  position: absolute;
  width: 414px;
  height: 593px;
  top: 448px;
  right: 0px;
}

.page3 .top {
  background: white;
  position: absolute;
  width: 21%;
  height: 4%;
  right: 15.9%;
  top: 8%;
  border-radius: 15px;
  font-weight: 500;
}

.page3 .top .hp {
  margin-left: 10px;

}
.page3 .top .hp .text-input {
  width: 100px;
}
.page3 .top .initial-hp {
  margin-left: 5px;
}

.page3 .top .initial-hp .text-input {
  width: 71px;
}

.page3 .middle {
  background: white;
  position: absolute;
  width: 11%;
  height: 2%;
  left: 45%;
  top: 15.7%;
}

.page3 .middle input {
  width: 100%;
  text-align: center;
  font-weight: 500;
  font-size: 16px;
}

.page3 .middle-right {
  background: white;
  position: absolute;
  width: 16%;
  height: 2%;
  left: 68%;
  top: 13.6%;
  padding-left: 1%;
  clip-path: polygon(5% 0%, 1% 50%, 2% 100%, 79% 95%, 85% 88%, 100% 82%, 100% 22%, 80% 26%, 72.5% 34%, 65% 7%);
  font-weight: 500;
  font-size: 16px;
}

.page3 .middle-right input {
  width: 50px;
  font-weight: 500;
  font-size: 16px;
}

.page3 .bottom {
  position: absolute;
  width: 100%;
  height: calc(100% - 219px);
  top: 219px;
}

.page3 .bottom input#speed {
  position: absolute;
  right: 20.4%;
  display: block;
  width: 36px;
  top: 11.3%;
  font-size: 15px;
  background: white;
}

.page3 .bottom div#occupation-attributes {
  position: absolute;
  top: 27.6%;
  left: 33%;
  width: 54%;
  height: 11.6%;
  font-size: 15px;
  line-height: 18px;
  margin: 0;
}

.page3 .bottom div#occupation-attributes div#block {
  height: 100%;
  width: 85px;
  float: right;
}

.page3 .bottom div#occupation-attributes-2 {
  position: absolute;
  top: 53.2%;
  left: 38%;
  width: 55.5%;
  height: 45.6%;
  font-size: 15px;
  line-height: 18px;
  margin: 0;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  accent-color: black;
  border: 1px solid #767676;
  border-radius: 2px;
  background-color: white;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
}

input[type="checkbox"]:hover {
  border-color: #404040;
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid black;
  outline-offset: 2px;
}

input[type="checkbox"]:checked {
  background-color: #404040;
  border-color: #404040;
}

input[type="checkbox"]:checked::before {
  content: "";
  width: 5px;
  height: 3px;
  border: 1.5px solid white;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg);
  margin-top: -0.5px;
}

input[type="checkbox"]:disabled {
  background-color: #f0f0f0;
  border-color: #c6c6c6;
  cursor: not-allowed;
}

input[type="checkbox"]:checked:disabled {
  background-color: #a0a0a0;
  border-color: #a0a0a0;
}

.page4 .top {
  position: relative;
  height: 30%;
  width: 100%;
}

.page4 .top input[type=checkbox] {
  margin-bottom: 16px;
  margin-top: 5px;
}

.page4 .top .regular {
  position: absolute;
  left: 54.8%;
  top: 34.5%;
  display: grid;
  width: 31.5%;
  grid-template-columns: 1fr 1fr;
  justify-items: start;
}

.page4 .top .athletic {
  position: absolute;
  top: 63.3%;
  left: 8.6%;
  display: grid;
}

.page4 .top .survival {
  position: absolute;
  top: 63.3%;
  left: 25.8%;
  display: grid;
}

.page4 .top .personal {
  position: absolute;
  top: 63.3%;
  left: 43.2%;
  display: grid;
}

.page4 .top .stealth {
  position: absolute;
  top: 63.3%;
  left: 61.6%;
  display: grid;
}

.page4 .top .performance {
  position: absolute;
  top: 63.3%;
  left: 79.8%;
  display: grid;
}

.page4 .bottom-left {
  position: absolute;
  top: 40%;
  height: 45%;
  width: 30%;
}

.page4 .bottom-left input[type=checkbox] {
  margin-bottom: 15.3px;
}

.page4 .bottom-left .learning {
  position: absolute;
  top: 8.3%;
  left: 31.2%;
  display: grid;
}

.page4 .bottom-left .knowledge {
  position: absolute;
  top: 28.6%;
  left: 31.2%;
  display: grid;
}

.page4 .bottom-middle {
  position: absolute;
  top: 39%;
  height: 57%;
  left: 30%;
  width: 35%;
}

.page4 .bottom-middle .race-skills {
  position: absolute;
  top: 37.5%;
  left: 16.8%;
  width: 70%;
  line-height: 22px;
  font-size: 14px;
}

.page4 .bottom-middle .interaction-cover {
  position: absolute;
  inset: 0;
}

.page4 .bottom-right {
  position: absolute;
  top: 38.5%;
  height: 60%;
  left: 65%;
  width: 34%;
}

.page5 .spell-tier {
  display: flex;
  position: absolute;
  left: 4.5%;
  width: 91.4%;
  height: 12.6%;
  overflow: hidden;
  background: white;
  gap: 10px;
}

.page5 .spell-tier:nth-of-type(1) {
  top: 12.5%;
  border-radius: 0 0 0 38px;
}

.page5 .spell-tier:nth-of-type(2) {
  top: 29.6%;
  border-radius: 0 0 50px 0;
}

.page5 .spell-tier:nth-of-type(3) {
  top: 46.8%;
  border-radius: 0 0 0 38px;
}

.page5 .spell-tier:nth-of-type(4) {
  top: 63.9%;
  border-radius: 0 0 50px 0;
}

.page5 .spell-tier:nth-of-type(5) {
  top: 81%;
  border-radius: 0 0 0 38px;
}

.page5 .spell {
  width: 25%;
  height: 100%;
}

.page5 .spell .name,
.page5 .spell .ingrediants,
.page5 .spell .distance,
.page5 .spell .action-type {
  width: 100%;
  display: flex;
  font-size: 12px;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.page5 .spell .effect {
  width: 100%;
  position: relative;
  font-size: 12px;
  display: flex;
  align-items: center;
}

.page5 .spell .action-type {
  justify-content: center;
  margin-top: 6px;
}

.page5 .spell .bullet {
  flex-shrink: 0;
}

.page5 .spell .label {
  white-space: nowrap;
}

.page5 .spell input[type="text"] {
  font-size: 12px;
  padding: 0 0 0 4px;
}

.page5 .spell .effect .label {
  position: absolute;
  top: 0;
  left: 0;
  background: white;
  display: flex;
  align-items: center;
}

.page5 .spell .effect .label .bullet {
  margin-right: 2px;
}

.page5 .spell .effect-text {
  width: 100%;
  height: 60px;
  line-height: 15px;
  font-size: 12px;
  text-indent: 34px;
  text-decoration: dotted underline #999;
  background-color: white;
}

.page5 .spell .effect-place-holder.row-1 {
  width: calc(100% - 34px);
  height: 12.8px;
  position: absolute;
  top: 0;
  left: 34px;
  border-bottom: 1px dotted #999;
}

.page5 .spell .effect-place-holder.row-2 {
  width: 100%;
  height: 15px;
  position: absolute;
  top: 12.8px;
  left: 0;
  border-bottom: 1px dotted #999;
}

.page5 .spell .effect-place-holder.row-3 {
  width: 100%;
  height: 15px;
  position: absolute;
  top: 27.8px;
  left: 0;
  border-bottom: 1px dotted #999;
}

.page5 .spell .effect-place-holder.row-4 {
  width: 100%;
  height: 15px;
  position: absolute;
  top: 42.8px;
  left: 0;
  border-bottom: 1px dotted #999;
}

.page5 .spell .distance input {
  width: 20px;
}

/* Dialog */
#dialog {
  display: none;
  position: fixed;
  background: white;
  width: 700px;
  max-width: 100%;
  height: 90vh;
  top: 5vh;
  overflow: scroll;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 5px;
  z-index: 2;
}

#dialog-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  background-color: rgba(255, 255, 255, 0.8);
}

body.dialog-opened {
  overflow: hidden;
}

body.dialog-opened #dialog-backdrop {
  display: block;
}

#dialog .dialog-content {
  display: none;
  background: url("./assets/natural-paper.png") repeat, #ddd;
}

#dialog #dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

#dialog .dialog-content h3 {
  margin: 0;
  padding: 15px 10px;
}

#dialog .dialog-content img {
  width: 250px;
  border-radius: 5px;
}

#dialog .dialog-content button {
  width: 80px;
  height: 40px;
  font-size: 16px;
}

#dialog .dialog-content .card {
  border-bottom: 2px solid white;
  padding: 10px;
  gap: 10px;
  display: flex;
}

#dialog .dialog-content .card:nth-child(even) {
  flex-direction: row-reverse;
}

#dialog .dialog-content .card:nth-child(odd) {
  flex-direction: row;
}

#dialog .dialog-content .card > div {
  position: relative;
  flex-grow: 1;
}

#dialog .dialog-content .card > div button {
  position: absolute;
  bottom: 0;
  right: 0;
}

/* dialog accordions: start */
#dialog .dialog-content .accordion .accordion-header {
  cursor: pointer;
}

#dialog .dialog-content .accordion .accordion-header span {
  display: inline-block;
}

#dialog .dialog-content .accordion.open .accordion-header span {
  rotate: 90deg;
}

#dialog .dialog-content .accordion .accordion-header,
#dialog .dialog-content .accordion .accordion-content {
  margin: 0 0 10px 0;
}

#dialog .dialog-content .accordion.closed .accordion-content {
  display: none;
}

#dialog .dialog-content .accordion.open .accordion-content {
  display: block;
}

#dialog .dialog-content .accordion:nth-child(2) .accordion-content {
  line-height: 23px;
}

#dialog .dialog-content .accordion .accordion-content .stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#dialog .dialog-content .accordion .accordion-content .stat-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#dialog .dialog-content .accordion .accordion-content .stat-col strong {
  font-weight: 700;
}

#dialog .dialog-content .accordion .accordion-content .indent {
  margin-left: 3.0em;
}
/* dialog accordions: end */
#occupation-dialog {
  overflow: hidden;
  min-height: 100%;
}

#occupation-options-container,
#branch-options-container {
  position: relative;
  width: 700px;
  transform: translateX(0);
  transition: transform 0.5s ease-out;
}

#occupation-options-container.slide-left {
  transform: translateX(-700px);
}

#branch-options-container.slide-left {
  transform: translateX(0);
}

#occupation-options-container .card div p {
  line-height: 1.2;
  text-indent: 25px;
  margin-top: 0;
  font-size: 16px;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

#bloodline-dialog > div {
  display: none;
}

#bloodline-dialog h4 {
  margin: 0 0 10px 0;
}
#bloodline-dialog li {
  margin-bottom: 10px;
  line-height: 24px;
}

#bloodline-dialog

#team-dialog {
  height: 100%;
}

#team-dialog .team-dialog-tile-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  padding: 10px;
}

#occupation-dialog #branch-options-tile-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px;
}

#spell-name-dialog .spell-options-tile-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px;
}

#occupation-dialog .tile,
#team-dialog .tile,
#spell-name-dialog .tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  border: 1px solid white;
  border-radius: 15px;
}

#occupation-dialog .tile h4,
#team-dialog .tile h4,
#spell-name-dialog .tile h4 {
  margin: 8px 0;
}

#occupation-dialog .tile p,
#team-dialog .tile p,
#spell-name-dialog .tile p {
  flex-grow: 1;
  line-height: 24px;
}

#faith-dialog h4 {
  margin: 0 0 10px 0;
  font-size: 24px;
}

#faith-dialog .card > div > div {
  font-size: 20px;
  line-height: 1.5;
}

/* Styles only applied on web */
.top-left > .level,
.top-right > .checkbox-with-text.disabled,
.page3 .disabled {
  color: rgba(180, 180, 180, 0.5);
}

.interaction-cover {
  background: rgba(180, 180, 180, 0.5);
}

.page2 {
  display: none;
}

@media print {
  body {
    font-family: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
  }

  .interaction-cover, .upload-label {
    display: none !important;
  }

  .top-left > .level,
  .top-right > .checkbox-with-text.disabled,
  .page3 .disabled {
    color: inherit !important;
  }

  .page2 {
    display: block !important;
  }
  
  ::-webkit-input-placeholder { /* WebKit, Blink, Edge */
    color: transparent;
  }
  :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color: transparent;
  }
  ::-moz-placeholder { /* Mozilla Firefox 19+ */
    color: transparent;
  }
  :-ms-input-placeholder { /* Internet Explorer 10+ */
    color: transparent;
  }
  ::placeholder { /* Standard */
    color: transparent;
  }

  input[type="checkbox"]:disabled {
    background-color: white;
    border-color: #767676;
  }

  input[type="checkbox"]:checked:disabled {
    background-color: #404040;
    border-color: #404040;
  }
}

@page {
  size: A4;
  margin: 0;
}

.toolbar {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  gap: 8px;
}
.toolbar button {
  width: 80px;
  height: 40px;
  font-size: 16px;
}

@media print {
  .toolbar { display: none; }
}
