.profile-prompt {
  margin: -2px 0 9px;
  color: #f1dba8;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.35;
}

.stage-nameplate {
  position: absolute;
  top: var(--stage-name-y, 170px);
  left: var(--stage-name-x, 50%);
  z-index: 10;
  display: grid;
  box-sizing: border-box;
  width: max-content;
  min-width: min(334px, 51%);
  max-width: min(495px, 60%);
  min-height: 62px;
  padding: 8px 35px 9px;
  place-items: center;
  gap: 2px;
  border: 2px solid #321719;
  border-radius: 12px 15px 11px 17px;
  color: #fff3cf;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0, rgba(255, 224, 144, 0.18), transparent 48%),
    linear-gradient(145deg, rgba(18, 84, 61, 0.97), rgba(7, 48, 42, 0.98) 58%, rgba(75, 35, 25, 0.98));
  box-shadow:
    0 0 0 2px #d79b36,
    0 0 0 4px rgba(48, 21, 18, 0.92),
    0 8px 18px rgba(0, 0, 0, 0.34),
    inset 0 1px rgba(255, 246, 211, 0.22);
  transform: translate(-50%, -100%);
  transform-origin: bottom center;
  transition: filter 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.stage-nameplate::before,
.stage-nameplate::after {
  position: absolute;
  top: 50%;
  color: #ffd274;
  content: "\2726";
  font-size: 0.86rem;
  transform: translateY(-50%);
}

.stage-nameplate::before { left: 9px; }
.stage-nameplate::after { right: 9px; }

.stage-nameplate:hover,
.stage-nameplate:focus-visible {
  filter: brightness(1.12) saturate(1.08);
}

button.stage-nameplate:active:not(:disabled) {
  transform: translate(-50%, -100%);
}

.stage-nameplate:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 5px;
}

.stage-nameplate-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #fff5d6;
  font-family: Copperplate, "Copperplate Gothic Light", "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.2rem, 2.6vw, 1.98rem);
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 #321719, 1px 0 #321719, -1px 0 #321719, 0 0 12px rgba(255, 211, 107, 0.24);
  white-space: nowrap;
}

.stage-nameplate.is-long .stage-nameplate-name {
  font-size: clamp(0.82rem, 1.65vw, 1.25rem);
  letter-spacing: 0.015em;
}

.stage-nameplate.is-very-long .stage-nameplate-name {
  font-size: clamp(0.74rem, 1.35vw, 1.05rem);
  letter-spacing: 0;
}

.stage-nameplate-role {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #ffd98c;
  font-size: clamp(0.58rem, 1vw, 0.75rem);
  font-weight: 900;
  letter-spacing: 0.11em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage-nameplate.is-empty {
  min-width: min(299px, 44%);
  max-width: min(380px, 46%);
  border-style: dashed;
  background: linear-gradient(145deg, rgba(11, 68, 55, 0.97), rgba(5, 39, 35, 0.99));
  animation: nameplate-invite 2.8s ease-in-out infinite;
}

.stage-nameplate.is-empty .stage-nameplate-name {
  font-size: clamp(0.76rem, 1.25vw, 0.95rem);
  font-style: normal;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: normal;
}

.stage-nameplate.is-name-celebrating {
  animation:
    nameplate-magic-wiggle 760ms cubic-bezier(0.22, 1.35, 0.38, 1) both,
    nameplate-magic-glow 1050ms ease-out both;
}

.stage-nameplate.is-name-confirmed-reduced {
  filter: brightness(1.14) saturate(1.08);
  box-shadow:
    0 0 0 2px #ffe08a,
    0 0 0 4px rgba(48, 21, 18, 0.92),
    0 8px 18px rgba(0, 0, 0, 0.34),
    0 0 24px rgba(125, 231, 228, 0.48),
    inset 0 1px rgba(255, 246, 211, 0.28);
}

.stage-sparkles > .nameplate-magic-particle {
  z-index: 2;
  width: 20px;
  height: 20px;
  color: var(--spark-color, #ffe38d);
  font-size: 18px;
  text-shadow: 0 0 6px currentColor, 0 0 14px currentColor;
  animation: nameplate-magic-particle 980ms cubic-bezier(0.2, 0.78, 0.24, 1) both;
  animation-delay: var(--delay, 0ms);
}

.stage-card.randomizing .stage-nameplate {
  pointer-events: none;
  opacity: 0;
}

@keyframes nameplate-invite {
  0%, 100% { box-shadow: 0 0 0 2px #d79b36, 0 0 0 4px rgba(48, 21, 18, 0.92), 0 8px 18px rgba(0, 0, 0, 0.34); }
  50% { box-shadow: 0 0 0 2px #edc365, 0 0 0 4px rgba(48, 21, 18, 0.92), 0 8px 18px rgba(0, 0, 0, 0.34), 0 0 20px rgba(125, 231, 228, 0.28); }
}

@keyframes nameplate-magic-wiggle {
  0%, 100% { transform: translate(-50%, -100%) rotate(0deg) scale(1); }
  16% { transform: translate(calc(-50% - 4px), calc(-100% - 1px)) rotate(-1.8deg) scale(1.025); }
  32% { transform: translate(calc(-50% + 5px), calc(-100% - 3px)) rotate(2deg) scale(1.045); }
  48% { transform: translate(calc(-50% - 3px), calc(-100% - 2px)) rotate(-1.4deg) scale(1.035); }
  65% { transform: translate(calc(-50% + 2px), calc(-100% - 1px)) rotate(0.8deg) scale(1.018); }
  82% { transform: translate(calc(-50% - 1px), -100%) rotate(-0.35deg) scale(1.006); }
}

@keyframes nameplate-magic-glow {
  0%, 100% {
    filter: brightness(1) saturate(1);
    box-shadow: 0 0 0 2px #d79b36, 0 0 0 4px rgba(48, 21, 18, 0.92), 0 8px 18px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 246, 211, 0.22);
  }
  36% {
    filter: brightness(1.18) saturate(1.12);
    box-shadow: 0 0 0 2px #ffe08a, 0 0 0 4px rgba(48, 21, 18, 0.92), 0 8px 18px rgba(0, 0, 0, 0.34), 0 0 28px rgba(125, 231, 228, 0.56), inset 0 1px rgba(255, 246, 211, 0.3);
  }
}

@keyframes nameplate-magic-particle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.15) rotate(0deg);
  }
  22% { opacity: 1; }
  68% {
    opacity: 1;
    transform: translate(calc(-50% + var(--spark-dx)), calc(-50% + var(--spark-dy))) scale(1.2) rotate(110deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--spark-dx)), calc(-50% + var(--spark-dy))) scale(0.25) rotate(190deg);
  }
}

