/* =============================================================
   portal.css — Avalon Heroes Play Portal
   Standalone — does NOT depend on style.css
   ============================================================= */

:root {
  --sky1: #2f7dff;
  --sky2: #246ae9;
  --sky3: #184fbf;
  --sky4: #0c2f7a;
  --accent: #4ff6ff;
  --accent2: #2a7bff;
  --text: #f6fbff;
  --muted: rgba(246,251,255,.78);
  --panel: rgba(255,255,255,.13);
  --line: rgba(255,255,255,.22);
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
}

html {
  background:
    radial-gradient(1100px 700px at 50% -220px, rgba(255,255,255,.35), transparent 70%),
    radial-gradient(900px 600px at 18% 12%, rgba(79,246,255,.22), transparent 72%),
    linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 36%, var(--sky3) 70%, var(--sky4) 100%);
  background-attachment: fixed;
}

/* ── Main Nav ── */
.main-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  clip-path: inset(0 0 -30px 0);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 8px 16px 8px 60px;
  background: linear-gradient(90deg, rgba(108,63,199,0.82), rgba(42,123,255,0.82));
  border-bottom: 1px solid rgba(255,255,255,.15);
  transition: background .25s ease, box-shadow .25s ease;
}

/* backdrop-filter on pseudo-element — prevents nav from trapping fixed children */
.main-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: -1;
  pointer-events: none;
}

.main-nav.scrolled {
  background: linear-gradient(90deg, rgba(85,42,170,0.97), rgba(28,90,210,0.97));
  box-shadow: 0 4px 32px rgba(80,30,180,.35);
}
.main-nav a {
  padding: 7px 13px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: rgba(246,251,255,.95);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .12s ease, background .12s ease;
}
.main-nav a:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.16);
  text-decoration: none;
}
.nav-logo {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  border: none !important;
  background: none !important;
  padding: 0 !important;
}
.nav-logo:hover {
  background: none !important;
  transform: translateY(calc(-50% - 1px)) !important;
}
.nav-logo img { height: 36px; width: auto; display: block; }

/* ── Language switcher in nav ── */
.nav-lang {
  position: fixed;
  right: 16px;
  top: 9px;
  z-index: 10000;
  display: flex;
  align-items: center;
  background: rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  overflow: hidden;
}
.nav-lang-btn {
  background: none;
  border: none;
  color: rgba(246,251,255,.55);
  font-size: .65rem;
  font-weight: 700;
  padding: 5px 9px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .3px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.nav-lang-btn.active {
  background: rgba(79,246,255,.22);
  color: var(--accent);
}
.nav-lang-btn:not(.active):hover {
  background: rgba(255,255,255,.10);
  color: #fff;
}


/* ── CODE GATE ── */
#gate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 24px 32px;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: none;
  background:
    linear-gradient(180deg, rgba(8,18,60,.50) 0%, rgba(8,18,60,.78) 100%),
    url('../assets/NewBanner.png') center / cover no-repeat fixed;
}
#gate::-webkit-scrollbar { display: none; }

.gate-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  margin: auto;
}

.gate-logo-img {
  width: min(260px, 80%);
  height: auto;
  margin: 0 auto 22px;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,.45));
}

.mvp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,180,40,.12);
  border: 1px solid rgba(255,180,40,.35);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: .75rem;
  color: #ffd56a;
  font-weight: 600;
  margin-bottom: 22px;
  letter-spacing: .3px;
}
.mvp-badge svg { flex-shrink: 0; }

.gate-label {
  font-size: .75rem;
  color: rgba(246,251,255,.90);
  text-align: left;
  margin-bottom: 7px;
  letter-spacing: .4px;
  text-transform: uppercase;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}

.gate-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

#codeInput {
  flex: 1;
  background: rgba(8,18,58,.65);
  border: 1.5px solid rgba(255,255,255,.25);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  letter-spacing: 3px;
  font-family: 'Courier New', monospace;
  outline: none;
  transition: border-color .2s, background .2s;
}
#codeInput:focus { border-color: var(--accent); background: rgba(255,255,255,.12); }
#codeInput.error { border-color: #ff6b6b; animation: shake .3s; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

