/* WE 王國｜GM 紙娃娃目標版型 + 玩家自訂頭像 */
:root {
  --gm-gold: #e5c36a;
  --gm-gold-strong: #ffdf84;
  --gm-gold-soft: rgba(229, 195, 106, .42);
  --gm-purple: #8f42d7;
  --gm-purple-bright: #c379ff;
  --gm-panel: rgba(8, 8, 13, .94);
  --gm-panel-soft: rgba(14, 12, 21, .88);
  --gm-line: rgba(222, 186, 91, .36);
}

.v2-profile-art,
.v2-session-avatar {
  position: relative;
  overflow: hidden;
}

.kingdom-custom-avatar-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
  z-index: 9;
  pointer-events: none;
}

.kingdom-avatar-upload-trigger {
  appearance: none;
  border: 1px solid rgba(243, 208, 105, .72);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(35, 10, 57, .96), rgba(7, 16, 33, .96));
  color: #f8dea0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .26), inset 0 0 18px rgba(128, 57, 194, .15);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: .04em;
}

.v2-profile-card .kingdom-avatar-upload-trigger {
  margin-top: 14px;
  padding: 9px 14px;
  font-size: 13px;
}

.kingdom-avatar-upload-trigger.is-busy {
  opacity: .66;
  pointer-events: none;
}

.kingdom-avatar-note {
  display: block;
  margin-top: 8px;
  color: rgba(231, 219, 192, .7);
  font-size: 12px;
  line-height: 1.55;
}

.kingdom-gm-launch {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(229, 187, 78, .62);
  border-radius: 12px;
  background:
    radial-gradient(circle at 16% 30%, rgba(151, 55, 232, .28), transparent 38%),
    linear-gradient(135deg, rgba(31, 8, 50, .97), rgba(7, 10, 20, .97));
  color: #f5d476;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 0 24px rgba(154, 66, 226, .12), 0 9px 24px rgba(0, 0, 0, .24);
}

.kingdom-gm-launch img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 0 9px rgba(151, 70, 226, .4));
}

.kingdom-gm-launch strong { display: block; font-size: 15px; letter-spacing: .07em; }
.kingdom-gm-launch small { display: block; margin-top: 3px; color: rgba(237, 225, 198, .68); font-size: 11px; }
.kingdom-gm-launch b { font-size: 22px; color: #d88dff; }

.kingdom-gm-badge-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 3px 8px;
  border: 1px solid rgba(235, 199, 96, .65);
  border-radius: 999px;
  background: rgba(49, 13, 77, .9);
  color: #f3d66f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  vertical-align: middle;
}
.kingdom-gm-badge-inline img { width: 18px; height: 18px; object-fit: contain; }