.name-modal-card {
  width: min(570px, 100%);
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle 95px at calc(100% + 47px) calc(100% - 35px),
      transparent 69px,
      rgba(255, 222, 143, 0.035) 70px 94px,
      transparent 95px),
    radial-gradient(circle at 50% 0, rgba(255, 211, 111, 0.2), transparent 31%),
    linear-gradient(145deg, #174f3e, #092d2b 52%, #412318 100%);
}

.name-modal-card::after {
  content: none;
}

.name-modal-stars {
  margin-bottom: 6px;
  color: #ffd06a;
  letter-spacing: 0.42em;
  text-align: center;
}

.name-modal-description {
  margin: -8px 0 16px;
  color: #f3dfb7;
  font-size: 0.92rem;
  line-height: 1.5;
}

.name-job-field {
  display: grid;
  min-width: 0;
  margin-bottom: 5px;
  gap: 6px;
}

.name-job-field > label {
  color: #e9ce93;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.name-job-select-wrap {
  position: relative;
  min-width: 0;
}

.name-job-select {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 10px 48px 10px 13px;
  appearance: none;
  border: 2px solid var(--occupation-accent, #d79b36);
  border-radius: 12px 15px 11px 16px;
  color: #fff1c9;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(135deg, rgba(32, 103, 78, 0.72), rgba(4, 28, 25, 0.94));
  box-shadow: inset 0 0 0 2px rgba(37, 21, 15, 0.55), 0 3px 0 rgba(37, 21, 15, 0.7);
  cursor: pointer;
}

.name-job-select-wrap::after {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 10px;
  height: 10px;
  pointer-events: none;
  content: "";
  border-right: 3px solid var(--brass-light);
  border-bottom: 3px solid var(--brass-light);
  transform: translateY(-70%) rotate(45deg);
}

.name-job-select:hover {
  filter: brightness(1.08);
}

.name-job-select:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(125, 231, 228, 0.22);
}

.name-job-select option {
  color: var(--paper-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  background: var(--cream);
}

.name-form {
  display: grid;
  gap: 8px;
}

.name-form > label {
  color: #fff0c8;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
}

.name-form .name-input {
  min-height: 56px;
  padding: 11px 14px;
  font-size: 1.15rem;
}

.name-form .name-input[aria-invalid="true"] {
  border-color: #ef6d63;
  box-shadow: 0 0 0 2px rgba(239, 109, 99, 0.25);
}

.name-input-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  color: #d7c49d;
  font-size: 0.68rem;
  line-height: 1.35;
}

#name-counter {
  flex: 0 0 auto;
  color: #ffe095;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

#name-counter.is-near-limit { color: #ffad7d; }

.name-error {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid #ef6d63;
  border-radius: 4px 10px 10px 4px;
  color: #fff0e7;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(101, 22, 28, 0.74);
}

.name-modal-actions {
  display: grid;
  grid-template-columns: minmax(148px, 1.08fr) minmax(112px, 0.92fr) minmax(162px, 1.25fr);
  margin-top: 10px;
  gap: 8px;
}