.btn-enter {
  background: linear-gradient(180deg, #73f7ff 0%, #2aa7ff 55%, #1f76ff 100%);
  color: #042436;
  border: none;
  border-radius: 12px;
  font-size: .95rem;
  font-weight: 800;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,.18);
  transition: filter .15s, transform .1s, box-shadow .1s;
  white-space: nowrap;
}
.btn-enter:hover  { filter: brightness(1.08); transform: translateY(-1px); }
.btn-enter:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }

#codeError {
  font-size: .80rem;
  color: #ff9090;
  min-height: 1.2em;
  text-align: left;
  margin-bottom: 14px;
}

/* ── PLAY NOW IMAGE ── */
.btn-play-now-img {
  background: none;
  border: none;
  cursor: pointer;
  display: block;
  width: 100%;
  margin-bottom: 24px;
  padding: 0;
  transition: transform .14s ease, filter .18s ease;
}
.btn-play-now-img img {
  width: 100%;
  height: auto;
  display: block;
}
.btn-play-now-img:hover {
  transform: translateY(-3px) scale(1.025);
  filter: brightness(1.08) drop-shadow(0 12px 30px rgba(42,167,255,.55));
}
.btn-play-now-img:active {
  transform: translateY(2px) scale(.985);
  filter: brightness(.95);
}

/* ── PLAY NOW ── */
.btn-play-now {
  display: block;
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #73f7ff 0%, #2aa7ff 55%, #1f76ff 100%);
  color: #042436;
  font-family: 'Titan One', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 0 rgba(0,0,0,.22), 0 18px 40px rgba(42,167,255,.35);
  transition: filter .18s ease, transform .14s ease, box-shadow .18s ease;
  margin-bottom: 24px;
}

/* shine sweep */
.btn-play-now::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    108deg,
    transparent 0%,
    transparent 35%,
    rgba(255,255,255,.55) 50%,
    transparent 65%,
    transparent 100%
  );
  transform: translateX(-100%) skewX(-15deg);
  transition: none;
}
.btn-play-now:hover::after {
  animation: play-shine .55s ease forwards;
}
@keyframes play-shine {
  from { transform: translateX(-100%) skewX(-15deg); }
  to   { transform: translateX(160%)  skewX(-15deg); }
}

.btn-play-now:hover {
  filter: brightness(1.13);
  transform: translateY(-3px) scale(1.025);
  box-shadow:
    0 13px 0 rgba(0,0,0,.22),
    0 22px 55px rgba(42,167,255,.60),
    0 0 0 4px rgba(79,246,255,.25),
    0 0 50px rgba(79,246,255,.30);
}
.btn-play-now:active {
  transform: translateY(3px) scale(.985);
  box-shadow: 0 4px 0 rgba(0,0,0,.22), 0 6px 20px rgba(42,167,255,.25);
}

