/* Blade of Elysia — celestial / heavenly fantasy theme.
   Palette drawn from the logo: sky blue, white clouds, silver filigree. */
:root {
  --sky-light: #d7ecff;
  --sky: #4aa6ff;
  --sky-deep: #1773e6;
  --abyss: #06223f;          /* deep blue for contrast */
  --silver: #f3f9ff;
  --silver-dim: #cfe2f7;
  --glow: #9fd2ff;
  --text: #eef6ff;
  --muted: #a9c4e0;
  --danger: #ff8aa0;
  --ok: #8ff0d2;
  --serif: "Cinzel", "Times New Roman", serif;
  --body: "Cormorant Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #04101f;
  color: var(--text);
  font-family: var(--body);
  overflow: hidden;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

#app { position: fixed; inset: 0; }

/* ---- Cinematic video background + filter stack ---- */
.bg-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* tasteful cinematic grade so the celestial scene reads behind the UI */
  filter: saturate(1.12) contrast(1.04) brightness(0.9) blur(1px);
  transform: scale(1.04); /* hide blur edge bleed */
  z-index: 0;
}
.bg-filter {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8,34,63,0.30) 0%, rgba(6,24,48,0.20) 38%, rgba(4,16,32,0.74) 100%),
    radial-gradient(120% 90% at 50% 22%, rgba(74,166,255,0.18) 0%, rgba(6,24,48,0) 55%);
}
.bg-vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 240px 60px rgba(2,12,26,0.85);
}
.music-toggle {
  position: fixed; top: 14px; right: 14px; z-index: 60;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: rgba(13,40,72,0.55); border: 1px solid rgba(207,226,247,0.4);
  color: var(--silver); font-size: 16px; backdrop-filter: blur(6px);
}
.music-toggle:hover { background: rgba(159,210,255,0.2); }
.music-toggle.off { opacity: 0.5; }

/* ---- Unity canvas host ---- */
#gameContainer {
  position: absolute; inset: 0; display: none; background: #000; z-index: 6;
}
#gameContainer canvas { width: 100% !important; height: 100% !important; display: block; }
body.playing #gameContainer { display: block; }
body.playing #landing { display: none; }

/* ---- Landing ---- */
#landing {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 24px; text-align: center;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logo-wrap { position: relative; }
.logo {
  width: clamp(190px, 30vw, 280px);
  height: auto; display: block;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px rgba(243,249,255,0.55),
    0 0 0 6px rgba(159,210,255,0.18),
    0 12px 60px rgba(74,166,255,0.45),
    0 0 80px rgba(159,210,255,0.35);
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translateY(-4px);} 50% { transform: translateY(6px);} }

.brand .tag {
  font-family: var(--body);
  font-size: clamp(16px, 2.4vw, 21px);
  font-style: italic;
  letter-spacing: 0.5px;
  color: var(--sky-light);
  text-shadow: 0 1px 14px rgba(74,166,255,0.6);
}
.brand .token {
  margin-top: 2px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--silver);
  border: 1px solid rgba(207,226,247,0.5);
  border-radius: 999px;
  padding: 4px 16px;
  background: rgba(23,115,230,0.18);
  box-shadow: 0 0 18px rgba(74,166,255,0.35), inset 0 0 12px rgba(255,255,255,0.08);
}
.brand .online {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--silver-dim);
}
.brand .online .odot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #8ff0d2; box-shadow: 0 0 10px #8ff0d2;
  animation: boe-pulse 2s ease-in-out infinite;
}
@keyframes boe-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- Forge Your Hero (character customizer) ---- */
.forge-toggle { font-size: 13px; }
.forge {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; margin: -2px 0 2px;
  background: rgba(2,12,26,0.4);
  border: 1px solid rgba(207,226,247,0.22); border-radius: 10px;
}
.hero-name {
  width: 100%; box-sizing: border-box;
  background: rgba(2,12,26,0.55); border: 1px solid rgba(207,226,247,0.3);
  border-radius: 8px; color: var(--silver); font-family: var(--serif);
  font-size: 14px; letter-spacing: 1px; text-align: center; padding: 9px 10px; outline: none;
}
.hero-name:focus { border-color: var(--sky); }
.forge-rows { display: flex; flex-direction: column; gap: 7px; }
.frow { display: flex; align-items: center; gap: 8px; }
.frow .flbl {
  flex: 0 0 78px; font-family: var(--serif); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
}
.frow .fval {
  flex: 1; text-align: center; font-family: var(--serif); font-size: 13px;
  color: var(--silver); display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 22px;
}
.frow .fbtn {
  flex: 0 0 30px; height: 30px; cursor: pointer;
  background: rgba(159,210,255,0.08); border: 1px solid rgba(207,226,247,0.3);
  border-radius: 8px; color: var(--silver); font-size: 15px; line-height: 1;
}
.frow .fbtn:hover { background: rgba(159,210,255,0.2); border-color: rgba(255,255,255,0.7); }
.frow .swatch {
  width: 30px; height: 16px; border-radius: 4px; display: inline-block;
  border: 1px solid rgba(255,255,255,0.55); box-shadow: 0 0 8px rgba(74,166,255,0.4);
}

