:root {
  --salmon: #fff6f0;
  --red: #f66;
  --pink: #ffe0ee;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif, Meiryo, Roboto Mono, Roboto;
  background: #f0f0f0;
  color: #333;
}

.flex {
  display: flex;
  flex-direction: column;
}
.colflex {
  display: flex;
  flex-direction: row;
}

label {
  white-space: nowrap;
}

input, select {
  min-width: 40px;
  height: 24px;
  padding: 1px 4px;
  background-color: white;
  border: solid 1px gray;
  border-radius: 5px;
  margin: 0;
  font-weight: normal;
}
input {
  appearance: none;
  -moz-appearance: textfield;
}
select {
  appearance: none;
  -moz-appearance: none;
}

input::-webkit-inner-spin-button,
input::-webkit-outer-spin-button,
select::-webkit-inner-spin-button,
select::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}


/*-----------------------------------------------------*/
main {
  display: flex;
  position: relative;
}
main.left { justify-content: left; }
main.center {
  /* space-aroundでは基本はcenterと同じで、はみ出る場合に左揃えになる */
  justify-content: space-around;
}
main.right { justify-content: right; }

main.fit {
  justify-content: center !important;
}

#maindiv-wrapper {
  transform-origin: top center;
  display: block;
  width: 100%;
  min-width: 541px; /* pane幅依存 */
  max-width: 640px;
}

.main-scroll-controls {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}

.main-scroll-button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(51, 51, 51, 0.35);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: #333;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(2px);
}

.main-scroll-button:hover {
  background: rgba(255, 255, 255, 0.88);
}

/*---- divONFOFFボタン ------------------------------------------- */
.divbutton {
  flex: 1;
  font-size: 14px;
  color: #bbb;
  border: 2px solid #ccc;
  background-color: #f9f9f9;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.divbutton::before {
  content: '';
  font-weight: bold;
  position: absolute;
  inset: 2px;
  border-radius: 3px;
  pointer-events: none;
  text-align: center;
  align-content: center;
}

/* ONの状態 */
.divbutton.active {
  border-color: #555;
  color: #555;
}

.divbutton.active::before {
  border: 1px solid #555;
}

/* ---- maindiv ------------------------------------------------------ */

#maindiv {
  background: var(--salmon);
  border: 1px solid #333;
  border-radius: 0px;
  height: fit-content;
  margin: 0 10px 14px 10px;
}

#maindiv.isarmorselected .notarmor,
#maindiv:not(.isarmorselected) .isarmor,
#maindiv.issimpleatkselected .notsimpleatk,
#maindiv:not(.issimpleatkselected) .issimpleatk{
  display: none;
}

/* ---- header-row ----------------------------------------------------*/
#header-row {
  height: fit-content;
  transition: height 0.3s linear;
  gap: 1px;
  background: #ccc;
}

.isclosed #header-row {
  height: 0px !important;
}


.cell {
  display: flex;
  align-content: center;
}
.cell.label {
  justify-content: right;
  padding-left: 12px;
  padding-right: 4px;
  align-items: center;
}
.cell.input {
  justify-content: left;
  padding-left: 4px;
  padding-right: 24px;
  align-items: center;
}

.dropdown-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-input-button {
  width: 26px;
  height: 24px;
  padding: 0;
  margin-left: 4px;
  border: 1px solid gray;
  border-radius: 5px;
  background: white;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}

.dropdown-input-select {
  z-index: 100;
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  border: 1px solid gray;
  border-radius: 5px;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 4px;
  padding-right: 10px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  font-size: 14px;
  min-width: 72px;
  width: max-content;
}

.dropdown-input-select li {
  position: relative;
  display: flex;
  align-items: center;
  height: 32px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.dropdown-input-select li:hover {
  /*background: var(--pink);*/
  background: rgba(0, 0, 0, 0.1);
}

.dropdown-input-select li.selected::before {
  content: "";
  position: absolute;
  left: 1px;
  border-left: 2px solid var(--red);
  height: 1.2em;
}
.cell.join {
  grid-column: span 2;
}

#main-column,
#sub-column {
  flex: 1;
  min-height: fit-content;
}

#main-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 48px repeat(5, 38px);
  background: var(--pink);
  font-weight: bold;
  padding-bottom: 8px;
}

