:root {
  color: #151515;
  background: #e7eef1;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Yu Gothic UI", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.panel {
  background: #fff;
  border: 1px solid #cdd8dd;
  border-radius: 8px;
}

.form-panel {
  height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
}

.panel-head {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.tools-link {
  width: fit-content;
  margin-top: 18px;
  color: #78888e;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.tools-link:hover {
  color: #111;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
}

.import-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid #d8e1e5;
  border-radius: 8px;
  background: #f8fbfc;
}

.import-panel h2 {
  margin: 0;
  font-size: 14px;
}

.import-steps {
  margin: 0;
  padding-left: 1.25em;
  color: #2f4046;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.75;
}

.import-actions {
  display: grid;
  gap: 8px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgb(17 17 17 / 16%);
  border-radius: 999px;
  color: #101820;
  background: #fff;
  box-shadow: 0 10px 24px rgb(37 65 77 / 10%);
  cursor: pointer;
  text-align: center;
}

.draft-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.draft-actions button,
.import-actions > .danger-button {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  box-shadow: none;
}

.file-button input {
  display: none;
}

.import-status {
  margin: 0;
  color: #52656d;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

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

label,
fieldset,
.field-block {
  display: grid;
  gap: 6px;
  margin: 0;
  color: #35454a;
  font-size: 12px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b8c6cc;
  border-radius: 6px;
  padding: 9px 10px;
  color: #111;
  background: #fff;
  font-size: 14px;
}

.field-help {
  display: block;
  margin-top: 6px;
  color: #63777f;
  font-size: 12px;
  line-height: 1.5;
}

textarea {
  resize: vertical;
}

.chart-inputs,
.sheet-background-inputs,
.card-style-inputs,
.sheet-layout-inputs,
.crop-inputs {
  border: 1px solid #d8e1e5;
  border-radius: 8px;
  padding: 12px;
}

.chart-inputs legend,
.sheet-background-inputs legend,
.card-style-inputs legend,
.sheet-layout-inputs legend,
.crop-inputs legend {
  padding: 0 5px;
}

.chart-inputs label,
.sheet-background-inputs label,
.card-style-inputs label,
.sheet-layout-inputs label,
.crop-inputs label {
  grid-template-columns: 86px 1fr;
  align-items: center;
}

.chart-inputs label {
  grid-template-columns: 112px 1fr;
}

.chart-inputs output {
  display: inline-grid;
  place-items: center;
  min-width: 1.8em;
  margin-left: 4px;
  border-radius: 999px;
  background: #101820;
  color: #fff;
  font-size: 11px;
  line-height: 1.8;
}

.range-scale {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-left: 112px;
  color: #63777f;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.chart-inputs .custom-radar-label {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid #d8e1e5;
}

.sheet-background-inputs {
  display: grid;
  gap: 10px;
}

.sheet-background-inputs label {
  grid-template-columns: 90px 1fr;
}

.sheet-background-inputs button {
  justify-self: start;
}

.segmented-control {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #cfdbe0;
  border-radius: 999px;
  background: #eef5f7;
}

.segmented-control label {
  display: inline-flex;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  color: #4b5d64;
  cursor: pointer;
}

.segmented-control input {
  display: none;
}

.segmented-control label:has(input:checked) {
  background: #101820;
  color: #fff;
}

.card-style-inputs {
  display: grid;
  gap: 10px;
}

.style-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.style-actions button {
  padding: 7px 14px;
  box-shadow: none;
}

.sheet-layout-inputs {
  display: grid;
  gap: 10px;
}

.card-style-inputs input[type="color"] {
  width: 64px;
  min-height: 38px;
  padding: 4px;
}

.color-pair {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
  align-items: center;
}

.range-with-output {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  align-items: center;
}

.range-with-output output {
  color: #52656d;
  font-size: 12px;
  font-weight: 900;
}

.preview-side {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.active-card-label {
  margin-right: auto;
  color: #52656d;
  font-size: 13px;
  font-weight: 900;
}

button {
  border: 1px solid rgb(17 17 17 / 16%);
  border-radius: 999px;
  padding: 10px 16px;
  color: #101820;
  background: linear-gradient(180deg, #fff, #eef5f7);
  box-shadow: 0 10px 24px rgb(37 65 77 / 14%);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.save-group {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgb(17 17 17 / 10%);
  border-radius: 999px;
  background: rgb(255 255 255 / 56%);
}

.save-group button {
  padding-inline: 12px;
  box-shadow: none;
}

.legacy-save {
  display: none;
}

button:hover,
button:focus-visible {
  background: #101820;
  color: #fff;
  box-shadow: 0 14px 30px rgb(37 65 77 / 22%);
  transform: translateY(-1px);
  outline: none;
}

button:disabled {
  color: #98a8ae;
  background: #eef4f6;
  box-shadow: none;
  cursor: default;
  transform: none;
}

.danger-button {
  color: #8b1f1f;
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #8b1f1f;
  color: #fff;
}

.import-picker {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.import-select-label {
  display: grid;
  gap: 5px;
  color: #35454a;
  font-size: 12px;
  font-weight: 900;
}

.import-picker button {
  align-self: end;
  padding: 7px 12px;
  box-shadow: none;
  font-size: 12px;
}

.import-filter,
.sheet-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.import-filter {
  margin-top: 10px;
}

.import-filter button,
.sheet-nav button {
  padding: 7px 10px;
  box-shadow: none;
  font-size: 12px;
}

.import-filter button.is-active {
  color: #fff;
  background: #101820;
}

.sheet-nav {
  margin-right: 4px;
  padding: 4px;
  border: 1px solid rgb(17 17 17 / 10%);
  border-radius: 999px;
  background: rgb(255 255 255 / 56%);
}

.sheet-nav span {
  min-width: 42px;
  color: #52656d;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.sheet-nav select {
  width: auto;
  min-width: 96px;
  padding: 6px 26px 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.export-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(12 18 22 / 46%);
}

.export-card {
  width: min(760px, 96vw);
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 18px;
  padding: 18px;
  background: rgb(246 250 252 / 96%);
  box-shadow: 0 28px 80px rgb(0 0 0 / 24%);
}

.export-head,
.export-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.export-head h2 {
  margin: 0;
  font-size: 18px;
}

.export-head button,
.export-actions button {
  box-shadow: none;
}

.export-preview {
  display: grid;
  place-items: center;
  min-height: 260px;
  margin: 14px 0;
  border: 1px solid #d8e1e5;
  border-radius: 12px;
  color: #52656d;
  background: #fff;
  font-weight: 900;
}

.export-preview img {
  max-width: 100%;
  max-height: 248px;
  object-fit: contain;
}

.export-preview img:not([src]),
.export-preview img[src=""] {
  display: none;
}

.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 10px;
}

.export-options fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 1px solid #d8e1e5;
  border-radius: 12px;
  padding: 12px;
}

.export-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  white-space: nowrap;
}

.export-options input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: #1d7cff;
}

.export-range input {
  width: 100%;
}

.export-range {
  grid-template-columns: 1fr 1fr;
}

.export-range legend {
  grid-column: 1 / -1;
}

.export-help {
  color: #63777f;
  font-size: 12px;
  font-weight: 800;
}

.sheet-page {
  position: relative;
  width: min(100%, 1200px);
  aspect-ratio: 1164 / 641;
  padding: 0;
  --sheet-bg-url: none;
  --sheet-decoration-url: none;
  --card-panel-rgb: 248 252 254;
  --card-panel-alpha: 0.92;
  background: #fff;
  border: 1px solid #8bb4c4;
  box-shadow: 0 16px 40px rgb(35 67 83 / 18%);
  overflow: hidden;
}

.card-grid {
  position: relative;
  display: block;
  height: 100%;
  z-index: 1;
}

.sheet-bg-image {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: var(--sheet-bg-fit, cover);
  pointer-events: none;
  user-select: none;
}

.sheet-page.has-sheet-bg .sheet-bg-image {
  display: block;
}

.preview-side.is-overview .sheet-page {
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 8.27 / 11.69;
  padding: 0;
}

.sheet-page.is-exporting {
  position: relative;
  border: 0;
  box-shadow: none;
}

.preview-side.is-overview .sheet-page.has-sheet-bg,
.sheet-page.is-exporting.has-sheet-bg {
  background: #fff;
}

.preview-side.is-overview .sheet-page.has-sheet-bg::before,
.preview-side.is-overview .sheet-page.has-sheet-bg::after {
  content: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  background-color: transparent;
  background-image: var(--sheet-bg-url);
  background-position: center;
  background-size: var(--sheet-bg-fit, cover);
  background-repeat: no-repeat;
}

.preview-side.is-overview .sheet-page.has-sheet-bg::before {
  clip-path: inset(0 0 82.2% 0);
}

.preview-side.is-overview .sheet-page.has-sheet-bg::after {
  content: none;
}

.preview-side.is-overview .sheet-page.is-exporting.has-sheet-bg::before,
.preview-side.is-overview .sheet-page.is-exporting.has-sheet-bg::after {
  content: none;
}

.preview-side.is-overview .card-grid {
  position: absolute;
  inset: 0;
  display: block;
}

.sheet-page.is-exporting .card-grid {
  position: absolute;
  inset: 0;
  display: block;
}

.zukan-page {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1164 / 641;
  container-type: inline-size;
  overflow: hidden;
  align-self: center;
  border-radius: 2.2cqw;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.zukan-page:not(.is-active) {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.sheet-page.is-exporting .zukan-page:not(.is-active) {
  inset: auto !important;
  left: 7% !important;
  right: auto !important;
  bottom: auto !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.preview-side.is-overview .zukan-page.is-empty,
.sheet-page.is-exporting .zukan-page.is-empty {
  display: none;
}

.sheet-page.is-exporting .zukan-page {
  left: 7% !important;
  transform: translateX(var(--card-offset-x, 0%)) !important;
}

.preview-side.is-overview .zukan-page,
.sheet-page.is-exporting .zukan-page {
  position: absolute;
  inset: auto;
  left: 50%;
  top: 7.8%;
  right: auto;
  bottom: auto;
  opacity: 1;
  pointer-events: auto;
  width: 86%;
  max-width: 100%;
  height: auto;
  transform: translateX(calc(-50% + var(--card-offset-x, 0%)));
  cursor: grab;
}

.preview-side.is-overview .zukan-page:nth-child(2),
.sheet-page.is-exporting .zukan-page:nth-child(2) {
  top: 38.5%;
}

.preview-side.is-overview .zukan-page:nth-child(3),
.sheet-page.is-exporting .zukan-page:nth-child(3) {
  top: 69.2%;
}

.preview-side.is-overview .main-card,
.sheet-page.is-exporting .main-card {
  left: 3%;
  top: 2%;
  width: 94%;
  height: 72.4%;
}

.preview-side.is-overview .bottom-card,
.sheet-page.is-exporting .bottom-card {
  left: 3%;
  top: 74.3%;
  width: 94%;
  height: 15.7%;
  padding: 0.35% 8% 1.4%;
}

.preview-side.is-overview .zukan-page:active {
  cursor: grabbing;
}

.zukan-page.is-active {
  outline: none;
  filter: none;
}

.zukan-page.is-active .content-card {
  box-shadow: inset 0 0 0 0.13cqw rgb(29 124 255 / 70%), 0 0 0.42cqw rgb(29 124 255 / 28%);
}

.sheet-page.is-exporting .zukan-page.is-active {
  outline: none;
  border-color: transparent;
  filter: none;
  box-shadow: none;
}

.sheet-page.is-exporting .zukan-page.is-active .content-card {
  box-shadow: none;
}

.sheet-page.is-exporting .zukan-page {
  border-color: transparent;
  box-shadow: none;
  cursor: default;
}

.content-card {
  position: absolute;
  z-index: 2;
  border-radius: 2.1cqw;
  background: rgb(var(--card-panel-rgb) / var(--card-panel-alpha));
}

.sheet-page[data-card-corner="square"] .content-card {
  border-radius: 0 !important;
}

.is-hidden {
  display: none !important;
}

.main-card {
  left: 3%;
  top: 2%;
  width: 94%;
  height: 72.4%;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.bottom-card {
  left: 3%;
  top: 74.3%;
  width: 94%;
  height: 15.7%;
  display: grid;
  grid-template-columns: 1fr;
  padding: 0.35% 8% 1.4%;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.zukan-page:has(.bottom-card.is-hidden) .main-card {
  border-bottom-right-radius: 2.1cqw;
  border-bottom-left-radius: 2.1cqw;
}

.photo-frame {
  position: absolute;
  left: 12%;
  top: 8%;
  width: 15%;
  height: 35.3%;
  overflow: hidden;
  background: #d7e8ed;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.photo-frame:active {
  cursor: grabbing;
}

.photo-frame img {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
  width: var(--photo-width, 100%);
  height: var(--photo-height, auto);
  transform: translate(calc(-50% + var(--photo-x, 0%)), calc(-50% + var(--photo-y, 0%))) scale(var(--photo-scale, 1));
  transform-origin: center;
}

.photo-frame.has-photo img {
  display: block;
}

.photo-frame.has-photo span {
  display: none;
}

#photoPlaceholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #6c8188;
  font-weight: 800;
}

.name-area {
  position: absolute;
  left: 29%;
  top: 7%;
  width: 46%;
}

.nickname {
  margin: 0;
}

.nickname {
  margin-bottom: 3.5%;
  font-size: 2.3cqw;
  font-weight: 900;
}

.name-grid {
  display: grid;
  grid-template-columns: max-content max-content;
  column-gap: 3.2cqw;
  row-gap: 0.65cqw;
  align-items: end;
}

.kana {
  font-size: 2.75cqw;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
}

.name {
  font-size: 5.15cqw;
  font-weight: 900;
  line-height: 1.05;
  white-space: nowrap;
}

.basic-info {
  position: absolute;
  left: 12%;
  top: 63.5%;
  width: 44%;
  display: grid;
  grid-template-columns: 29% minmax(0, 13em);
  row-gap: 5px;
  margin: 0;
  font-size: 1.72cqw;
  font-weight: 900;
}

.basic-info dt,
.basic-info dd {
  margin: 0;
}

.basic-info dd,
.extra-info dd,
.nickname,
.bottom-card p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.extra-info {
  position: absolute;
  left: 50.4%;
  top: 63.5%;
  display: grid;
  grid-template-columns: minmax(0, 12.5em) minmax(0, 12.5em);
  row-gap: 0.35cqw;
  column-gap: 1.1cqw;
  width: 43%;
  margin: 0;
  font-size: 1.72cqw;
  font-weight: 900;
}

.extra-info dt,
.extra-info dd,
.bottom-card p,
.bottom-card h2 {
  margin: 0;
}

.extra-info dt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.radar-wrap {
  position: absolute;
  right: 0.2%;
  top: 4%;
  width: 25.5%;
  aspect-ratio: 1;
}

.radar-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.radar-labels {
  position: absolute;
  inset: 0;
  color: #222;
  font-size: 0.72cqw;
  font-weight: 900;
  line-height: 1.05;
  pointer-events: none;
}

.radar-labels span {
  position: absolute;
  width: 8cqw;
  text-align: center;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.radar-labels span:nth-child(1) {
  left: 50%;
  top: 2%;
  transform: translateX(-50%);
}

.radar-labels span:nth-child(2) {
  right: -9%;
  top: 29%;
}

.radar-labels span:nth-child(3) {
  right: 5%;
  bottom: 8%;
}

.radar-labels span:nth-child(4) {
  left: 5%;
  bottom: 8%;
}

.radar-labels span:nth-child(5) {
  left: -9%;
  top: 29%;
}

.bottom-card h2 {
  margin-bottom: 0.5cqw;
  font-size: 1.72cqw;
  font-weight: 900;
}

.bottom-card p {
  white-space: pre-wrap;
  font-size: calc(1.72cqw * var(--comment-scale, 1));
  font-weight: 900;
  line-height: 1.32;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .form-panel {
    order: 2;
    height: auto;
    max-height: none;
  }

  .preview-side {
    order: 1;
  }
}

@media (max-width: 760px) {
  .app {
    padding: 12px;
  }

  .form-panel {
    padding: 14px;
  }

  .panel-head {
    margin-bottom: 12px;
  }

  h1 {
    font-size: 19px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .import-panel {
    padding: 12px;
  }

  .import-actions {
    flex-wrap: wrap;
  }

  .import-picker {
    grid-template-columns: 1fr;
  }

  .action-row {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 0 10px;
    background: #e7eef1;
  }

  .active-card-label {
    margin-right: 0;
  }

  .action-row > button,
  .save-group {
    width: 100%;
  }

  .save-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  button,
  .file-button {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
  }

  input,
  textarea {
    min-height: 42px;
    font-size: 16px;
  }

  .sheet-page {
    width: 100%;
    box-shadow: 0 10px 22px rgb(35 67 83 / 14%);
  }

  .preview-side.is-overview .sheet-page {
    width: min(100%, 430px);
    margin: 0 auto;
  }
}