/* ---- Ornate framed panel ---- */
.panel {
  position: relative;
  width: min(440px, 92vw);
  padding: 26px 24px;
  display: flex; flex-direction: column; gap: 14px;
  background: linear-gradient(180deg, rgba(13,40,72,0.62), rgba(6,22,44,0.72));
  border: 1px solid rgba(207,226,247,0.45);
  border-radius: 16px;
  backdrop-filter: blur(9px) saturate(1.1);
  box-shadow:
    0 0 0 1px rgba(74,166,255,0.18),
    0 24px 70px rgba(2,12,26,0.6),
    inset 0 0 22px rgba(159,210,255,0.10),
    inset 0 1px 0 rgba(255,255,255,0.18);
}
/* inner hairline frame, like the logo's filigree border */
.panel::before {
  content: ""; position: absolute; inset: 7px; border-radius: 11px;
  border: 1px solid rgba(207,226,247,0.22); pointer-events: none;
}
.panel .corner {
  position: absolute; color: var(--silver); font-size: 13px; opacity: 0.85;
  text-shadow: 0 0 10px rgba(159,210,255,0.9); pointer-events: none;
}
.panel .corner.tl { top: 6px; left: 9px; }
.panel .corner.tr { top: 6px; right: 9px; }
.panel .corner.bl { bottom: 6px; left: 9px; }
.panel .corner.br { bottom: 6px; right: 9px; }

button.cta, button.ghost {
  appearance: none; cursor: pointer;
  font-family: var(--serif);
  font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  border-radius: 11px; padding: 14px 18px; font-size: 15px;
  transition: transform 0.08s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
button.cta {
  border: 1px solid rgba(255,255,255,0.7);
  color: #07223f;
  background: linear-gradient(180deg, #ffffff 0%, #dcecff 48%, #a9d2ff 100%);
  box-shadow: 0 0 22px rgba(120,190,255,0.55), inset 0 1px 0 rgba(255,255,255,0.9);
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
button.cta:hover { filter: brightness(1.06); box-shadow: 0 0 32px rgba(150,205,255,0.8), inset 0 1px 0 rgba(255,255,255,0.9); }
button.cta:active { transform: translateY(1px); }
button.cta[disabled] { opacity: 0.6; cursor: progress; }

button.ghost {
  color: var(--silver);
  background: rgba(159,210,255,0.06);
  border: 1px solid rgba(207,226,247,0.4);
  box-shadow: inset 0 0 16px rgba(159,210,255,0.08);
}
button.ghost:hover { background: rgba(159,210,255,0.14); border-color: rgba(207,226,247,0.7); }

.wallet-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--serif); font-size: 12px; letter-spacing: 1px; color: var(--muted);
  background: rgba(2,12,26,0.4); border: 1px solid rgba(207,226,247,0.18);
  border-radius: 10px; padding: 10px 12px;
}
.wallet-row .addr { color: var(--ok); font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0; }

.status { min-height: 18px; font-size: 16px; color: var(--muted); font-style: italic; }
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

/* ---- Links ---- */
.links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.link-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-size: 13px; font-weight: 600; letter-spacing: 1.5px;
  text-decoration: none; color: var(--silver);
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid rgba(207,226,247,0.4);
  background: rgba(13,40,72,0.45);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 16px rgba(74,166,255,0.2);
  transition: transform 0.1s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.link-pill:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.8); box-shadow: 0 0 26px rgba(120,190,255,0.5); }