#eqptype-container {
  display: flex;
  flex-direction: row;
  padding: 0px;
  padding-bottom: 1px;
  margin-bottom: 8px;
  gap: 1px;
  background: #ccc;
}

.eqptype-button {
  flex: 1;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #eee;
  cursor: pointer;
}
.eqptype-button.selected::before {
  content: "";
  width: 2.5em;
  position: absolute;
  bottom: 0;
  border-top: 3px solid;
  border-color: var(--red);
}

#main-column .divbutton {
  margin: 4px 24px;
}

#sub-column {
  padding-bottom: 8px;
  background: ivory;
  height: 100%;
}

#status-template-row {
  display: flex;
  grid-template-columns: 1fr 100px;
  justify-content: center;
  align-items: center;
  height: 40px;
  border-bottom: 1px solid #ccc;
  font-weight: bold ;
  background: #ffffdd;
}
#status-table {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); /* 横に4列 */
  grid-template-rows: repeat(4, 38px); /* 縦に4行 */
  font-size: 14px;
  padding: 8px 0px 8px 0px;
}


/* ---- condition-div ------------------------------------------------------ */
#condition-row {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: 50px 80px 30px 1fr;
  height: 38px;
  width: 100%;
  font-weight: bold;
  align-content: center;
  gap: 8px;
}
#condition-row>* {
  justify-self: center;
  width: 100%;
}
.opener {
  position: relative;
  width: 30px;
  height: 30px;
}

.opener::before {
  content: "";
  position: absolute;
  height: 15px;
  width: 15px;
  border-color: black black transparent transparent;
  border-style: solid;
  border-width: 3px;
  border-radius: 15%;
  top: calc(50% - (21px*0.27));
  left: calc(50% - (21px*0.73));
  transform-origin: calc(21px*0.73) calc(21px*0.27);
  transform: rotate(-45deg);
  transition: 0.3s linear;
}
.isclosed .opener::before {
  transform: rotate(135deg) !important;
}

#condition-expantion-container {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}
#condition-eqptype {
  height: 100%;
  min-width: 40px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center center;
}
#condition-eqptype-text {
  color: #333;
}
#condition-isboss-text {
  color: #333;
}
#export-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--red);
  border: 0;
  border-radius: 5px;
  color: white;
  font-weight: bold;
  font-size: 14px;
  z-index: 1;
  cursor: pointer;
}
#export-button::after {
  border-top: 15px solid var(--red);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  bottom: -8px;
  left: 25px;
  content: "";
  position: absolute;
  z-index: -1;
}
#condition-exported {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 7.5px;
}
#condition-exported.is-exported::before {
  content: "✓";
  width: 15px;
  height: 15px;
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-weight: bold;
  font-size: 9px;
  text-align: center;
  padding-left: 1px;
  padding-top: 1px;
}


#export-numinput,
#export-truncinput {
  align-self: center;
  padding: 0 6px;
  height: 30px;
  width: 60px;
  background-color: white;
  border: solid 1px gray;
  border-radius: 5px;
  text-align: right;
}
#export-numinput:disabled,
#export-truncinput:disabled {
  display: none;
}
#export-typediv {
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-content: center;
  align-items: center;
  cursor: pointer;
  background: #f9f9f9;
  color: #555;
  font-size: 14px;
  font-weight: bold;
  border: 2px #555 solid;
  border-radius: 5px;
  padding: 0px 6px;
  user-select: none;
}
#align-panesdiv {
  cursor: pointer;
}
#align-panesdiv.accepted .stopmark{
  display: none;
}
#align-panesdiv .align-mode-label {
  pointer-events: none;
  user-select: none;
}

/* ---- export-row, pane ------------------------------------------------------ */

