/* Khaos Karnival avatar builder — mobile first, site palette. */

.builder-page .stage.builder-stage {
  width: min(1120px, 100%);
  padding: 58px 16px 28px;
  gap: 14px;
  justify-content: flex-start;
  align-items: stretch;
}

.builder-head {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.builder-head .back {
  align-self: flex-start;
  margin-bottom: 4px;
}

.builder-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.builder-title .kk-logo-mark {
  width: 64px;
  height: 64px;
  margin: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(160, 0, 12, 0.65));
  flex: 0 0 auto;
}

.builder-title .kicker {
  color: var(--silver-dim);
  text-align: left;
}

.builder-title h1 {
  margin: 2px 0 4px;
  text-align: left;
}

.builder-page .inner-card.easy-theme,
.builder-page .inner-card.adv-theme {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  width: auto;
  -webkit-mask: none;
  mask: none;
}

.builder-page .inner-card::before {
  display: none;
}

.builder-lead {
  margin: 0;
  max-width: 52ch;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--bone-dim);
  text-shadow: 0 1px 2px #0a0304, 0 0 10px rgba(10, 3, 4, 0.9);
}

.builder-lead.profile-privacy {
  color: var(--gold-bright, #c4a35a);
  margin-bottom: 6px;
}

.profile-privacy-note {
  margin: 0 0 8px;
  max-width: 46ch;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--gold-bright, #c4a35a);
}

.adult-confirm-group,
.save-dialog-adult {
  margin: 8px 0 4px;
}

.adult-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(196, 163, 90, 0.45);
  border-radius: 2px;
  background: rgba(18, 8, 10, 0.72);
  color: var(--bone, #f3e6d0);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.4;
  cursor: pointer;
}

.adult-confirm input[type="checkbox"] {
  appearance: auto;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: #c4a35a;
}

.adult-confirm:focus-within {
  border-color: var(--gold-bright, #c4a35a);
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.45);
}

.adult-confirm-error {
  margin: 6px 0 0;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #e8b4b4;
}

.adult-confirm-error[hidden] {
  display: none;
}

.name-optional {
  font-weight: 400;
  color: var(--bone-dim, #c4b8a8);
  letter-spacing: 0;
  text-transform: none;
}

.avatar-builder {
  display: grid;
  gap: 16px;
  width: 100%;
}

.builder-preview-wrap {
  background:
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(160, 0, 16, 0.28), transparent 70%),
    linear-gradient(180deg, #1a0c0e, #0e0608);
  border: 1px solid rgba(200, 200, 200, 0.18);
  box-shadow:
    0 0 0 1px rgba(80, 0, 8, 0.5) inset,
    0 18px 40px rgba(0, 0, 0, 0.55);
  position: relative;
  overflow: hidden;
  min-height: 320px;
}

.builder-preview-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url("../scratches.svg") center / cover no-repeat,
    repeating-linear-gradient(90deg, transparent 0 11px, rgba(0, 0, 0, 0.08) 11px 12px);
  opacity: 0.35;
  pointer-events: none;
}

.builder-preview {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 8px 8px 0;
}

.builder-preview svg,
#avatar-svg {
  width: min(280px, 78vw);
  height: auto;
  display: block;
  overflow: visible;
}

.preview-caption {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--silver-dim);
}

.builder-controls {
  background: linear-gradient(180deg, #160a0c, #100608);
  border: 1px solid rgba(200, 200, 200, 0.16);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  padding: 12px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.builder-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(200, 200, 200, 0.12);
}

.builder-tabs [role="tab"] {
  flex: 0 0 auto;
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--bone-dim);
  font-family: "Oswald", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.builder-tabs [role="tab"]:hover,
.builder-tabs [role="tab"]:focus-visible {
  color: var(--silver-bright);
  outline: none;
}

.builder-tabs [role="tab"]:focus-visible {
  box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.7);
}

.builder-tabs [role="tab"][aria-selected="true"] {
  color: var(--silver-bright);
  border-bottom-color: #c41e3a;
  text-shadow: 0 0 10px rgba(196, 30, 58, 0.45);
}

.builder-panel h3,
.option-group h3 {
  margin: 0 0 8px;
  font-family: "Oswald", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);
}