.kingdom-gm-dialog {
  width: min(1420px, calc(100vw - 20px));
  max-width: 1420px;
  height: min(1040px, calc(100vh - 20px));
  max-height: calc(100vh - 20px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(233, 197, 94, .9);
  border-radius: 2px;
  color: #efe2bd;
  background: #05060a;
  box-shadow: 0 35px 95px rgba(0, 0, 0, .82), inset 0 0 0 1px rgba(255, 236, 159, .08);
  overflow: hidden;
}

.kingdom-gm-dialog::backdrop {
  background: rgba(1, 2, 5, .88);
  backdrop-filter: blur(8px);
}

.kingdom-gm-shell {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 28px 14px;
  overflow: auto;
  background:
    linear-gradient(rgba(229, 195, 106, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229, 195, 106, .018) 1px, transparent 1px),
    radial-gradient(circle at 20% 34%, rgba(88, 26, 138, .13), transparent 34%),
    radial-gradient(circle at 80% 76%, rgba(84, 30, 126, .12), transparent 30%),
    #06070b;
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
}

.kingdom-gm-shell::before,
.kingdom-gm-shell::after {
  content: '';
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 20;
}
.kingdom-gm-shell::before {
  border: 1px solid rgba(232, 196, 96, .22);
  clip-path: polygon(0 0, 13% 0, 13% 1px, 87% 1px, 87% 0, 100% 0, 100% 13%, calc(100% - 1px) 13%, calc(100% - 1px) 87%, 100% 87%, 100% 100%, 87% 100%, 87% calc(100% - 1px), 13% calc(100% - 1px), 13% 100%, 0 100%, 0 87%, 1px 87%, 1px 13%, 0 13%);
}
.kingdom-gm-shell::after {
  inset: 0;
  background:
    linear-gradient(135deg, var(--gm-gold) 0 2px, transparent 2px) top left/34px 34px no-repeat,
    linear-gradient(225deg, var(--gm-gold) 0 2px, transparent 2px) top right/34px 34px no-repeat,
    linear-gradient(45deg, var(--gm-gold) 0 2px, transparent 2px) bottom left/34px 34px no-repeat,
    linear-gradient(315deg, var(--gm-gold) 0 2px, transparent 2px) bottom right/34px 34px no-repeat;
  opacity: .85;
}

.kingdom-gm-head {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 0 8px 14px;
  border-bottom: 1px solid rgba(226, 190, 94, .28);
}

.kingdom-gm-head-title {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
  color: #f5d98a;
  font-family: Georgia, 'Noto Serif TC', serif;
  letter-spacing: .1em;
  white-space: nowrap;
}
.kingdom-gm-head-title span { font-size: clamp(22px, 2.2vw, 34px); font-weight: 700; }
.kingdom-gm-head-title i { width: 1px; height: 29px; background: rgba(235, 202, 112, .58); }
.kingdom-gm-head-title strong { font-size: clamp(20px, 2vw, 31px); font-weight: 700; }

.kingdom-gm-head-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.kingdom-gm-head-tools > img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  margin-top: 4px;
  filter: drop-shadow(0 0 14px rgba(149, 66, 223, .36));
}
.kingdom-gm-head-tools > span {
  padding: 8px 22px;
  border: 1px solid rgba(220, 181, 79, .5);
  background: rgba(22, 16, 29, .9);
  color: #e7ce87;
  font-family: Georgia, 'Noto Serif TC', serif;
  letter-spacing: .08em;
}
.kingdom-gm-help,
.kingdom-gm-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226, 190, 94, .5);
  border-radius: 50%;
  background: rgba(12, 10, 15, .92);
  color: #efd58d;
  font: 700 23px/1 Georgia, serif;
  cursor: pointer;
}
.kingdom-gm-close { font-size: 30px; font-weight: 400; }

.kingdom-gm-grid {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(470px, .92fr);
  gap: 24px;
  padding-top: 20px;
}

.kingdom-gm-left-panel,
.kingdom-gm-equipment-panel {
  min-height: 0;
  border: 1px solid rgba(221, 184, 87, .32);
  background: rgba(7, 8, 12, .74);
  box-shadow: inset 0 0 30px rgba(74, 24, 112, .08);
}

.kingdom-gm-left-panel {
  display: flex;
  flex-direction: column;
  padding: 15px 17px 14px;
}

.kingdom-gm-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #ecd180;
  font-family: Georgia, 'Noto Serif TC', serif;
  font-size: 18px;
  letter-spacing: .08em;
}
.kingdom-gm-section-title span { color: var(--gm-gold-strong); }

.kingdom-gm-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 16px;
}
.kingdom-gm-tab {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid rgba(199, 160, 64, .38);
  background: linear-gradient(180deg, rgba(17, 15, 22, .96), rgba(7, 8, 12, .96));
  color: #c9b98e;
  font: 700 17px/1 Georgia, 'Noto Serif TC', serif;
  letter-spacing: .08em;
  cursor: pointer;
}
.kingdom-gm-tab.is-active {
  border-color: #e4b84c;
  color: #ffe59c;
  background: linear-gradient(135deg, #5f1888, #2a0d43 68%, #130a20);
  box-shadow: inset 0 0 18px rgba(189, 87, 255, .18), 0 0 14px rgba(137, 56, 197, .15);
}

.kingdom-gm-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 590px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(222, 187, 93, .48);
  background: #08090f;
}