#export-row {
  display: flex;
  gap: 1px;
  background: #ccc;
}
.pane {
  flex: 1;
  background: var(--salmon);
}
.pane-title {
  background: var(--red);
  color: white;
  height: 36px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pane-info-button {
  margin-left: auto;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid white;
  border-radius: 50%;
  background: transparent;
  color: white;
  font-size: 13px;
  font-weight: bold;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.pane-info-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.info-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.4);
}
.info-modal-overlay[hidden] {
  display: none;
}
.info-modal {
  position: relative;
  width: 100%;
  min-width: 320px;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px 16px 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  color: #333;
  font-size: 13px;
  white-space: nowrap;
}
.info-modal-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #666;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.info-modal-close:hover {
  background: #f0f0f0;
  color: #333;
}
.info-modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.info-modal-section-title {
  margin: 0 0 4px 4px;
  font-size: 12px;
  font-weight: bold;
  color: #666;
}
.info-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  gap: 1px;
  background: #ddd;
  border: 1px solid #ddd;
}
.info-grid-vertical {
  grid-template-columns: 1fr 1fr;
}
.info-grid-horizontal {
  grid-template-columns: repeat( var(--info-cols), 1fr);
}
.info-cell {
  background: #fff;
  padding: 3px 10px;
  text-align: center;
  align-content: center;
  white-space: nowrap;
}
.info-cell-value {
  min-width: 0;
}
.info-cell-head,
.info-cell-title {
  background: #f5f5f5;
  font-weight: bold;
  min-width: max-content;
}
.info-grid-vertical .info-cell-title,
.info-grid-vertical .info-cell-value {
  text-align: left;
}
.tensei-container,
.eqplv-container {
  position: relative;
  display: flex;
  align-items: center;
}
.tensei-container::after,
.eqplv-container::after {
  content: "";
  position: absolute;
  right: 14px;
  height: 4px;
  aspect-ratio: 1;
  border: solid white;
  border-width: 0 1px 1px 0;
  transform-origin: 50% 50%;
  transform: rotate(45deg);
  translate: 0 -25%;
}
.tensei-container {
  width: 116px;
}
.eqplv-container {
  width: 88px;
}
.tensei-container img,
.eqplv-container img {
  height: 80%;
}

.tensei-button,
.eqplv-button {
  display: flex;
  padding-left: 14px;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 28px;
  border: 1px solid #eee;
  border-radius: 14px;
  background: transparent;
  color: white;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.tensei-select, 
.eqplv-select {
  z-index: 100;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  border: 1px solid #47525a;
  border-radius: 6px;
  background: #2e343d;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  padding: 4px;
  padding-right: 10px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  font-size: 14px;
  min-width: 100%;
  width: fit-content;
}

.eqplv-select input {
  width: 100%;
  height: 24px;
  margin-bottom: 4px;
  padding: 0 10px;
  border: 1px solid #47525a;
  border-radius: 4px;
  background: #10161f;
  color: #ffffff;
}

.tensei-select li, 
.eqplv-select li {
  position: relative;
  display: flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  height: 32px;
  gap: 8px;
  white-space: nowrap;
}

.tensei-select li:hover, 
.eqplv-select li:hover {
  background: rgba(255, 255, 255, 0.1);
} 
.tensei-select li.selected::before, 
.eqplv-select li.selected::before {
  content: "";
  position: absolute;
  left: 1px;
  border-left: 2px solid #ff3333;
  height: 1.2em;
}
.pane-body-container {
  position: relative;
  overflow: hidden;
  min-height: 200px;
  background: transparent;
}

.pane-body-container.animate-height {
  transition: height 0.5s ease;
}

.pane-body {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: max-content 1fr;
  white-space: nowrap;
}

.pane-body::before {
  /* スコア揃え表示時の隙間に縦線を表示する */
  content: "";
  position: absolute;
  border-left: #ddd 30px solid;
  height: 100%;
  justify-self: center;
  z-index: 1;
}

.pane-cell {
  background: white;
  font-size: 14px;
  padding: 2px 6px;
  height: 25px;
  overflow: hidden;
  z-index: 2;
  display: flex;
  align-items: center;
}
.pane-cell:not(.coltitle) {
  transition: transform 0.5s ease;
}
.pane-cell.score {
  border-right: 1px solid #ccc;
  text-align: right;
}

.pane-cell.coltitle {
  background-color: var(--red);
  color: white;
  height: 28px;
}

.pane-cell.row-alt {
  background-color: #fff0f0;
}

.pane-cell.empty {
  background: transparent;
  opacity: 0;
  pointer-events: none;
}
.pane-cell.empty.row-alt {
  background: transparent;
}

.pane-body span.decimal {
  font-size: 12px;
  color: darkred;
}

.pane-context-menu {
  position: fixed;
  z-index: 400;
  min-width: 148px;
  padding: 4px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  font-size: 14px;
  color: #333;
}
.pane-context-menu[hidden] {
  display: none;
}
.pane-context-menu-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.pane-context-menu-item:hover,
.pane-context-menu-item:active {
  background: #fff0f0;
}