.code-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.code-or-divider::before,
.code-or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ── ACCORDION ── */
.gate-accordion {
  text-align: left;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(8,18,58,.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}
.gate-accordion-btn {
  width: 100%;
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: .2px;
  font-family: inherit;
  transition: color .15s;
}
.gate-accordion-btn:hover { color: var(--text); }
.gate-accordion-arrow {
  font-size: 1.1rem;
  transition: transform .2s;
  flex-shrink: 0;
}
.gate-accordion-body {
  display: none;
  padding: 0 14px 12px;
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.55;
}
.gate-accordion-body strong { color: #ffd56a; }
.gate-accordion-body ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 3px; }
.gate-accordion-body ul li { padding-left: 12px; position: relative; }
.gate-accordion-body ul li::before { content: "–"; position: absolute; left: 0; color: rgba(255,144,144,.5); }
.gate-accordion--warn { border-color: rgba(255,90,79,.20); background: rgba(255,90,79,.04); }
.gate-accordion--warn .gate-accordion-btn { color: #ff9494; }
.gate-accordion--warn .gate-accordion-btn:hover { color: #ffb8b8; }

/* ── GAME CONTAINER ── */
#gameContainer {
  display: none;
  position: fixed;
  inset: 0;
  flex-direction: column;
  background: #000;
}
#gameContainer.active { display: flex; }

#gameBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 25, 70, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding: 7px 16px;
  gap: 10px;
  flex-shrink: 0;
  z-index: 10;
}

.bar-left { display: flex; align-items: center; gap: 10px; }

.bar-title {
  font-family: 'Titan One', sans-serif;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: .3px;
}

.mvp-pill {
  background: rgba(255,180,40,.15);
  border: 1px solid rgba(255,180,40,.4);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .7rem;
  color: #ffd56a;
  font-weight: 700;
  letter-spacing: .3px;
}

.bar-right { display: flex; align-items: center; gap: 8px; }

.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: var(--text);
  font-size: .8rem;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
  font-family: inherit;
  white-space: nowrap;
}
.bar-btn:hover { background: rgba(255,255,255,.18); }
.bar-btn.accent { background: var(--accent); color: #0a1940; border-color: transparent; font-weight: 700; }
.bar-btn.accent:hover { background: #6dfcff; }

#gameFrame { flex: 1; width: 100%; border: none; display: block; }

/* ── HOW TO PLAY TOAST ── */
#howToPlayToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: rgba(10, 25, 70, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(79, 246, 255, .35);
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 520px;
  width: calc(100vw - 48px);
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
  pointer-events: none;
}
#howToPlayToast.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }

.toast-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.toast-title { font-family: 'Titan One', sans-serif; font-size: 1rem; color: var(--accent); letter-spacing: .3px; }
.toast-header-right { display: flex; align-items: center; gap: 8px; }

.lang-toggle {
  display: flex;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 7px;
  overflow: hidden;
}
.lang-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 9px;
  cursor: pointer;
  transition: background .18s, color .18s;
  font-family: inherit;
  letter-spacing: .3px;
}
.lang-btn.active { background: var(--accent); color: #0a1940; }
.lang-btn:not(.active):hover { background: rgba(255,255,255,.12); color: var(--text); }

.toast-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.toast-close:hover { color: var(--text); background: rgba(255,255,255,.1); }

.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.control-row { display: flex; align-items: center; gap: 8px; font-size: .83rem; }

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28);
  border-bottom: 2px solid rgba(255,255,255,.18);
  border-radius: 5px;
  min-width: 30px;
  height: 26px;
  padding: 0 6px;
  font-size: .75rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--accent);
  flex-shrink: 0;
}

.control-desc { color: var(--muted); font-size: .81rem; }

.toast-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--muted);
  line-height: 1.5;
}
.toast-note strong { color: #ffd56a; }

/* ── STATS PANEL ── */
#statsToast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  transform: translateY(120px);
  background: rgba(10, 25, 70, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(79, 246, 255, .35);
  border-radius: 16px;
  padding: 20px 24px;
  width: 300px;
  max-width: calc(100vw - 48px);
  z-index: 200;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
  pointer-events: none;
}
#statsToast.visible { transform: translateY(0); opacity: 1; pointer-events: auto; }

.stats-list { display: flex; flex-direction: column; gap: 10px; }

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.stat-row.wip { opacity: .55; }

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: .68rem;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  letter-spacing: .5px;
  flex-shrink: 0;
}
.stat-icon.str { background: rgba(255,90,79,.2);   color: #ff7a6e; border: 1px solid rgba(255,90,79,.3); }
.stat-icon.vit { background: rgba(79,246,200,.2);  color: #4ff6c8; border: 1px solid rgba(79,246,200,.3); }
.stat-icon.dex { background: rgba(123,255,138,.15); color: #7bff8a; border: 1px solid rgba(123,255,138,.2); }
.stat-icon.wis { background: rgba(255,213,106,.15); color: #ffd56a; border: 1px solid rgba(255,213,106,.2); }
.stat-icon.int { background: rgba(192,139,255,.15); color: #c08bff; border: 1px solid rgba(192,139,255,.2); }

.stat-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.stat-name { font-size: .82rem; font-weight: 700; color: var(--text); }
.stat-desc { font-size: .74rem; color: var(--muted); }

.wip-badge {
  font-size: .65rem;
  font-weight: 700;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 500px) {
  .gate-card { padding: 28px 18px 22px; }
  .gate-logo-img { width: min(200px, 75%); }
  .controls-grid { grid-template-columns: 1fr; }
  .bar-title { display: none; }
}