.link-pill .ico { font-size: 14px; opacity: 0.95; }
.link-pill.buy {
  color: #07223f;
  background: linear-gradient(180deg, #ffffff, #bfe0ff);
  border-color: rgba(255,255,255,0.8);
}
.link-pill.buy .buy-token { letter-spacing: 1px; }

/* ---- Loading overlay ---- */
#loading {
  position: absolute; inset: 0; z-index: 7; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(80% 60% at 50% 45%, rgba(10,40,75,0.6), rgba(3,12,26,0.96));
}
body.loading #loading { display: flex; }
#loading .label { font-family: var(--serif); font-size: 20px; letter-spacing: 4px; color: var(--silver); text-shadow: 0 0 18px rgba(159,210,255,0.8); }
#loading .bar { width: min(360px, 80vw); height: 5px; border-radius: 999px; background: rgba(207,226,247,0.16); overflow: hidden; border: 1px solid rgba(207,226,247,0.2); }
#loading .bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, #ffffff, var(--sky)); box-shadow: 0 0 12px var(--glow); transition: width 0.2s ease; }

/* ---- Mobile touch controls (shown only while playing on a touch device) ---- */
#touchControls { position: absolute; inset: 0; z-index: 8; display: none; pointer-events: none; }
body.playing.touch #touchControls { display: block; }

/* left half is the floating-joystick zone */
.joy-zone {
  position: absolute; left: 0; bottom: 0; width: 55%; height: 70%;
  pointer-events: auto; touch-action: none;
}
.joy-base {
  position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px;
  border-radius: 50%; left: -999px; top: -999px;
  border: 1.5px solid rgba(207,226,247,0.5);
  background: radial-gradient(circle at 50% 40%, rgba(159,210,255,0.16), rgba(13,40,72,0.30));
  box-shadow: 0 0 22px rgba(74,166,255,0.35), inset 0 0 18px rgba(159,210,255,0.12);
  opacity: 0; transition: opacity 0.12s ease; pointer-events: none;
}
.joy-base.on { opacity: 1; }
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #ffffff, #bfe0ff 60%, #79b4ff);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 0 18px rgba(120,190,255,0.7);
}
.act-cluster {
  position: absolute; right: 24px; bottom: 30px;
  display: flex; align-items: flex-end; gap: 16px; pointer-events: none;
}
.act-btn {
  pointer-events: auto; touch-action: none; cursor: pointer;
  width: 74px; height: 74px; border-radius: 50%;
  font-size: 30px; line-height: 1; color: #07223f;
  border: 1.5px solid rgba(255,255,255,0.8);
  background: radial-gradient(circle at 50% 38%, #ffffff, #cfe6ff 62%, #a9d2ff);
  box-shadow: 0 6px 18px rgba(2,12,26,0.5), 0 0 22px rgba(120,190,255,0.5), inset 0 1px 0 rgba(255,255,255,0.9);
  display: flex; align-items: center; justify-content: center;
  -webkit-user-select: none; user-select: none;
}
.act-btn.jump { width: 62px; height: 62px; font-size: 26px; }
.act-btn.pressed { transform: scale(0.92); filter: brightness(1.1); }

/* Fullscreen toggle (mobile) */
.fs-btn {
  position: absolute; top: 14px; right: 14px; z-index: 9; display: none;
  pointer-events: auto; cursor: pointer;
  width: 42px; height: 42px; border-radius: 11px; font-size: 18px; color: var(--silver);
  background: rgba(13,40,72,0.5); border: 1px solid rgba(207,226,247,0.4);
  backdrop-filter: blur(6px);
}
body.touch.playing .fs-btn { display: block; }

/* ---- Rotate-to-landscape guard ---- */
#rotate {
  position: fixed; inset: 0; z-index: 50; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(70% 60% at 50% 45%, rgba(10,40,75,0.7), rgba(3,12,26,0.98));
  text-align: center; padding: 24px; color: var(--silver); font-family: var(--serif); letter-spacing: 2px;
}
#rotate .icon { font-size: 46px; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%,100% { transform: rotate(-12deg);} 50% { transform: rotate(78deg);} }
@media (max-width: 920px) and (orientation: portrait) {
  body.playing #rotate { display: flex; }
}