.option-group + .option-group {
  margin-top: 14px;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid rgba(200, 200, 200, 0.22);
  background: #1a1012;
  color: var(--bone);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.72rem;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 2px;
}

.swatch.color {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
}

.swatch[aria-pressed="true"] {
  border-color: var(--silver-bright);
  box-shadow: 0 0 0 2px #c41e3a, 0 0 10px rgba(196, 30, 58, 0.45);
  color: var(--silver-bright);
}

.swatch:hover,
.swatch:focus-visible {
  border-color: var(--silver);
  outline: none;
}

.swatch:focus-visible {
  box-shadow: 0 0 0 2px #eeebe6;
}

.swatch.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
  overflow: visible;
}

.swatch.is-locked {
  flex-direction: column;
  padding: 16px 10px 6px;
  overflow: hidden;
}
.swatch .lock-badge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: #3a0810;
  color: #f0d0d0;
  border-bottom: 1px solid #c41e3a;
  font-family: "Oswald", sans-serif;
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 4px;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
  z-index: 1;
}

.swatch-hint {
  margin: 8px 0 0;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.75rem;
  color: var(--bone-dim);
  min-height: 1.2em;
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(200, 200, 200, 0.12);
}

.builder-actions button,
.hub-actions a,
.hub-actions button {
  appearance: none;
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding: 10px 14px;
  border: 1px solid rgba(200, 200, 200, 0.35);
  background: transparent;
  color: var(--bone);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.builder-actions button.primary,
.hub-actions a.primary {
  background: linear-gradient(180deg, #8a1020, #4a0810);
  border-color: #c41e3a;
  color: #f4ece8;
  box-shadow: 0 0 14px rgba(160, 0, 16, 0.35);
}

.builder-actions button:hover,
.builder-actions button:focus-visible,
.hub-actions a:hover,
.hub-actions a:focus-visible,
.hub-actions button:hover,
.hub-actions button:focus-visible {
  border-color: var(--silver-bright);
  color: var(--silver-bright);
  outline: none;
}

.builder-status {
  margin: 0;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.8rem;
  color: var(--bone);
  min-height: 1.25em;
}

.builder-status a,
.edit-avatar {
  color: var(--silver-bright);
}

.adventure-page .builder-controls,
.adventure-page .builder-preview-wrap {
  background:
    repeating-linear-gradient(
      90deg,
      rgba(196, 30, 58, 0.08) 0 12px,
      rgba(0, 0, 0, 0.1) 12px 24px
    ),
    linear-gradient(180deg, #1c0a0e, #0c0406);
}

.hub-card {
  width: min(640px, 100%);
  margin: 0 auto;
  padding: 24px 20px 28px;
  text-align: center;
  background: linear-gradient(180deg, #1a0c0e, #100608);
  border: 1px solid rgba(200, 200, 200, 0.18);
}

.hub-card .builder-preview svg,
.hub-card #avatar-svg {
  width: min(220px, 70vw);
}

.hub-card h2 {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 1.1rem;
  margin: 8px 0;
}

.hub-card .note {
  margin-bottom: 18px;
}

.hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.hub-placeholder {
  margin: 16px 0;
  padding: 14px;
  border: 1px dashed rgba(200, 200, 200, 0.25);
  color: var(--bone-dim);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.hub-placeholder strong {
  color: var(--bone);
  display: block;
  margin-bottom: 4px;
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.hub-actions a.is-soon {
  border-style: dashed;
  border-color: rgba(196, 163, 90, 0.55);
  color: var(--gold, #c4a35a);
}


@media (min-width: 900px) {
  .avatar-builder {
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
  }

  .builder-preview-wrap {
    position: sticky;
    top: 20px;
  }

  .builder-preview svg,
  #avatar-svg {
    width: 300px;
  }
}

@media (max-width: 700px) {
  .builder-page .stage.builder-stage {
    padding: 52px 12px 20px;
  }

  .builder-title .kk-logo-mark {
    width: 52px;
    height: 52px;
  }

  .builder-title h1 {
    font-size: 1.45rem;
  }
}

.builder-page.easy-theme h1 {
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}
.builder-page.adventure-page h1 {
  font-family: "New Rocker", "Times New Roman", serif;
  color: #f0d0d0;
  text-shadow: 0 2px 0 #4a0810, 0 0 16px rgba(196, 30, 58, 0.5);
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}
.builder-page .page-rating {
  margin: 4px 0 0;
  display: inline-block;
}

/* 3D preview */
.avatar-3d {
  width: min(280px, 78vw);
  height: calc(min(280px, 78vw) * 1.75);
  margin: 0 auto;
  cursor: grab;
  touch-action: none;
  position: relative;
}
.avatar-3d[hidden] { display: none; }
.avatar-3d canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}
.avatar-3d.is-dragging,
.avatar-3d.is-dragging canvas { cursor: grabbing; }
.builder-preview.has-webgl #avatar-svg {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}
.avatar-shot {
  width: min(220px, 70vw);
  height: auto;
  display: block;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .avatar-3d {
    width: 300px;
    height: calc(300px * 1.75);
  }
}

body.has-world.builder-page .builder-preview-wrap {
  background: transparent;
  border-color: rgba(200, 200, 200, 0.14);
  box-shadow: none;
  overflow: visible;
}
body.has-world.builder-page .builder-preview-wrap::before {
  display: none;
}
body.has-world.builder-page .avatar-3d {
  width: 100%;
  height: min(58vh, 520px);
  min-height: 360px;
  background: transparent;
}
body.has-world.builder-page .builder-controls {
  background: linear-gradient(180deg, rgba(22, 10, 12, 0.88), rgba(10, 6, 8, 0.9));
  backdrop-filter: blur(8px);
}
body.has-world.builder-page .preview-caption {
  text-shadow: 0 2px 10px #000;
}
@media (min-width: 900px) {
  body.has-world.builder-page .avatar-3d {
    width: 100%;
    height: min(44vh, 400px);
    min-height: 280px;
  }
  body.has-world.builder-page .builder-preview-wrap {
    /* Keep the nameplate + Roll the dice in view at 1280x800 */
    max-height: calc(100vh - 230px);
  }
}


/* Character name, nameplate, roll-the-dice, save dialog */

.character-name-group {
  margin-bottom: 4px;
}

.name-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.name-field input {
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(200, 200, 200, 0.28);
  border-radius: 2px;
  background: #12080a;
  color: var(--bone);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.95rem;
}

.name-field input:hover,
.name-field input:focus {
  border-color: var(--gold-bright, #c4a35a);
  outline: none;
}

.name-field input:focus-visible {
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.55);
}

.name-dice {
  appearance: none;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(196, 163, 90, 0.55);
  border-radius: 2px;
  background: #1a1012;
  color: var(--gold-bright, #c4a35a);
  cursor: pointer;
}

.name-dice:hover,
.name-dice:focus-visible {
  border-color: var(--gold-bright, #c4a35a);
  background: rgba(196, 163, 90, 0.12);
  outline: none;
}

.name-dice:focus-visible {
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.7);
}

.preview-stage-footer {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  padding: 2px 10px 12px;
}

.avatar-nameplate {
  flex: 1 1 150px;
  min-width: 0;
  max-width: 280px;
  margin: 0;
  text-align: center;
  padding: 8px 14px 7px;
  font-family: "New Rocker", "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 400;
  color: #f3d9a4;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #2a1810, #160c0a);
  border: 1px solid var(--gold-bright, #c4a35a);
  box-shadow:
    0 0 0 1px #120c10,
    0 0 0 2px rgba(196, 163, 90, 0.4),
    0 8px 18px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-nameplate.is-empty {
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--silver-dim);
  border-color: rgba(196, 163, 90, 0.35);
}

.hub-card .avatar-nameplate {
  margin: 10px auto 0;
  max-width: 240px;
}

.roll-dice {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #c41e3a;
  border-radius: 2px;
  background: linear-gradient(180deg, #8a1020, #4a0810);
  color: #f4ece8;
  font-family: "Oswald", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(160, 0, 16, 0.35);
}

.roll-dice:hover,
.roll-dice:focus-visible {
  color: #fff;
  border-color: var(--silver-bright);
  outline: none;
}

.roll-dice:focus-visible {
  box-shadow: 0 0 0 2px #f3d9a4, 0 0 14px rgba(160, 0, 16, 0.35);
}

.roll-dice .die-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
}

.roll-dice.is-rolling .die-icon,
.roll-dice.is-rolling .die-icon svg {
  animation: khaos-roll-die 0.7s ease-in-out;
  transform-origin: 50% 50%;
}

.roll-undo {
  appearance: none;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(200, 200, 200, 0.35);
  background: transparent;
  color: var(--bone);
  font-family: "Oswald", sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.roll-undo[hidden] {
  display: none !important;
}

.roll-undo:hover,
.roll-undo:focus-visible {
  border-color: var(--silver-bright);
  color: var(--silver-bright);
  outline: none;
}

@keyframes khaos-roll-die {
  0% { transform: rotate(0deg) scale(1); }
  40% { transform: rotate(280deg) scale(1.15); }
  100% { transform: rotate(720deg) scale(1); }
}

.avatar-builder.is-rolling .builder-preview:not(.has-webgl) #avatar-svg {
  animation: khaos-avatar-shake 0.7s ease-in-out;
}

@keyframes khaos-avatar-shake {
  0%, 100% { transform: rotate(0deg) translateX(0); }
  20% { transform: rotate(-6deg) translateX(-6px); }
  50% { transform: rotate(8deg) translateX(8px); }
  75% { transform: rotate(-3deg) translateX(-3px); }
}

.saved-guest {
  display: inline-block;
  margin-left: 4px;
}

.sign-in-later {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--gold-bright, #c4a35a);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.sign-in-later:hover,
.sign-in-later:focus-visible {
  color: var(--silver-bright);
  outline: none;
}

body.is-save-open {
  overflow: hidden;
}

.save-dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
}

.save-dialog[hidden] {
  display: none;
}

.save-dialog-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(40, 8, 14, 0.7), rgba(4, 1, 2, 0.92));
  backdrop-filter: blur(5px);
}

.save-dialog-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  text-align: center;
  padding: 28px 22px 22px;
  color: var(--bone);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(196, 30, 58, 0.16), transparent 50%),
    linear-gradient(180deg, #221018, #160e12);
  box-shadow:
    0 0 0 1px rgba(180, 180, 180, 0.45),
    0 0 0 5px #120c10,
    0 0 0 6px rgba(196, 30, 58, 0.65),
    0 28px 70px rgba(0, 0, 0, 0.75);
}

.save-dialog-logo {
  display: block;
  width: min(140px, 46%);
  height: auto;
  margin: 0 auto 8px;
}

.save-dialog-kicker {
  margin: 0;
  font-family: "Cinzel", "Times New Roman", serif;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold, #8a7340);
}

.save-dialog-card h2 {
  margin: 8px 0 10px;
  font-family: "New Rocker", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.45rem, 5vw, 2rem);
  color: #f3d9a4;
  text-shadow: 0 2px 0 #4a0810, 0 0 16px rgba(196, 30, 58, 0.5);
}

.save-dialog-card #save-dialog-body {
  margin: 0 auto 16px;
  max-width: 36ch;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--bone);
}

