:root {
  color-scheme: dark;
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  background: #071012;
  color: #f4f7ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #071012;
  overflow: hidden;
}

.app {
  width: 100vw;
  height: 100vh;
  padding: 6px;
}

.stage {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  justify-items: center;
  align-items: center;
  position: relative;
}

canvas {
  width: min(calc(100vw - 12px), calc((100vh - 12px) * 1.4117647));
  height: auto;
  max-height: calc(100vh - 12px);
  display: block;
  min-height: 0;
  border: 0;
  background: #18211f;
  cursor: crosshair;
}

.room-mode canvas {
  display: none;
}

.room-screen {
  width: min(calc(100vw - 12px), calc((100vh - 12px) * 1.4117647));
  aspect-ratio: 960 / 680;
  color: #f8f2d7;
}

body:not(.room-mode) .room-screen {
  display: none;
}

.room-frame {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(15, 7, 9, .08), rgba(15, 7, 9, .08)),
    url("assets/ui/room/room-main-bg.webp") center / 100% 100% no-repeat;
}

.room-topbar {
  position: absolute;
  left: 24px;
  top: 18px;
  right: 24px;
  height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 54px 84px;
  gap: 18px;
  align-items: center;
  padding: 0 14px 0 16px;
  background: rgba(1, 10, 16, .92);
  border: 2px solid #7f2c25;
  box-shadow: inset 0 0 0 2px #075b70;
}

.room-title-cell {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.room-rule-select {
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  justify-self: start;
  border: 2px solid #6ea0b2;
  background: linear-gradient(180deg, rgba(8, 38, 56, .96), rgba(5, 23, 39, .96));
  color: #f2f6e8;
  font-size: 22px;
  font-weight: 900;
  text-shadow: 1px 1px 2px #0b1732;
  line-height: 1;
  appearance: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(182, 224, 255, .18);
}

html[lang="en"] .room-rule-select {
  font-size: 19px;
}

.room-rule-select:focus {
  outline: none;
  border-color: #d8ef7b;
  box-shadow: 0 0 0 2px rgba(216, 239, 123, .22);
}

.room-title-cell span {
  color: #e3f4ff;
  font-size: 22px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #0b2460, 0 0 6px #103a6f;
}

.room-title-select {
  height: 34px;
  min-width: 0;
  padding: 0 16px;
  border: 0;
  background: #02070a;
  color: #d7f14b;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  cursor: pointer;
}

.room-title-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(216, 239, 123, .22);
}

html[lang="en"] .room-title-select {
  font-size: 19px;
}

.room-leave-btn {
  width: 42px;
  height: 42px;
  border: 0;
  padding: 0;
  background: url("assets/ui/room/room-leave-button.webp") center / contain no-repeat;
}

