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

html, body {
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #05060a;
  color: #f4ead2;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  touch-action: none;
  -webkit-touch-callout: none;
}

.safe-area-probe {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  pointer-events: none;
  visibility: hidden;
}

#mu-webgl-canvas {
  position: fixed;
  top: var(--app-top, 0px);
  left: var(--app-left, 0px);
  width: var(--app-vw, 100%);
  height: var(--app-vh, 100%);
  display: block;
  background: #05060a;
  outline: none;
  touch-action: none;
  z-index: 1;
}

/* Full-Screen Epic Dark-Fantasy Landing & Loading Overlay */
.landing-overlay {
  position: fixed;
  top: var(--app-top, 0px);
  left: var(--app-left, 0px);
  width: var(--app-vw, 100%);
  height: var(--app-vh, 100%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    url('./assets/loading-bg.jpg?v=pc-native-3') center center / cover no-repeat,
    #06070c;
  transition: opacity 0.4s ease;
}

.landing-overlay.hidden-game-active {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.landing-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 48%, rgba(4, 5, 9, 0.52) 100%),
    linear-gradient(180deg, rgba(5, 6, 10, 0.35) 0%, transparent 18%, transparent 72%, rgba(5, 6, 10, 0.86) 100%);
}

.top-bar {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: center;
}

.device-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #fce5ae;
  background: rgba(12, 13, 20, 0.68);
  border: 1px solid rgba(232, 184, 88, 0.42);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Bottom Dock: Anchored directly over the dark mist between the flaming braziers */
.bottom-dock {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: clamp(4px, 2.2vh, 22px);
}

.play-action-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.hero-brand-main {
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 900;
  letter-spacing: 4px;
  color: #ffeaad;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.95),
    0 0 24px rgba(242, 174, 52, 0.65);
}

.hero-brand-sub {
  font-size: clamp(12px, 1.3vw, 14px);
  font-weight: 600;
  letter-spacing: 1px;
  color: #e6d5b2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
}

.btn-play-now {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: min(320px, 82vw);
  padding: 14px 40px;
  border-radius: 6px;
  border: 1.5px solid #ffe7a3;
  background: linear-gradient(180deg, #ffe294 0%, #e09f2e 45%, #a8640e 88%, #7a4205 100%);
  color: #1c1002;
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow:
    0 0 0 3px rgba(24, 16, 8, 0.88),
    0 0 0 4.5px rgba(219, 165, 68, 0.65),
    0 10px 30px rgba(0, 0, 0, 0.8),
    0 0 28px rgba(244, 174, 48, 0.55),
    inset 0 1px 0 rgba(255, 252, 232, 0.85);
  transition: transform 0.14s ease, filter 0.14s ease, box-shadow 0.14s ease;
}

.btn-play-now:hover {
  transform: translateY(-2px);
  filter: brightness(1.09);
  box-shadow:
    0 0 0 3px rgba(24, 16, 8, 0.9),
    0 0 0 4.5px rgba(255, 212, 114, 0.88),
    0 14px 36px rgba(0, 0, 0, 0.85),
    0 0 38px rgba(255, 192, 68, 0.78),
    inset 0 1px 0 rgba(255, 255, 240, 0.95);
}

.btn-play-now:active {
  transform: translateY(0);
}

.btn-diamond {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff6d2 0%, #ffb42c 60%, #7c3804 100%);
  border: 1px solid #3c2104;
  box-shadow: 0 0 8px rgba(255, 210, 96, 0.85);
}

.play-icon {
  font-size: 16px;
}

/* Ornate Sculpted Golden Progress Bar (Image 3 Style) */
.loading-box {
  width: min(84vw, 860px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

.loading-meta {
  width: calc(100% - 64px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.loading-stage {
  font-size: clamp(12.5px, 1.4vw, 15px);
  font-weight: 700;
  color: #fce6b0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loading-pct {
  font-size: clamp(13px, 1.5vw, 16px);
  font-weight: 900;
  color: #ffd670;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.95),
    0 0 12px rgba(255, 186, 52, 0.7);
  font-variant-numeric: tabular-nums;
}

.ornate-bar-wrap {
  position: relative;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.9));
}

.ornate-cap {
  width: 46px;
  height: 40px;
  flex: 0 0 46px;
  z-index: 3;
}

.ornate-cap-left {
  margin-right: -10px;
}

.ornate-cap-right {
  margin-left: -10px;
}

.loading-bar-track {
  position: relative;
  flex: 1 1 auto;
  height: 20px;
  padding: 3px 0;
  background: linear-gradient(180deg, #1b130a 0%, #0d0906 55%, #1d150c 100%);
  border-top: 2px solid #e7b85c;
  border-bottom: 2px solid #7d5218;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.95),
    0 0 0 1.5px rgba(42, 26, 8, 0.95),
    0 0 18px rgba(242, 168, 44, 0.25);
  overflow: hidden;
  z-index: 2;
}

.loading-bar-fill {
  position: relative;
  height: 100%;
  min-width: 0;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    #8c4a08 0%,
    #cf7e14 25%,
    #f6b93b 62%,
    #ffdf78 88%,
    #fff7cf 100%
  );
  box-shadow:
    0 0 14px rgba(255, 184, 52, 0.9),
    inset 0 1px 0 rgba(255, 250, 224, 0.85),
    inset 0 -2px 3px rgba(130, 58, 4, 0.65);
  transition: width 0.16s ease-out;
}

.loading-bar-ember {
  position: absolute;
  top: -3px;
  right: -4px;
  width: 14px;
  height: calc(100% + 6px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 252, 224, 0.95) 0%, rgba(255, 196, 68, 0.7) 48%, transparent 75%);
  pointer-events: none;
}

.loading-detail {
  font-size: clamp(11.5px, 1.2vw, 13px);
  color: #cfc5b0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  text-align: center;
  max-width: 92%;
}

@media (max-width: 680px) {
  .loading-box {
    width: 96vw;
  }
  .loading-meta {
    width: calc(100% - 48px);
  }
  .ornate-bar-wrap {
    height: 32px;
  }
  .ornate-cap {
    width: 48px;
    height: 32px;
    flex-basis: 48px;
  }
  .loading-bar-track {
    height: 16px;
  }
}

/* Subtle Fullscreen Trigger on Mobile Android Chrome (auto-hides once fullscreen/standalone) */
.mobile-fs-btn {
  position: fixed;
  top: calc(var(--app-top, 0px) + max(6px, env(safe-area-inset-top)));
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 184, 88, 0.55);
  background: rgba(12, 13, 20, 0.78);
  color: #fce5ae;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  cursor: pointer;
}

/* Real iOS/Android Native System Keyboard Proxy (must stay focusable on iOS Safari — no pointer-events:none when active!) */
.mobile-ime-proxy {
  position: fixed;
  top: calc(var(--app-top, 0px) + 2px);
  left: -2000px;
  width: 120px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  opacity: 0.01;
  font-size: 16px; /* >=16px prevents iOS Safari auto-zoom on focus! */
  user-select: text;
  -webkit-user-select: text;
  z-index: 2;
}

.mobile-ime-proxy.ime-active {
  left: calc(var(--app-left, 0px) + 4px);
}

/* Realistic iOS/Android Landscape Virtual Keyboard (PC ?ui=mobile preview simulator ONLY) */
.sim-soft-kbd {
  position: fixed;
  left: var(--app-left, 0px);
  bottom: 0;
  width: var(--app-vw, 100%);
  height: 45%;
  min-height: 158px;
  max-height: 215px;
  z-index: 60;
  padding: 6px 10px 8px;
  background: rgba(24, 25, 30, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  animation: simKbdSlideUp 0.16s ease-out;
}

@keyframes simKbdSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sim-kbd-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex: 1 1 0;
}

.sim-kbd-key {
  flex: 1 1 0;
  max-width: 72px;
  border: 0;
  border-radius: 6px;
  background: #3d3f47;
  color: #f6f7fa;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.06s ease, transform 0.05s ease;
}

.sim-kbd-key:active {
  background: #5b5e69;
  transform: scale(0.96);
}

.sim-kbd-key.fn {
  flex: 1.45 1 0;
  max-width: 108px;
  background: #2b2d34;
  color: #dfe2ea;
  font-size: 13px;
}

.sim-kbd-key.fn.active {
  background: #e5e8f0;
  color: #16181f;
}

.sim-kbd-key.space {
  flex: 4.5 1 0;
  max-width: 340px;
}

.sim-kbd-key.action {
  flex: 2 1 0;
  max-width: 140px;
  background: linear-gradient(180deg, #3584f6 0%, #1d63cc 100%);
  color: #ffffff;
  font-weight: 700;
}

/* Smooth Scene Transition Overlay (replaces blank black frame wait) */
.scene-transition-overlay {
  position: fixed;
  top: var(--app-top, 0px);
  left: var(--app-left, 0px);
  width: var(--app-vw, 100%);
  height: var(--app-vh, 100%);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(16, 17, 24, 0.88) 0%, rgba(5, 6, 10, 0.96) 100%);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.14s ease;
}

.scene-transition-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  border-radius: 12px;
  background: rgba(12, 13, 20, 0.85);
  border: 1px solid rgba(232, 184, 88, 0.45);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.78);
}