.save-dialog-name {
  text-align: left;
  margin: 0 0 16px;
}

.save-dialog-name label {
  display: block;
  margin: 0 0 6px;
  font-family: "Oswald", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);
}

.save-dialog-name-hint {
  margin: 8px 0 0;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--gold-bright, #c4a35a);
}

.save-dialog-name-hint[hidden] {
  display: none;
}

.save-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.save-opt,
.save-opt-guest-alt,
.save-dialog-close {
  font-family: "Oswald", sans-serif;
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  transition: background 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.save-opt-account,
.save-opt-signin {
  color: var(--gold, #8a7340);
  background: transparent;
  border: 1px dashed rgba(196, 163, 90, 0.55);
}

.save-opt-account:hover,
.save-opt-account:focus-visible,
.save-opt-signin:hover,
.save-opt-signin:focus-visible {
  background: rgba(196, 163, 90, 0.12);
  color: var(--gold-bright, #c4a35a);
  outline: none;
}

.soon-tag {
  display: inline-block;
  padding: 2px 7px 1px;
  border: 1px solid rgba(196, 163, 90, 0.7);
  border-radius: 2px;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: #f3d9a4;
  background: rgba(74, 8, 16, 0.7);
}

.save-opt-guest,
.save-opt-guest-alt {
  color: #f3d9a4;
  background: rgba(196, 30, 58, 0.28);
  border: 1px solid var(--crimson, #9b1020);
}

.save-opt-guest:hover,
.save-opt-guest:focus-visible,
.save-opt-guest-alt:hover,
.save-opt-guest-alt:focus-visible,
.save-opt-guest.primary:hover,
.save-opt-guest.primary:focus-visible {
  background: rgba(196, 30, 58, 0.48);
  color: #fff;
  outline: none;
}

.save-dialog-guest-note {
  margin: 10px 0 0;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--bone-dim);
}

.save-dialog-actions[hidden],
.save-dialog-guest-note[hidden] {
  display: none;
}

.save-dialog.is-accounts-on .save-opt-account,
.save-dialog.is-accounts-on .save-opt-signin {
  border-style: solid;
}

.save-dialog-auth {
  text-align: left;
  margin: 4px 0 8px;
}

.save-dialog-auth[hidden] {
  display: none;
}

.save-dialog-auth-field {
  margin: 0 0 12px;
}

.save-dialog-auth-field[hidden] {
  display: none;
}

.save-dialog-auth-field label {
  display: block;
  margin: 0 0 6px;
  font-family: "Oswald", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--silver);
}

.save-dialog-auth-field input {
  appearance: none;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(200, 200, 200, 0.28);
  border-radius: 2px;
  background: #12080a;
  color: var(--bone);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 16px;
}

.save-dialog-auth-field input:hover,
.save-dialog-auth-field input:focus {
  border-color: var(--gold-bright, #c4a35a);
  outline: none;
}

.save-dialog-auth-field input:focus-visible {
  box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.55);
}

.save-dialog-auth-error,
.save-dialog-auth-note {
  margin: 0 0 10px;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.84rem;
  line-height: 1.4;
}

.save-dialog-auth-error {
  color: #e8b4b4;
}

.save-dialog-auth-note {
  color: #c8f0c0;
}

.save-dialog-auth-error[hidden],
.save-dialog-auth-note[hidden] {
  display: none;
}

.save-dialog-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.save-dialog-auth-link {
  font-family: "Oswald", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold, #8a7340);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  min-height: 44px;
  padding: 8px 4px;
}

.save-dialog-auth-link:hover,
.save-dialog-auth-link:focus-visible {
  color: var(--gold-bright, #c4a35a);
  outline: none;
}

.save-dialog-auth-link[hidden] {
  display: none;
}

.save-dialog-soon-msg {
  margin: 14px 0 0;
  padding: 12px 12px 14px;
  border: 1px solid rgba(196, 30, 58, 0.45);
  background: rgba(40, 8, 14, 0.55);
}

.save-dialog-soon-msg[hidden] {
  display: none;
}

.save-dialog-soon-msg p {
  margin: 0 0 12px;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--bone);
}

.save-dialog-close {
  margin-top: 12px;
  width: 100%;
  color: var(--silver-dim);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.save-dialog-close:hover,
.save-dialog-close:focus-visible {
  color: var(--silver-bright);
  outline: none;
}

@media (max-width: 700px) {
  .preview-stage-footer {
    padding-bottom: 10px;
  }
  .roll-dice {
    width: 100%;
  }
  .roll-undo:not([hidden]) {
    width: 100%;
  }
  .avatar-nameplate {
    max-width: none;
    flex-basis: 100%;
  }
  .save-dialog {
    padding: 10px;
    align-items: end;
  }
  .save-dialog-card {
    padding: 20px 16px 16px;
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .roll-dice.is-rolling .die-icon,
  .roll-dice.is-rolling .die-icon svg,
  .avatar-builder.is-rolling .builder-preview:not(.has-webgl) #avatar-svg,
  .save-opt,
  .save-opt-guest-alt,
  .save-dialog-close {
    animation: none;
    transition: none;
  }
}


/* Karnival Koins */

.builder-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.koin-chip {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 40px;
  padding: 6px 12px 6px 8px;
  margin-left: auto;
  border: 1px solid var(--gold-bright, #c4a35a);
  border-radius: 2px;
  background: linear-gradient(180deg, #2a1810, #160c0a);
  color: #f3d9a4;
  font-family: "Oswald", sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 0 0 1px #120c10,
    0 0 0 2px rgba(196, 163, 90, 0.35),
    0 6px 14px rgba(0, 0, 0, 0.4);
}

.koin-chip.is-signed-in {
  cursor: default;
}

.koin-chip.is-guest:hover,
.koin-chip.is-guest:focus-visible {
  border-color: #f3d9a4;
  color: #fff;
  outline: none;
}

.koin-chip:focus-visible {
  box-shadow: 0 0 0 2px #f3d9a4;
}

.koin-chip .koin-icon,
.koin-dialog-card > .koin-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 4px rgba(196, 163, 90, 0.45));
}

.koin-chip-text {
  min-width: 0;
  text-align: left;
  line-height: 1.25;
  white-space: normal;
}

.koin-chip.is-celebrating {
  animation: koin-celebrate 0.85s ease-out;
}

@keyframes koin-celebrate {
  0% { box-shadow: 0 0 0 1px #120c10, 0 0 0 2px #f3d9a4, 0 0 0 0 rgba(196, 163, 90, 0.8); transform: scale(1); }
  40% { box-shadow: 0 0 0 1px #120c10, 0 0 0 2px #f3d9a4, 0 0 18px 6px rgba(196, 163, 90, 0.55); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 1px #120c10, 0 0 0 2px rgba(196, 163, 90, 0.35), 0 6px 14px rgba(0, 0, 0, 0.4); transform: scale(1); }
}

.lock-badge-sub {
  display: block;
  font-size: 0.48rem;
  letter-spacing: 0.05em;
  margin-top: 1px;
  color: #f3d9a4;
}

.swatch.is-koin-locked {
  cursor: pointer;
}

.swatch.is-koin-locked:hover,
.swatch.is-koin-locked:focus-visible {
  opacity: 0.95;
  border-color: var(--gold-bright, #c4a35a);
}

.koin-dialog-card > .koin-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 8px;
}

.koin-unlock-balance {
  margin: 0 0 10px;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.85rem;
  color: var(--bone-dim);
}

.koin-unlock-short {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(196, 30, 58, 0.45);
  background: rgba(40, 8, 14, 0.55);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--gold-bright, #c4a35a);
}

.koin-unlock-short[hidden] {
  display: none;
}

.koin-dialog-card [data-act="unlock"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
  background: rgba(196, 30, 58, 0.18);
}

@media (max-width: 700px) {
  .builder-title-row {
    flex-direction: column;
    align-items: stretch;
  }
  .koin-chip {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .koin-chip.is-celebrating {
    animation: none;
  }
}


@font-face {
  font-family: "Metal Mania";
  src: url("../fonts/metalmania/MetalMania-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.builder-actions button.enter-karnival {
  font-family: "Metal Mania", "New Rocker", "Times New Roman", serif;
  font-size: 1.22rem;
  letter-spacing: 0.03em;
  text-transform: none;
  line-height: 1.1;
  padding: 11px 18px 10px;
  color: #f7d7a4;
  background:
    linear-gradient(180deg, #6a1018 0%, #3a060c 55%, #1a0206 100%);
  border: 1px solid #c41e3a;
  text-shadow:
    0 1px 0 #1a0206,
    0 0 10px rgba(196, 30, 58, 0.85),
    0 0 2px rgba(243, 217, 164, 0.35);
  box-shadow:
    0 0 0 1px rgba(80, 0, 10, 0.7) inset,
    0 0 16px rgba(160, 0, 16, 0.55);
}

.builder-actions button.enter-karnival:hover,
.builder-actions button.enter-karnival:focus-visible {
  color: #fff4dc;
  border-color: #f3d9a4;
  background: linear-gradient(180deg, #8a1420 0%, #4a0810 55%, #220308 100%);
  text-shadow: 0 0 12px rgba(196, 30, 58, 1), 0 0 4px #f3d9a4;
  animation: enter-karnival-flicker 1.1s ease-in-out infinite;
  outline: none;
}

@keyframes enter-karnival-flicker {
  0%, 100% { filter: brightness(1); box-shadow: 0 0 0 1px rgba(80, 0, 10, 0.7) inset, 0 0 16px rgba(160, 0, 16, 0.55); }
  40% { filter: brightness(1.18); box-shadow: 0 0 0 1px rgba(80, 0, 10, 0.7) inset, 0 0 22px rgba(196, 30, 58, 0.85); }
  55% { filter: brightness(0.92); }
  70% { filter: brightness(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .builder-actions button.enter-karnival:hover,
  .builder-actions button.enter-karnival:focus-visible {
    animation: none;
  }
}

/* Ticket-booth gate overlay */
#karnival-gate-ui {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

body.is-gate-playing .builder-stage,
body.is-gate-playing .builder-head,
body.is-gate-playing .builder-controls,
body.is-gate-playing .credit,
body.is-gate-playing .speaker,
body.is-gate-playing .koin-chip {
  visibility: hidden;
}

body.is-gate-playing .khaos-world {
  z-index: 4;
}

.gate-skip,
.gate-push {
  pointer-events: auto;
  appearance: none;
  cursor: pointer;
  font-family: "Oswald", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  min-height: 44px;
}

.gate-skip {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px 14px;
  border: 1px solid rgba(200, 200, 200, 0.4);
  background: rgba(10, 4, 6, 0.72);
  color: var(--bone, #d8d0c4);
}

.gate-skip:hover,
.gate-skip:focus-visible {
  border-color: #f3d9a4;
  color: #fff;
  outline: none;
}

.gate-push {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 12px 22px;
  font-size: 0.95rem;
  color: #f3d9a4;
  background: linear-gradient(180deg, #8a1020, #4a0810);
  border: 1px solid #c41e3a;
  box-shadow: 0 0 18px rgba(160, 0, 16, 0.5);
}

.gate-push:hover,
.gate-push:focus-visible {
  color: #fff;
  border-color: #f3d9a4;
  outline: none;
}

.gate-bubble {
  pointer-events: none;
  position: absolute;
  left: 52%;
  top: 14%;
  width: min(420px, 86vw);
  padding: 14px 16px 16px;
  background: linear-gradient(180deg, #221018, #160e12);
  border: 1px solid rgba(196, 163, 90, 0.55);
  box-shadow: 0 0 0 1px #120c10, 0 16px 40px rgba(0, 0, 0, 0.55);
  color: var(--bone, #d8d0c4);
}

.gate-bubble[hidden],
.gate-push[hidden],
.gate-visitor-name[hidden] {
  display: none;
}

.gate-bubble p {
  margin: 0;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.45;
}

.gate-visitor-name {
  pointer-events: none;
  position: absolute;
  left: 18%;
  bottom: 22%;
  min-width: 80px;
  padding: 6px 12px;
  text-align: center;
  font-family: "New Rocker", "Times New Roman", serif;
  color: #f3d9a4;
  background: linear-gradient(180deg, #2a1810, #160c0a);
  border: 1px solid #c4a35a;
}

@media (max-width: 700px) {
  .gate-bubble {
    left: 7%;
    top: 12%;
    width: 86vw;
  }
  .gate-visitor-name {
    left: 8%;
    bottom: 18%;
  }
  .builder-actions button.enter-karnival {
    width: 100%;
    font-size: 1.28rem;
  }
}

/* Walkman / car radio option on the extras (rides) step */
.walkman-opt .walkman-opt-note {
  margin: 0 0 10px;
  font-family: "Special Elite", monospace;
  font-size: 0.92rem;
  color: var(--silver-dim, #c4b8a8);
  max-width: 40rem;
}
.walkman-opt-toggle[aria-pressed="true"] {
  background: #4a0810;
  border-color: #f3d9a4;
  color: #f3d9a4;
  box-shadow: 0 0 0 2px #c41e3a;
}
.walkman-opt-toggle:disabled {
  opacity: 0.7;
}