.online-status {
  min-width: 0;
  padding: 7px 8px 8px;
  color: #d7f14b;
  background: rgba(2, 7, 10, .92);
  border: 1px solid rgba(110, 160, 178, .72);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.room-text-button {
  border: 0;
  padding: 0 0 4px;
  color: #fff2d0;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 0 rgba(70, 20, 0, .75);
  background: url("assets/ui/room/button-submit.webp") center / 100% 100% no-repeat;
  cursor: pointer;
}

.team-tabs {
  position: absolute;
  left: 38px;
  top: 86px;
  width: 90px;
  height: 220px;
}

.team-edit-btn {
  position: absolute;
  left: -18px;
  top: 0;
  width: 78px;
  height: 44px;
}

.team-shop-btn {
  position: absolute;
  left: -18px;
  top: 48px;
  width: 78px;
  height: 44px;
}

.online-battle-btn {
  position: absolute;
  left: 456px;
  bottom: 18px;
  width: 92px;
  height: 46px;
  z-index: 2;
}

.room-shop {
  position: absolute;
  inset: 8px;
  z-index: 9;
  display: grid;
  place-items: center;
}

.room-shop[hidden] {
  display: none;
}

.room-shop-window {
  width: 940px;
  height: 648px;
  position: relative;
  padding: 28px 26px 24px;
  color: #5b6570;
  background: linear-gradient(180deg, #dff2ed 0%, #f6e3d6 100%);
  border: 4px solid #f9fff9;
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(38, 78, 77, .42), 0 16px 32px rgba(0, 0, 0, .32);
}

.room-shop-header {
  height: 58px;
  display: flex;
  align-items: start;
  justify-content: space-between;
}

.room-shop-header h2 {
  margin: 0;
  color: #eef56d;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 2px 2px 0 #6b7240, 0 0 4px rgba(30, 60, 40, .5);
}

.room-shop-money {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #edf5f8;
  font-size: 25px;
  font-weight: 900;
  text-shadow: 2px 2px 0 rgba(61, 74, 82, .9);
}

.room-shop-money img,
.room-shop-footer img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.room-shop-close {
  width: 34px;
  height: 34px;
  border: 3px solid #1a1f22;
  padding: 0 0 3px;
  display: grid;
  place-items: center;
  color: #d8d8d8;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  background: #0b0d0e;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18);
  cursor: pointer;
}

.room-shop-body {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 18px;
  height: 482px;
}

.room-shop-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 24px;
  padding: 22px 18px;
  background: #ec877f;
  border-radius: 6px;
}

.room-shop-item {
  min-width: 0;
  height: 72px;
  display: grid;
  grid-template-columns: 52px 60px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #aee7e8;
  border: 3px solid #44888d;
  border-radius: 7px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45);
  cursor: pointer;
}

.room-shop-item[hidden] {
  display: none;
}

.room-shop-item img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.room-shop-item-main,
.room-shop-item p {
  height: 52px;
  padding: 6px 8px;
  background: rgba(91, 141, 141, .35);
  border-radius: 4px;
}

.room-shop-item-main {
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-items: center;
}

.room-shop-item strong {
  min-width: 0;
  color: #e9f7ef;
  font-size: 14px;
  line-height: 1;
  text-shadow: 1px 1px 0 #6c7f82;
  white-space: nowrap;
  overflow: hidden;
}

.room-shop-item span {
  color: #f3e756;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 0 #5f6b62;
}

.room-shop-item p {
  margin: 0;
  color: #e5eb81;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 1px 1px 0 rgba(55, 77, 78, .65);
  overflow: hidden;
}

.room-shop-bag {
  display: grid;
  grid-template-columns: repeat(2, 68px);
  grid-auto-rows: 68px;
  justify-content: center;
  align-content: center;
  gap: 22px 24px;
  padding: 24px 14px;
  background: #d3bb76;
  border-radius: 5px;
}

.room-shop-bag div {
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #a27f95 0%, #a9d8dd 100%);
  cursor: pointer;
}

.room-shop-bag div:empty {
  background: linear-gradient(180deg, #f5b8e0 0%, #bce7ee 100%);
}

.room-shop-bag img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.room-shop-footer {
  height: 78px;
  display: flex;
  align-items: end;
  padding-top: 14px;
}

.room-shop-footer div {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b6d73;
  font-size: 24px;
  font-weight: 900;
}

.room-shop-footer strong {
  min-width: 76px;
  color: #f1f3ef;
  text-align: right;
  text-shadow: 2px 2px 0 #7c848a;
}

.team-tab {
  position: absolute;
  width: 45px;
  height: 68px;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  color: #fff7df;
  font-size: 23px;
  font-weight: 900;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .5);
  background: #707976;
  border: 3px solid #b06437;
  box-shadow: inset 0 0 0 2px #d8f3e4;
}

.team-tab-blue {
  left: 18px;
  top: 90px;
}

.team-tab-grey {
  left: 18px;
  top: 310px;
}

.team-tab.active {
  background: #17849c;
}

.player-grid {
  position: absolute;
  left: 100px;
  top: 88px;
  right: 40px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 14px;
}

.room-player-card {
  height: 220px;
  position: relative;
  padding: 14px 12px 12px;
  background: url("assets/ui/room/room-player-area.webp") center / 100% 100% no-repeat;
}