.scene-transition-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(232, 184, 88, 0.22);
  border-top-color: #ffd87a;
  animation: muSpin 0.75s linear infinite;
}

@keyframes muSpin {
  to { transform: rotate(360deg); }
}

.scene-transition-text {
  font-size: 13.5px;
  font-weight: 700;
  color: #fce5ae;
  letter-spacing: 0.3px;
}

/* Full-Screen Portrait Orientation Blocker on Mobile (Enforces APK/iOS Landscape-Only) */
.rotate-blocker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(28, 22, 14, 0.96) 0%, rgba(5, 6, 10, 0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rotate-card {
  width: min(92vw, 360px);
  padding: 28px 22px;
  border-radius: 14px;
  border: 1.5px solid rgba(232, 184, 88, 0.65);
  background: rgba(14, 15, 22, 0.92);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.85), 0 0 28px rgba(232, 184, 88, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.rotate-phone-icon {
  animation: rotatePhoneHint 2.2s ease-in-out infinite;
}

@keyframes rotatePhoneHint {
  0%, 15%   { transform: rotate(0deg); }
  50%, 75%  { transform: rotate(-90deg); }
  100%      { transform: rotate(0deg); }
}

.rotate-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #ffdf8c;
}

.rotate-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: #ddd2bc;
}

.btn-force-landscape {
  margin-top: 6px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid #ffe49c;
  background: linear-gradient(180deg, #f8cc68 0%, #c4801a 100%);
  color: #1c1002;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(244, 174, 48, 0.35);
}

/* One-time dismissible iOS Safari Home-Screen Fullscreen tip */
.ios-pwa-tip {
  position: fixed;
  top: calc(var(--app-top, 0px) + env(safe-area-inset-top, 0px) + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 92vw;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(232, 184, 88, 0.55);
  background: rgba(12, 13, 20, 0.88);
  color: #f6e4b8;
  font-size: 11.5px;
  line-height: 1.3;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ios-pwa-tip-text strong {
  color: #ffd87a;
}

.ios-pwa-tip-close {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff2cc;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