.kingdom-gm-avatar-column {
  position: relative;
  z-index: 7;
  align-self: start;
  margin: 20px 0 0 20px;
  padding: 13px 9px 16px;
  border: 1px solid rgba(225, 188, 86, .46);
  background: rgba(5, 6, 11, .91);
  text-align: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .32);
}
.kingdom-gm-portrait-ring {
  position: relative;
  width: 94px;
  height: 94px;
  margin: 0 auto 10px;
  padding: 5px;
  border: 2px solid #c9a548;
  border-radius: 50%;
  background: #0b0b12;
  box-shadow: 0 0 0 4px rgba(229, 195, 106, .08), 0 0 20px rgba(116, 54, 165, .22);
}
.kingdom-gm-portrait-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.kingdom-gm-portrait-ring > button {
  position: absolute;
  right: -4px;
  bottom: 2px;
  width: 28px;
  height: 28px;
  border: 1px solid #d5ad4c;
  border-radius: 50%;
  background: #14131a;
  color: #f3cf70;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.kingdom-gm-avatar-button {
  width: 100%;
  padding: 7px 5px;
  border: 1px solid rgba(212, 170, 70, .56);
  background: linear-gradient(135deg, #3f0d5f, #1d0a2e);
  color: #f5d681;
  font: 700 13px/1.2 Georgia, 'Noto Serif TC', serif;
  cursor: pointer;
}
.kingdom-gm-avatar-column p {
  margin: 9px 0 0;
  color: rgba(231, 220, 193, .72);
  font-size: 11px;
  line-height: 1.55;
}

.kingdom-gm-character-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(3, 4, 8, .1), rgba(3, 4, 8, .28) 56%, rgba(2, 3, 7, .86)),
    url('../assets/kingdom-gm/gm-stage-bg.webp') center 57%/cover no-repeat;
}
.kingdom-gm-character-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 58% 68%, rgba(152, 63, 226, .12), transparent 36%);
  pointer-events: none;
}
.kingdom-gm-body-art {
  position: absolute;
  z-index: 3;
  left: 57%;
  bottom: 16px;
  width: min(72%, 520px);
  height: 90%;
  transform: translateX(-50%);
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .64)) drop-shadow(0 0 12px rgba(123, 44, 183, .15));
}
.kingdom-gm-stage-crest {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 20px;
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(151, 67, 225, .38));
}
.kingdom-gm-stage-caption {
  position: absolute;
  z-index: 6;
  left: 54px;
  bottom: 20px;
  min-width: 330px;
  padding: 10px 18px 10px 18px;
  border-left: 5px solid #bd65ff;
  background: linear-gradient(90deg, rgba(8, 5, 14, .92), rgba(13, 7, 20, .68), transparent);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .8);
}
.kingdom-gm-stage-caption span { display: block; color: #aa94bd; font-size: 12px; letter-spacing: .09em; }
.kingdom-gm-stage-caption strong { display: block; margin-top: 3px; color: #f5d474; font: 700 22px/1.15 Georgia, 'Noto Serif TC', serif; letter-spacing: .06em; }

.kingdom-gm-stage-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-top: 13px;
}
.kingdom-gm-main-action {
  min-height: 48px;
  border: 1px solid rgba(221, 183, 85, .58);
  background: linear-gradient(180deg, #1b171c, #0d0d12);
  color: #ecd28b;
  font: 700 16px/1.2 Georgia, 'Noto Serif TC', serif;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 236, 160, .04);
}
.kingdom-gm-main-action.is-primary {
  background: linear-gradient(135deg, #51117b, #2a0b43 70%, #120719);
  color: #ffe394;
}
.kingdom-gm-main-action.is-saved { border-color: #f4d576; box-shadow: 0 0 18px rgba(202, 124, 255, .3); }
.kingdom-gm-main-action:disabled,
.kingdom-gm-avatar-button:disabled,
.kingdom-gm-portrait-ring > button:disabled,
.kingdom-gm-slot-action:disabled { opacity: .42; cursor: not-allowed; }

.kingdom-gm-equipment-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.kingdom-gm-equipment-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 40px;
  margin-bottom: 10px;
  color: #edcf79;
}
.kingdom-gm-equipment-title h3 { margin: 0; font: 700 23px/1 Georgia, 'Noto Serif TC', serif; letter-spacing: .08em; }
.kingdom-gm-equipment-title span,
.kingdom-gm-equipment-title i { color: #b78f38; font-style: normal; }

.kingdom-gm-slots { display: grid; gap: 7px; }
.kingdom-gm-slot {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 128px;
  align-items: stretch;
  min-height: 66px;
  border: 1px solid rgba(218, 182, 88, .28);
  background: rgba(11, 11, 16, .92);
}
.kingdom-gm-slot.is-weapon {
  border-color: rgba(247, 201, 89, .78);
  box-shadow: inset 0 0 16px rgba(127, 48, 189, .16), 0 0 10px rgba(234, 184, 64, .12);
}
.kingdom-gm-slot-label {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-right: 1px solid rgba(218, 182, 88, .18);
  color: #e9d7a5;
}
.kingdom-gm-slot-label span { width: 32px; color: #d5bd82; font-size: 27px; text-align: center; }
.kingdom-gm-slot-label b { font: 700 17px/1 Georgia, 'Noto Serif TC', serif; letter-spacing: .04em; }
.kingdom-gm-slot-value {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 6px 14px;
  min-width: 0;
}
.kingdom-gm-slot-value strong {
  min-width: 0;
  overflow: hidden;
  color: #b98bdc;
  font: 700 16px/1.2 Georgia, 'Noto Serif TC', serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kingdom-gm-slot-thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(207, 167, 74, .32);
  background: radial-gradient(circle, rgba(77, 31, 112, .62), #09090e 72%);
  color: #d5b95d;
  font-size: 24px;
}
.kingdom-gm-slot-thumb img { width: 100%; height: 100%; object-fit: contain; }
.kingdom-gm-slot-action {
  align-self: center;
  justify-self: center;
  min-width: 108px;
  padding: 9px 12px;
  border: 1px solid rgba(212, 171, 70, .46);
  background: #1e1427;
  color: #e3c87f;
  font: 700 13px/1 Georgia, 'Noto Serif TC', serif;
  cursor: pointer;
}
.kingdom-gm-slot-end {
  align-self: center;
  justify-self: center;
  color: #8d6729;
  font-size: 12px;
}

.kingdom-gm-weapon-card {
  position: relative;
  flex: 1 1 auto;
  min-height: 210px;
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 14px;
  padding: 12px 92px 12px 12px;
  border: 1px solid rgba(221, 182, 78, .55);
  background:
    radial-gradient(circle at 18% 65%, rgba(117, 41, 179, .3), transparent 34%),
    linear-gradient(135deg, rgba(17, 9, 28, .97), rgba(6, 7, 11, .98));
  box-shadow: inset 0 0 30px rgba(104, 38, 156, .08);
}
.kingdom-gm-weapon-art {
  height: 182px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 68%, rgba(141, 57, 209, .26), transparent 58%);
}
.kingdom-gm-weapon-art img { width: 155px; height: 168px; object-fit: contain; filter: drop-shadow(0 0 14px rgba(165, 68, 238, .32)); }
.kingdom-gm-weapon-copy span { color: #d2af54; font-size: 12px; letter-spacing: .12em; }
.kingdom-gm-weapon-copy h4 { margin: 5px 0 0; color: #f4d479; font: 700 30px/1.1 Georgia, 'Noto Serif TC', serif; }
.kingdom-gm-damage { margin-top: 24px; color: #e4c87a; font: 700 17px/1 Georgia, 'Noto Serif TC', serif; }
.kingdom-gm-damage strong { margin-left: 10px; color: #f2d57d; font-size: 49px; font-weight: 500; }
.kingdom-gm-weapon-copy small { display: block; margin-top: 8px; color: rgba(224, 214, 190, .45); font-size: 10px; line-height: 1.5; }
.kingdom-gm-weapon-crest { position: absolute; top: 20px; right: 18px; width: 72px; height: 72px; object-fit: contain; }

.kingdom-gm-footer-note {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 11px 4px 0;
  color: rgba(232, 222, 201, .63);
  font-size: 11px;
  letter-spacing: .05em;
}

@media (max-width: 1100px) {
  .kingdom-gm-dialog { width: calc(100vw - 14px); height: calc(100vh - 14px); max-height: calc(100vh - 14px); }
  .kingdom-gm-shell { padding: 15px; }
  .kingdom-gm-grid { grid-template-columns: 1fr; overflow: visible; }
  .kingdom-gm-left-panel,
  .kingdom-gm-equipment-panel { min-height: auto; }
  .kingdom-gm-stage { min-height: 620px; }
  .kingdom-gm-weapon-card { min-height: 190px; }
}

@media (max-width: 680px) {
  .kingdom-gm-shell { padding: 11px 10px 12px; }
  .kingdom-gm-head { min-height: 54px; padding: 0 1px 10px; gap: 8px; }
  .kingdom-gm-head-title { gap: 7px; white-space: normal; }
  .kingdom-gm-head-title span { display: none; }
  .kingdom-gm-head-title i { display: none; }
  .kingdom-gm-head-title strong { font-size: 24px; }
  .kingdom-gm-head-tools { gap: 7px; }
  .kingdom-gm-head-tools > img { width: 52px; height: 52px; }
  .kingdom-gm-head-tools > span,
  .kingdom-gm-help { display: none; }
  .kingdom-gm-close { width: 42px; height: 42px; }

  .kingdom-gm-grid { padding-top: 12px; gap: 12px; }
  .kingdom-gm-left-panel { padding: 12px 10px; }
  .kingdom-gm-tabs { gap: 5px; margin: 10px 0 12px; }
  .kingdom-gm-tab { min-height: 44px; padding: 7px 4px; font-size: 13px; letter-spacing: .03em; }
  .kingdom-gm-stage { min-height: 535px; grid-template-columns: 1fr; }
  .kingdom-gm-avatar-column { width: 112px; margin: 14px 0 0 13px; padding: 9px 7px 11px; }
  .kingdom-gm-portrait-ring { width: 70px; height: 70px; }
  .kingdom-gm-avatar-button { font-size: 11px; }
  .kingdom-gm-avatar-column p { font-size: 9px; }
  .kingdom-gm-body-art { left: 56%; width: min(95%, 410px); height: 88%; bottom: 20px; }
  .kingdom-gm-stage-crest { width: 62px; height: 62px; top: 12px; right: 10px; }
  .kingdom-gm-stage-caption { left: 15px; bottom: 15px; min-width: 260px; padding: 8px 11px; }
  .kingdom-gm-stage-caption strong { font-size: 18px; }
  .kingdom-gm-stage-actions { gap: 6px; }
  .kingdom-gm-main-action { min-height: 44px; padding: 7px 4px; font-size: 12px; }

  .kingdom-gm-equipment-panel { padding: 10px; }
  .kingdom-gm-equipment-title { margin-bottom: 8px; gap: 9px; }
  .kingdom-gm-equipment-title h3 { font-size: 20px; }
  .kingdom-gm-slot { grid-template-columns: 92px minmax(0, 1fr) 78px; min-height: 58px; }
  .kingdom-gm-slot-label { gap: 7px; padding: 0 8px; }
  .kingdom-gm-slot-label span { width: 22px; font-size: 20px; }
  .kingdom-gm-slot-label b { font-size: 13px; }
  .kingdom-gm-slot-value { gap: 7px; padding: 5px 8px; }
  .kingdom-gm-slot-thumb { flex-basis: 40px; width: 40px; height: 40px; }
  .kingdom-gm-slot-value strong { font-size: 12px; }
  .kingdom-gm-slot-action { min-width: 68px; padding: 7px 4px; font-size: 10px; }
  .kingdom-gm-weapon-card { grid-template-columns: 112px minmax(0, 1fr); gap: 9px; min-height: 160px; padding: 9px 55px 9px 8px; }
  .kingdom-gm-weapon-art { height: 138px; }
  .kingdom-gm-weapon-art img { width: 106px; height: 130px; }
  .kingdom-gm-weapon-copy h4 { font-size: 23px; }
  .kingdom-gm-damage { margin-top: 14px; font-size: 13px; }
  .kingdom-gm-damage strong { margin-left: 5px; font-size: 34px; }
  .kingdom-gm-weapon-copy small { display: none; }
  .kingdom-gm-weapon-crest { width: 48px; height: 48px; top: 12px; right: 8px; }
  .kingdom-gm-footer-note { font-size: 9px; }
}