.name-modal-actions > * {
  min-width: 0;
  min-height: 47px;
}

.name-suggest-btn {
  width: 100%;
  padding: 9px 10px 9px 34px;
  border-color: #351811;
  border-radius: 14px 12px 16px 11px;
  color: #fff7d7;
  font-size: 0.74rem;
  letter-spacing: 0.025em;
  white-space: nowrap;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.34), transparent 27%),
    linear-gradient(155deg, #278f84 0%, #17665d 53%, #0c3c39 100%);
  box-shadow:
    0 0 0 1px rgba(255, 216, 120, 0.68),
    inset 0 1px rgba(255, 255, 255, 0.24),
    0 4px 0 rgba(24, 11, 7, 0.85),
    0 0 16px rgba(125, 231, 228, 0.08);
}

.name-suggest-btn::before {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 14px;
  height: 14px;
  content: "";
  background: #ffe08a;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 5px rgba(255, 220, 125, 0.7));
  transform: translateY(-50%) rotate(-8deg);
  animation: name-suggest-twinkle 3.6s ease-in-out infinite;
}

.name-suggest-btn::after {
  position: absolute;
  inset: 4px;
  pointer-events: none;
  content: "";
  border: 1px dashed rgba(255, 226, 148, 0.28);
  border-radius: 9px 8px 11px 7px;
}

.name-suggest-btn:hover:not(:disabled) {
  border-color: var(--brass-light);
  color: #fffdf0;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.42), transparent 29%),
    linear-gradient(155deg, #33a99c 0%, #1c766b 53%, #104943 100%);
  box-shadow:
    0 0 0 1px var(--brass-light),
    inset 0 1px rgba(255, 255, 255, 0.3),
    0 5px 0 rgba(24, 11, 7, 0.85),
    0 0 21px rgba(125, 231, 228, 0.24);
  transform: translateY(-2px);
}

.name-suggest-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.name-suggest-btn:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px rgba(125, 231, 228, 0.22),
    0 4px 0 rgba(24, 11, 7, 0.85),
    0 0 21px rgba(125, 231, 228, 0.24);
}

@keyframes name-suggest-twinkle {
  0%, 70%, 100% {
    filter: drop-shadow(0 0 5px rgba(255, 220, 125, 0.7));
    transform: translateY(-50%) rotate(-8deg) scale(1);
  }
  79% {
    filter: drop-shadow(0 0 9px rgba(255, 232, 164, 0.95));
    transform: translateY(-50%) rotate(7deg) scale(1.18);
  }
  87% {
    transform: translateY(-50%) rotate(-3deg) scale(0.97);
  }
}

@media (max-width: 720px) {
  .stage-nameplate {
    min-width: min(242px, 76%);
    max-width: 82%;
    min-height: 53px;
    padding: 6px 28px 7px;
  }

  .stage-nameplate.is-empty {
    min-width: min(267px, 80%);
    max-width: 84%;
  }

  .stage-nameplate-name { font-size: 1.15rem; }
  .stage-nameplate.is-long .stage-nameplate-name { font-size: 0.82rem; }
  .stage-nameplate.is-very-long .stage-nameplate-name { font-size: 0.72rem; }
  .stage-nameplate.is-empty .stage-nameplate-name { font-size: 0.7rem; }
  .stage-nameplate.is-long .stage-nameplate-name {
  font-size: clamp(0.82rem, 1.65vw, 1.25rem);
  letter-spacing: 0.015em;
}

.stage-nameplate.is-very-long .stage-nameplate-name {
  font-size: clamp(0.74rem, 1.35vw, 1.05rem);
  letter-spacing: 0;
}

.stage-nameplate-role { font-size: 0.46rem; }

  .speech-bubble {
    top: clamp(110px, 27%, 136px);
    right: auto;
    bottom: auto;
    left: clamp(12px, 4.5vw, 26px);
    width: min(45%, 190px);
    max-height: 68px;
    padding: 7px 10px;
    overflow: hidden;
    font-size: 0.68rem;
    line-height: 1.18;
    transform: none;
    animation: none;
  }

  .speech-bubble::after {
    display: block;
    right: 12px;
    bottom: -10px;
    left: auto;
  }

  .name-modal-actions { grid-template-columns: 1fr; }
}

@media (forced-colors: active) {
  .name-job-select { appearance: auto; }
  .name-job-select-wrap::after { display: none; }
  .name-suggest-btn {
    color: ButtonText;
    border-color: ButtonText;
    background: ButtonFace;
    box-shadow: none;
  }
  .name-suggest-btn::before {
    background: ButtonText;
    filter: none;
  }
  .name-suggest-btn::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .stage-nameplate.is-empty,
  .stage-nameplate.is-name-celebrating,
  .stage-sparkles > .nameplate-magic-particle { animation: none; }
  .name-suggest-btn::before { animation: none; }
}