/* King James 2 — Castle / Throne Hall */

.kj-castle-bg {
  background: linear-gradient(180deg, #3a2a73 0%, #1c0e49 100%);
}
.kj-castle-throne {
  text-align: center;
  padding: 20px 14px 10px;
}
.kj-throne-crown {
  font-size: 96px;
  display: inline-block;
  animation: kj-wobble 2.4s ease-in-out infinite;
}
.kj-crown-bubble {
  margin: 10px auto;
  max-width: 360px;
  background: #fff;
  color: #2d1b69;
  border: 2px solid gold;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 600;
  position: relative;
  animation: kj-fadeIn 0.4s ease-out;
}
.kj-crown-bubble::before {
  content: '';
  position: absolute;
  top: -10px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-bottom: 10px solid #fff;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
}
.kj-castle-rooms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 6px;
}
.kj-room-card {
  background: rgba(255,255,255,0.1);
  border: 2px solid gold;
  border-radius: 14px;
  padding: 14px 8px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform 0.12s;
}
.kj-room-card:active { transform: scale(0.95); }
.kj-room-emoji { font-size: 38px; }
.kj-room-name  { font-size: 16px; font-weight: bold; margin-top: 6px; }
.kj-castle-footer {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

/* Region backgrounds (applied to scene wrappers via kj-bg-<id>) */
.kj-bg-forest   { background: linear-gradient(180deg, #2d4a2e 0%, #16331a 100%); }
.kj-bg-mountain { background: linear-gradient(180deg, #5a7d9a 0%, #2e4256 100%); }
.kj-bg-beach    { background: linear-gradient(180deg, #7ac0d6 0%, #265d74 100%); }
.kj-bg-desert   { background: linear-gradient(180deg, #d8b974 0%, #8c7232 100%); }
.kj-bg-volcano  { background: linear-gradient(180deg, #8a2121 0%, #3b0909 100%); }
.kj-bg-castle   { background: linear-gradient(180deg, #3a2a73 0%, #1c0e49 100%); }
.kj-bg-rescue   { background: linear-gradient(180deg, #9d7acc 0%, #412768 100%); }
.kj-bg-neutral  { background: linear-gradient(180deg, #3a2a73 0%, #1c0e49 100%); }
.kj-bg-forest_clearing { background: linear-gradient(180deg, #3f6140 0%, #1e3a23 100%); }
/* Sepia-tone flashback (Desert Zephyra dream sequence) */
.kj-bg-flashback { background: linear-gradient(180deg, #c9a57a 0%, #6b4a2a 100%); filter: sepia(0.4); }
.kj-bg-volcano   { background: linear-gradient(180deg, #5a1a1a 0%, #1a0808 100%); }

/* Mornox dialogue frame — gold/purple flame border. Apply by adding the
   class to the scene wrap in any scene that should signal Mornox's presence. */
.kj-frame-mornox {
  box-shadow: inset 0 0 32px 4px rgba(212, 122, 255, 0.35),
              inset 0 0 80px 8px rgba(255, 200, 64, 0.20);
  border: 2px solid #d47aff;
  position: relative;
}
.kj-frame-mornox::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(45deg,
    rgba(212, 122, 255, 0.06) 0 8px, transparent 8px 16px);
}

/* Ending scene */
.kj-ending-wrap { padding: 40px 24px; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.kj-ending-stage { width: 100%; max-width: 600px; text-align: center; }
.kj-ending-crown { font-size: 80px; animation: kj-wobble 2s ease-in-out infinite; margin-bottom: 12px; }
.kj-ending-video,
.kj-dialogue-video {
  display: block;
  margin: 0 auto 12px;
  max-width: 320px;
  max-height: 55vh;       /* never eat more than ~55% of the viewport — leaves room for speaker/text/Next on small phones */
  width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(255, 200, 64, 0.35);
  background: #0d0820;
  object-fit: contain;
}
.kj-ending-speaker { font-size: 16px; color: #ffd34d; min-height: 1em; }
.kj-ending-text { font-size: 22px; color: #fff; min-height: 2em; padding: 14px; line-height: 1.5; text-shadow: 1px 1px 4px rgba(0,0,0,0.8); }
.kj-ending-summary { margin-top: 24px; }
.kj-ending-final { background: rgba(0,0,0,0.5); border: 2px solid gold; border-radius: 14px; padding: 20px; }
.kj-ending-headline { font-size: 28px; color: gold; margin-bottom: 16px; }
.kj-ending-section { margin: 12px 0; }
.kj-ending-section-title { font-size: 16px; color: #ffd34d; margin-bottom: 8px; }
.kj-ending-badges, .kj-ending-trophies { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.kj-trophy-chip { background: #2d1b69; color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 14px; }

/* Title screen */
.kj-title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 40px 20px;
  background: #1c0e49;
}
.kj-title-screen.kj-title-has-image {
  padding: 0;
  justify-content: flex-start;
  background: #0d0820;
}
.kj-title-poster {
  width: 100%;
  display: block;
  max-width: 600px;
  margin: 0 auto;
}
.kj-title-overlay {
  width: 100%;
  max-width: 600px;
  padding: 20px 24px 48px;
  background: #0d0820;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.kj-title-screen h1 {
  font-size: 46px;
  color: gold;
  letter-spacing: 2px;
  text-shadow: 3px 3px 8px rgba(0,0,0,0.7);
}
.kj-title-crown {
  font-size: 110px;
  animation: kj-wobble 2s ease-in-out infinite;
}
.kj-subtitle {
  color: #ddd;
  font-size: 18px;
  margin: 4px 0 12px;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.9);
}

/* Title screen — profile picker */
.kj-profile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 8px;
}
.kj-profile-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 14px 44px 14px 18px;
  background: #2d1b69;
  color: #fff;
  border: 2px solid #5a3aa8;
  border-radius: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.05s, background 0.1s;
}
.kj-profile-btn:active { transform: scale(0.98); background: #3d2a85; }
.kj-profile-name { font-size: 22px; font-weight: bold; color: gold; }
.kj-profile-meta { font-size: 14px; color: #ccc; }
.kj-profile-delete {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #aaa;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
}
.kj-profile-delete:hover { color: #ff7a7a; background: rgba(0,0,0,0.5); }

.kj-new-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.kj-new-player-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: #1c0e49;
  border: 2px dashed #ffd34d;
  border-radius: 14px;
  margin-bottom: 12px;
}
.kj-new-player-label {
  font-size: 18px;
  color: #ffd34d;
  font-weight: bold;
}
.kj-name-input {
  width: 100%;
  max-width: 320px;
  padding: 12px 16px;
  font-size: 20px;
  font-family: inherit;
  text-align: center;
  border: 2px solid #5a3aa8;
  border-radius: 10px;
  background: #1c0e49;
  color: gold;
  outline: none;
}
.kj-name-input:focus { border-color: gold; }
.kj-name-error {
  color: #ff8a8a;
  font-size: 14px;
  margin: 0;
  min-height: 1em;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Map screen */
.kj-map-bg { background: linear-gradient(180deg, #3a2a73 0%, #1c0e49 100%); }
.kj-map-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 6px;
}
.kj-region-card {
  background: rgba(255,255,255,0.1);
  border: 2px solid gold;
  border-radius: 14px;
  padding: 16px 8px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  position: relative;
  transition: transform 0.12s;
}
.kj-region-card.locked { opacity: 0.6; filter: grayscale(0.5); }
.kj-region-card:active { transform: scale(0.95); }
.kj-region-emoji { font-size: 40px; }
.kj-region-name  { font-size: 15px; font-weight: bold; margin-top: 4px; }
.kj-region-badge { position: absolute; top: 6px; right: 8px; font-size: 18px; }
.kj-region-hint  { font-size: 12px; margin-top: 6px; color: #ffe; opacity: 0.85; line-height: 1.3; }
