/* Crisp EBB-inspired cel-shaded storybook HUD & Title Overlay */
:root {
  --ink: #251e38;
  --cream: #fffaf0;
  --sun: #ffd866;
  --coral: #ff7b54;
  --cyan: #6ef3ff;
  --font: 'Wick Round', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

* { box-sizing: border-box; user-select: none; -webkit-user-select: none; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #66c7de;
  font-family: var(--font);
  color: var(--ink);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

#ui-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

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

/* Shared EBB-style bold-outlined storybook pills */
.pill {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--cream);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.pill-btn, .pill-icon-btn, .pill-primary {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
}

.pill-btn:hover, .pill-icon-btn:hover, .pill-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--ink);
}

.pill-btn:active, .pill-icon-btn:active, .pill-primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--ink);
}

.pill-primary {
  background: linear-gradient(180deg, #ffe27a 0%, #ffbe47 100%);
  padding: 13px 30px;
  font-size: 18px;
}

/* Top HUD layout */
.hud-top-left {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.pill-zone {
  padding: 6px 14px 6px 6px;
  gap: 10px;
}

.pill-badge {
  background: var(--sun);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
}

.pill-title { font-size: 15px; }

.hud-stats-row {
  display: flex;
  gap: 8px;
}

.pill-stat {
  padding: 5px 12px;
  font-size: 14px;
}

.pill-rank {
  padding: 5px 12px;
  background: #ffe8a3;
  font-size: 13px;
}

.hud-top-center {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pill-compass {
  background: rgba(255, 250, 240, 0.94);
  font-size: 13.5px;
  max-width: 52vw;
  white-space: nowrap;
}

.compass-arrow {
  display: inline-block;
  font-size: 16px;
  color: #e66039;
  transition: transform 0.08s linear;
}

.compass-dist {
  background: #e6f6ff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
}

.pill-warp {
  background: #9ef5ff;
  font-size: 13px;
  padding: 5px 14px;
}

.hud-top-right {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.pill-icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
  font-size: 17px;
}

/* Seamless Zone Awakening Banner */
.zone-banner {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translate(-50%, -14px);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.zone-banner.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.banner-kicker {
  display: inline-block;
  background: var(--sun);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--ink);
  margin-bottom: 6px;
}

.banner-title {
  font-size: 36px;
  font-weight: 800;
  color: #fffef5;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 0 4px 0 var(--ink);
  letter-spacing: 1px;
}

/* Toast notification */
.hud-toast {
  position: fixed;
  bottom: 132px;
  left: 50%;
  transform: translate(-50%, 8px);
  opacity: 0;
  background: var(--ink);
  color: #fff9e6;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2.5px solid #ffd866;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(24, 18, 42, 0.32);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.hud-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Bottom Skill Bar (EBB-inspired rounded pill cards!) */
.hud-bottom {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(96vw, 760px);
}

.hint-pill {
  background: rgba(255, 250, 240, 0.94);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 0 var(--ink);
  text-align: center;
}

.skill-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.skill-card {
  pointer-events: auto;
  cursor: pointer;
  background: var(--cream);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--ink);
  padding: 8px 10px 7px;
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.15s ease;
}

.skill-card:hover {
  transform: translateY(-2px);
}

.skill-card.active {
  background: linear-gradient(180deg, #fff2b2 0%, #ffd56b 100%);
  transform: translateY(-6px);
  box-shadow: 0 7px 0 var(--ink), 0 0 18px rgba(255, 210, 80, 0.65);
}

.skill-top {
  display: flex;
  align-items: center;
  gap: 5px;
}

.skill-icon { font-size: 16px; }
.skill-name { font-size: 14px; font-weight: 800; white-space: nowrap; }
.skill-key { font-size: 11px; opacity: 0.78; font-weight: 700; white-space: nowrap; }

.skill-meter {
  width: 100%;
  height: 6px;
  background: rgba(37, 30, 56, 0.14);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.skill-meter-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.08s linear;
}

/* Title Screen Overlay over Live 3D World */
.title-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(255, 248, 224, 0.14), rgba(28, 36, 62, 0.42));
  pointer-events: auto;
  padding: 20px;
}

.title-screen[hidden] { display: none; }

.title-card {
  max-width: 660px;
  width: 100%;
  text-align: center;
  background: rgba(255, 250, 240, 0.92);
  border: 4px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 10px 0 var(--ink), 0 22px 48px rgba(22, 24, 48, 0.35);
  padding: 30px 28px 26px;
}

.title-kicker {
  display: inline-block;
  background: #9ef5ff;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.title-logo {
  margin: 0 0 10px;
  font-size: clamp(36px, 6vw, 54px);
  line-height: 1.1;
  color: #ffb838;
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 0 5px 0 var(--ink);
  letter-spacing: 2px;
}

.title-sub {
  margin: 0 auto 22px;
  max-width: 500px;
  font-size: 15.5px;
  line-height: 1.55;
  color: #3f365c;
  font-weight: 600;
}

.title-actions {
  margin-bottom: 20px;
}

.title-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
}

.title-keys span {
  background: #fff3d6;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 11px;
  font-weight: 700;
}

/* Help Modal */
.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(22, 20, 40, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  padding: 20px;
}
.help-modal[hidden] { display: none; }

.help-card {
  max-width: 580px;
  width: 100%;
  background: var(--cream);
  border: 4px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 8px 0 var(--ink);
  padding: 24px 26px;
}

.help-card h2 { margin: 0 0 12px; font-size: 22px; }
.help-card ul {
  margin: 0 0 18px;
  padding-left: 20px;
  line-height: 1.7;
  font-size: 14px;
}
.help-card li { margin-bottom: 6px; }

/* Touch joystick */
.touch-pad {
  position: fixed;
  left: 20px;
  bottom: 118px;
  pointer-events: auto;
}
.touch-stick-base {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.55);
  border: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.touch-stick-knob {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sun);
  border: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

@media (max-width: 720px) {
  .hud-top-center { top: 102px; }
  .skill-bar { gap: 6px; }
  .skill-card { padding: 6px 4px; border-radius: 12px; }
  .skill-name { font-size: 12px; }
  .skill-key { font-size: 9.5px; }
  .hint-pill { font-size: 11.5px; padding: 4px 12px; }
}