.room-slot-add {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 118px;
  height: 44px;
  border: 2px solid #0b3140;
  border-radius: 6px;
  background: linear-gradient(#f0e4bc, #c8a86c);
  color: #2a1d0f;
  font-size: 30px;
  font-weight: 900;
  font-family: "DFKai-SB", "KaiTi", "Microsoft JhengHei", serif;
  line-height: 1;
  z-index: 4;
}

.room-slot-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  border: 2px solid #0b3140;
  border-radius: 4px;
  background: linear-gradient(#f8f6d2, #d8d2a2);
  color: #1a1410;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  z-index: 5; /* series labels layer: bigger stays above panel. */
}

.room-player-card:not(.active-slot) .room-slot-add {
  display: block;
}

.room-player-card:not(.active-slot) .room-name,
.room-player-card:not(.active-slot) .room-avatar,
.room-player-card:not(.active-slot) .room-avatar-eye,
.room-player-card:not(.active-slot) .room-hp-label,
.room-player-card:not(.active-slot) .room-skill-label,
.room-player-card:not(.active-slot) .room-hp-input,
.room-player-card:not(.active-slot) .room-skill-input,
.room-player-card:not(.active-slot) .room-look-select,
.room-player-card:not(.active-slot) .room-control-select,
.room-player-card:not(.active-slot) .room-weapon-select,
.room-player-card:not(.active-slot) .room-slot-remove {
  display: none;
}

.room-player-card[data-slot="1"] .room-slot-remove {
  display: none;
}

.room-name {
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: url("assets/ui/room/name_bar.webp") center / 100% 100% no-repeat;
  color: #fff9e9;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 1px 1px 2px #190b35;
}

.room-avatar {
  position: absolute;
  left: 120px;
  top: 80px;
  width: 56px;
  height: 54px;
  image-rendering: auto;
}

.room-look-select {
  position: absolute;
  left: 0px;
  top: 42px;
  width: 74px;
  height: 24px;
  padding: 0 18px 0 6px;
  border: 2px solid #0b3140;
  border-radius: 3px;
  background: linear-gradient(#e5f7ff, #55a7c8);
  color: #05141a;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.room-avatar-eye {
  position: absolute;
  left: 131px;
  top: 96px;
  width: 35px;
  height: 15px;
  image-rendering: auto;
  pointer-events: none;
}

.room-weapon-select {
  position: absolute;
  right: 10px;
  bottom: 18px;
  width: 78px;
  height: 24px;
  padding: 0 18px 0 6px;
  border: 2px solid #0b3140;
  border-radius: 3px;
  background: linear-gradient(#f8f0b8, #d59d33);
  color: #1c1205;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.room-control-select {
  position: absolute;
  left: 10px;
  bottom: 18px;
  width: 65px;
  height: 24px;
  padding: 0 16px 0 6px;
  border: 2px solid #0b3140;
  border-radius: 3px;
  background: linear-gradient(#e5f7ff, #55a7c8);
  color: #05141a;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.room-hp-input { /*血框*/
  position: absolute;
  left: 18px;
  width: 55px;
  bottom: 78px;
  height: 24px;
  padding: 0 8px;
  border: 2px solid #0b3140;
  border-radius: 3px;
  background: linear-gradient(#f8f6d2, #d8d2a2);
  color: #111;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  appearance: textfield;
  -moz-appearance: textfield;
  z-index: 2;
  pointer-events: auto;
}

.room-hp-label {  /*体*/
  position: absolute;
  left: 0px;
  bottom: 82px;
  color: #fff7df;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.room-skill-input {
  position: absolute;
  left: 18px;
  width: 55px;
  bottom: 45px;
  height: 24px;
  padding: 0 8px;
  border: 2px solid #0b3140;
  border-radius: 3px;
  background: linear-gradient(#f8f6d2, #d8d2a2);
  color: #111;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  appearance: textfield;
  -moz-appearance: textfield;
  z-index: 2;
  pointer-events: auto;
}

.room-skill-label {
  position: absolute;
  left: 0px;
  bottom: 49px;
  color: #fff7df;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.room-hp-input::-webkit-outer-spin-button,
.room-hp-input::-webkit-inner-spin-button,
.room-skill-input::-webkit-outer-spin-button,
.room-skill-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.battle-start-btn {
  position: absolute;
  left: 50%;
  top: 548px;
  width: 112px;
  height: 39px;
  transform: translateX(-50%);
  border: 0;
  padding: 0;
  background: transparent;
  z-index: 3;
}

.battle-start-btn img {
  width: 100%;
  height: 100%;
  display: block;
}

.room-map-select {
  position: absolute;
  left: calc(50% + 70px);
  top: 548px;
  width: 132px;
  height: 39px;
  padding: 0 28px 0 12px;
  border: 2px solid #e8c981;
  border-radius: 4px;
  background: #06364b;
  color: #f7e8a9;
  font-size: 15px;
  font-weight: 900;
  z-index: 3;
}

.room-map-select:focus {
  outline: 2px solid #f9efb5;
  outline-offset: 2px;
}

.chat-panel {
  position: absolute;
  left: 96px;
  bottom: 40px;
  width: 496px;
  height: 165px;
  padding: 14px 14px 12px;
  background: #044154;
  border: 4px solid #bf8a43;
  box-shadow: 0 0 0 4px #e227a8 inset, 0 0 0 1px #efe0a0;
}

.chat-log {
  height: 100px;
  padding: 10px 16px;
  background:
    linear-gradient(rgba(0, 20, 23, .74), rgba(0, 20, 23, .74)),
    url("assets/ui/room/room-chat-log-bg.webp") center / 100% 100% no-repeat;
  overflow: hidden;
  color: #2de5d5;
  font-size: 19px;
  line-height: 1.35;
  text-shadow: 1px 1px 0 #002b2d;
}

.chat-log p {
  margin: 0;
}

.chat-input {
  margin-top: 9px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.chat-input span,
.chat-input strong {
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #051013;
  border: 2px solid #c1bf78;
  color: #fff8d2;
  font-size: 17px;
}

.chat-input button {
  height: 30px;
  border: 2px solid #f0b477;
  background: #b85b32;
  color: #fff9db;
  font-weight: 900;
}

.mode-panel {
  position: absolute;
  right: 78px;
  bottom: 40px;
  width: 330px;
  height: 165px;
  background: #044154;
  border: 4px solid #bf8a43;
  box-shadow: 0 0 0 4px #e227a8 inset, 0 0 0 1px #efe0a0;
}

.mode-title {
  position: absolute;
  left: 46px;
  top: -30px;
  width: 210px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #d51b28;
  border: 3px solid #751017;
  color: #111;
  font-size: 24px;
  font-weight: 900;
}

.mode-preview {
  position: absolute;
  left: 48px;
  top: 28px;
  width: 214px;
  height: 100px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(0, 39, 61, .82), rgba(0, 39, 61, .82)),
    url("assets/ui/room/room-map-bg.webp") center / cover no-repeat;
  border: 4px solid #c28b44;
  color: #ffbd2a;
  font-size: 76px;
  font-weight: 900;
}

.mode-side {
  position: absolute;
  right: -48px;
  width: 42px;
  height: 69px;
  padding: 5px 0;
  writing-mode: vertical-rl;
  border: 2px solid #f0b477;
  background: #b85b32;
  color: #fff9db;
  font-size: 16px;
  font-weight: 900;
}

.mode-side.side-a {
  top: 30px;
}

.mode-side.side-b {
  top: 103px;
}

.room-volume-panel {
  position: absolute;
  left: 14px;
  bottom: 26px;
  width: 82px;
  height: 200px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
}

.room-volume-control {
  width: 28px;
  height: 190px;
  display: grid;
  grid-template-rows: 140px 42px;
  justify-items: center;
  align-items: end;
}

.room-volume-control input {
  width: 26px;
  height: 140px;
  margin: 0;
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: slider-vertical;
  accent-color: #13fb3e;
  cursor: pointer;
}

.room-volume-control span {
  color: #13d7f1;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  writing-mode: vertical-rl;
  text-shadow: 2px 2px 0 #022634, 0 0 4px #18b8da;
}

.room-ninju-editor {
  position: absolute;
  inset: 0;
  z-index: 30;
  color: #f9f4d8;
  background: #05084d;
  border: 3px solid #e9edf8;
  box-shadow: inset 0 0 0 2px #5360b8, 0 0 0 999px rgba(0, 0, 0, .25);
  font-weight: 900;
}

.room-ninju-editor[hidden] {
  display: none;
}

.ninju-editor-profile {
  position: absolute;
  left: 58px;
  top: 42px;
  right: 62px;
  height: 180px;
}

.ninju-editor-avatar {
  position: absolute;
  left: 0;
  top: 0;
  width: 92px;
  height: 92px;
  padding: 10px;
  background: #333;
  border: 5px solid #9b9a8a;
  box-shadow: inset 0 0 0 5px #1c1c1c;
}

.ninju-editor-stats {
  position: absolute;
  left: 142px;
  top: 0;
  display: grid;
  gap: 12px;
  font-size: 20px;
}

.ninju-editor-stats div,
.ninju-editor-score div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ninju-editor-stats span,
.ninju-editor-score span {
  color: #f7f3ed;
  font-size: 24px;
  text-shadow: 2px 2px 0 #151515;
}

.ninju-editor-stats strong,
.ninju-editor-score strong {
  min-width: 72px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0 12px;
  color: #edf550;
  background: #064f8a;
  border-radius: 3px;
}

.ninju-editor-stats button,
.ninju-editor-title button,
.ninju-editor-reset,
.ninju-editor-actions button {
  height: 40px;
  padding: 0 18px;
  color: #1f1f1f;
  font-size: 18px;
  font-weight: 900;
  background: linear-gradient(#fff, #d4d4d4);
  border: 2px solid #202020;
  border-radius: 5px;
}

.ninju-editor-score {
  position: absolute;
  left: 462px;
  top: -20px;
  display: grid;
  gap: 14px;
}

.ninju-editor-score strong {
  min-width: 142px;
  background: #053b9b;
}

.ninju-editor-mark {
  position: absolute;
  right: 26px;
  top: -12px;
  color: #fb171b;
  font-size: 96px;
  line-height: 1;
  transform: rotate(-12deg);
}

.ninju-editor-board {
  position: absolute;
  left: 54px;
  right: 54px;
  bottom: 26px;
  height: 670px;
  background: #423821; /* 忍術介面咖啡色底板；包住左側分類頁籤與右側綠色選忍術面板。 */
  border: 8px solid rgba(55, 45, 26, .95);
  box-shadow: inset 0 0 0 4px #2d2415;
}

.ninju-editor-tabs {
  position: absolute;
  left: 26px;
  top: 66px;
  display: grid;
  gap: 22px;
}

.ninju-editor-tabs button {
  width: 70px;
  height: 38px;
  color: #1616d8;
  font-size: 18px;
  font-weight: 900;
  background: linear-gradient(#fff, #f6eed0);
  border: 3px solid #111;
  border-radius: 5px;
}

.ninju-editor-tabs button.active {
  background: #f0f22b;
  color: #26222a;
}

.ninju-editor-series {
  --series-gap: 40px; /* 左側分類名稱上下 gap；控制回復系、輔助系、攻擊系等文字彼此的距離。 */
  --series-size: 18px; /* 分類文字大小。 */
  --heal-text-offset-x: 0px; /* 回復系 X 軸；正值往右。 */
  --heal-text-offset-y: 0px; /* 回復系 Y 軸；正值往下，負值往上。 */
  --support-text-offset-x: 0px; /* 輔助系 X 軸；正值往右。 */
  --support-text-offset-y: 0px; /* 輔助系 Y 軸；正值往下，負值往上。 */
  --attack-text-offset-x: 0px; /* 攻擊系 X 軸；正值往右。 */
  --attack-text-offset-y: 0px; /* 攻擊系 Y 軸；正值往下，負值往上。 */
  --summon-text-offset-x: 0px; /* 召喚系 X 軸；正值往右。 */
  --summon-text-offset-y: 0px; /* 召喚系 Y 軸；正值往下，負值往上。 */
  --special-text-offset-x: 0px; /* 特殊系 X 軸；正值往右。 */
  --special-text-offset-y: 0px; /* 特殊系 Y 軸；正值往下，負值往上。 */
  --transform-text-offset-x: 0px; /* 變身系 X 軸；正值往右。 */
  --transform-text-offset-y: 0px; /* 變身系 Y 軸；正值往下，負值往上。 */
  position: absolute;
  left: -20px;
  top: 0;
  display: grid;
  grid-template-rows: repeat(6, 30px);
  gap: var(--series-gap);
  align-items: center;
  z-index: 5; /* series labels layer: bigger stays above panel. */
  font-size: var(--series-size);
  font-weight: 200;
  line-height: 1;
  writing-mode: horizontal-tb;
  pointer-events: none;
}

.ninju-editor-options {
  position: relative;
}

.ninju-editor-series span {
  grid-row: var(--editor-row);
  text-shadow:
    1px 0 0 currentColor,
    -1px 0 0 currentColor,
    0 1px 0 currentColor,
    0 -1px 0 currentColor,
    0 0 5px currentColor,
    2px 2px 0 rgba(0, 0, 0, .65);
}

.ninju-editor-series .heal {
  color: #75e39a;
  transform: translate(var(--heal-text-offset-x), var(--heal-text-offset-y));
}

.ninju-editor-series .support {
  color: #f2b56a;
  transform: translate(var(--support-text-offset-x), var(--support-text-offset-y));
}

.ninju-editor-series .attack {
  color: #ef5034;
  transform: translate(var(--attack-text-offset-x), var(--attack-text-offset-y));
}

.ninju-editor-series .summon {
  color: #565cff;
  transform: translate(var(--summon-text-offset-x), var(--summon-text-offset-y));
}

.ninju-editor-series .special {
  color: #24abe1;
  transform: translate(var(--special-text-offset-x), var(--special-text-offset-y));
}

.ninju-editor-series .transform {
  color: #d24fa1;
  transform: translate(var(--transform-text-offset-x), var(--transform-text-offset-y));
}

.ninju-editor-panel {
  position: absolute;
  left: 128px; /* editor panel X: bigger moves right. */
  top: 10px; /* editor panel Y: bigger moves down. */
  right: 48px; /* editor panel right inset: bigger narrows panel. */
  height: 645px; /* editor panel height: bigger makes panel taller. */
  padding: 16px 24px; /* editor panel inner padding: first Y, second X. */
  background: #003b24;
  border: 8px solid #040404; /* editor panel outer border size/color. */
  box-shadow: inset 0 0 0 3px #13a0a8;
}

.ninju-editor-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  color: #dd7831;
  font-size: 21px;
  text-shadow: 1px 1px 0 #182316;
}

.ninju-editor-slot-row {
  margin: 16px auto 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.ninju-editor-slots {
  width: fit-content;
  display: grid;
  grid-template-columns: repeat(6, 88px);
  gap: 12px;
  padding: 8px 18px;
  background: linear-gradient(90deg, #fff4dc, #e5fff5);
}

.ninju-slot-choice,
.ninju-option {
  height: 30px;
  border: 0;
  border-radius: 0;
  color: #232323;
  font-size: 18px;
  font-weight: 900;
  background-color: transparent;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}

.ninju-slot-choice.selected {
  filter: brightness(1.04);
  box-shadow: 0 0 0 2px #f3e94f;
}

.ninju-slot-choice.empty {
  color: #60706d;
  background: linear-gradient(#eef5ef, #cfd8d2);
  border: 3px solid #365c60;
  border-radius: 7px;
}

.ninju-editor-list {
  --ninju-list-offset-x: 45px; /* 可選忍術整組左右位移；正值往右，負值往左。 */
  --ninju-list-offset-y: -5px; /* 可選忍術整組上下位移；這不是每個忍術的上下間距。 */
  --ninju-option-row-gap: 30px; /* 每列忍術按鈕的上下間距；要拉大每個忍術之間的 Y 距離改這裡。 */
  --ninju-option-column-gap: 10px; /* 分類忍術左右 gap；同一列忍術按鈕彼此的距離。 */
  display: grid;
  grid-template-columns: repeat(7, 88px);
  align-items: center;
  transform: translate(var(--ninju-list-offset-x), var(--ninju-list-offset-y)); /* 套用整組清單位移，不改每個按鈕的格線位置。 */
}

.ninju-editor-list {
  /* 清單使用固定 7 欄 x 6 列；實際列數由 JS 依目前分頁的系別重新排列。 */
  grid-template-rows: repeat(6, 40px);
  gap: var(--ninju-option-row-gap) var(--ninju-option-column-gap);
}

.ninju-option {
  /* --editor-order 是欄位，--editor-row 是系別列；兩者都由 ninjutsu-definitions / room UI JS 寫入。 */
  grid-column: var(--editor-order);
  grid-row: var(--editor-row);
}

.ninju-slot-choice[data-editor-row="transform"],
.ninju-option[data-editor-row="transform"] {
  background-image: url("assets/ninju/buttons/5.webp");
}

.ninju-slot-choice[data-editor-row="attack"],
.ninju-option[data-editor-row="attack"] {
  background-image: url("assets/ninju/buttons/1.webp");
}

.ninju-slot-choice[data-editor-row="summon"],
.ninju-option[data-editor-row="summon"] {
  background-image: url("assets/ninju/buttons/6.webp");
}

.ninju-slot-choice[data-editor-row="support"],
.ninju-option[data-editor-row="support"] {
  background-image: url("assets/ninju/buttons/2.webp");
}

.ninju-slot-choice[data-editor-row="heal"],
.ninju-option[data-editor-row="heal"] {
  background-image: url("assets/ninju/buttons/4.webp");
}

.ninju-slot-choice[data-editor-row="special"],
.ninju-option[data-editor-row="special"] {
  background-image: url("assets/ninju/buttons/3.webp");
}

.ninju-option.selected {
  border-color: #f1e535;
}

.ninju-editor-pagination {
  position: absolute;
  right: 12px;
  bottom: 18px;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.ninju-editor-pagination button {
  width: 42px;
  height: 25px;
  padding: 0;
  border: 2px solid #202020;
  border-radius: 4px;
  color: #252525;
  background: linear-gradient(#fff, #c7c7c7);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.ninju-editor-pagination button:disabled {
  opacity: .45;
  cursor: default;
}

.ninju-editor-pagination strong {
  min-width: 42px;
  color: #fff6a0;
  font-size: 16px;
  text-align: center;
  text-shadow: 1px 1px 0 #222;
}

.ninju-editor-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px; /* 取消/儲存按鈕離咖啡色底板下緣的距離；數字越大越往上。 */
  display: flex;
  justify-content: center;
  gap: 100px; /* 取消與儲存兩顆按鈕的水平距離。 */
}

.hud {
  display: none;
  width: min(100%, calc((100vh - 62px) * 1.4117647));
  grid-template-columns: minmax(0, 1fr) 180px 72px;
  gap: 10px;
  align-items: center;
  min-height: 0;
  padding: 5px 8px;
  border: 1px solid rgba(75, 145, 148, 0.5);
  background: #073641;
}

.unit-info {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  color: #edf8f1;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}

.unit-info div {
  min-width: 0;
}

.meter {
  height: 14px;
  overflow: hidden;
  background: #111818;
  border: 1px solid rgba(230, 221, 166, 0.55);
}

.meter i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7f62b9, #f0b65b);
}

button {
  height: 30px;
  border: 1px solid #7aa594;
  background: #1f342e;
  color: #f7fff9;
  padding: 0 10px;
  font: inherit;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.12);
}

.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;
}
