/* Arena type system — fonts from real open-source games (aliases kept so scene code is unchanged):
   'Oswald' -> Xolonium (SIL OFL, the display font of Xonotic / SuperTuxKart HUD): titles, buttons, HUD numbers
   'Inter'  -> Lato     (SIL OFL, Battle for Wesnoth's UI font): body copy, subs, helper notes
   License: vendor/xolonium-OFL.txt */
@font-face { font-family: 'Oswald'; font-weight: 400; font-display: block; src: url('../vendor/xolonium-regular.otf') format('opentype'); }
@font-face { font-family: 'Oswald'; font-weight: 700; font-display: block; src: url('../vendor/xolonium-bold.otf') format('opentype'); }
@font-face { font-family: 'Inter';  font-weight: 400; font-display: swap;  src: url('../vendor/lato-regular.woff2') format('woff2'); }
@font-face { font-family: 'Inter';  font-weight: 700; font-display: swap;  src: url('../vendor/lato-700.woff2') format('woff2'); }

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

html, body {
  width: 100%;
  height: 100%;
  /* deep themed surround so any letterbox on wide desktop windows reads as intentional */
  background: radial-gradient(ellipse at 50% 38%, #121a2c 0%, #0a0e18 60%, #05070d 100%);
  overflow: hidden;
  font-family: 'Inter', 'Trebuchet MS', system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

#game-root {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* stretch the native 1280x720 canvas to fill the whole window — no black bars on any side */
#game-root canvas {
  image-rendering: auto;
  display: block;
  width: 100vw !important;
  height: 100vh !important;
}

/* ===================================================================== */
/* Premium in-game prompt/modal (replaces the ugly native window.prompt). */
/* ===================================================================== */
.ui-modal-back {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(6, 9, 16, 0.66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: uiFade .14s ease-out;
}
@keyframes uiFade { from { opacity: 0; } to { opacity: 1; } }
.ui-modal {
  width: 100%; max-width: 470px;
  background: linear-gradient(180deg, #1b2438 0%, #0f1626 100%);
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  box-shadow: 0 26px 70px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.06);
  padding: 26px 26px 22px; color: #eef4ff;
  font-family: 'Inter', system-ui, sans-serif;
  animation: uiPop .16s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes uiPop { from { transform: translateY(8px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.ui-modal h3 { font-family: 'Oswald', sans-serif; font-weight: 800; font-size: 25px; letter-spacing: .5px; color: #fff; margin-bottom: 6px; }
.ui-modal p { font-size: 14px; color: #9fb0c8; line-height: 1.5; margin-bottom: 16px; }
.ui-modal input {
  width: 100%; height: 52px; padding: 0 16px;
  background: #0e1422; border: 1.5px solid #2a3346; border-radius: 13px;
  color: #fff; font-size: 17px; font-family: inherit; outline: none;
  -webkit-user-select: text; user-select: text; transition: border-color .12s, box-shadow .12s;
}
.ui-modal input::placeholder { color: #5e6b82; }
.ui-modal input:focus { border-color: #5b8de0; box-shadow: 0 0 0 3px rgba(91,141,224,0.18); }
.ui-modal .ui-modal-row { display: flex; gap: 12px; justify-content: flex-end; margin-top: 20px; }
.ui-modal button {
  height: 46px; padding: 0 24px; border: none; border-radius: 12px; cursor: pointer;
  font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .5px;
  transition: filter .12s, transform .06s, background .12s;
}
.ui-modal button:active { transform: translateY(1px); }
.ui-modal .ui-cancel { background: rgba(255,255,255,0.08); color: #cfe0f5; }
.ui-modal .ui-cancel:hover { background: rgba(255,255,255,0.15); }
.ui-modal .ui-ok { background: linear-gradient(180deg, #3fae57, #2c8a43); color: #fff; box-shadow: 0 4px 14px rgba(63,174,87,0.3); }
.ui-modal .ui-ok:hover { filter: brightness(1.08); }

/* ===================================================================== */
/* DOM overlays that live ABOVE the Phaser canvas (auth, account).       */
/* Phaser can't render an HTML form, so Connect World mounts here.        */
/* ===================================================================== */
#world-overlays { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
#world-overlays .world-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 7, 18, 0.74);
  display: none; align-items: center; justify-content: center;
  pointer-events: auto;
  padding: 16px;
}
#world-overlays .world-backdrop.show { display: flex; }

.world-card {
  width: 100%; max-width: 430px;
  background: linear-gradient(180deg, #232c42 0%, #1a2132 100%);
  border: 2px solid #3a4458;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), inset 0 2px 0 rgba(255,255,255,0.06);
  padding: 26px 26px 24px;
  color: #eef4ff;
  font-family: 'Inter', system-ui, sans-serif;
}
.world-card h2 {
  font-family: 'Oswald', 'Inter', sans-serif; font-weight: 400;
  font-size: 30px; letter-spacing: 0.5px; color: #fff; margin-bottom: 4px;
  text-shadow: 0 3px 0 rgba(0,0,0,0.28);
}
.world-card .world-sub { font-size: 14px; color: #9fb0c8; margin-bottom: 18px; }
.world-card .devnet-pill {
  display: inline-block; vertical-align: middle; margin-left: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px;
  color: #ffd24a; background: rgba(255,210,74,0.12);
  border: 1px solid rgba(255,210,74,0.4); border-radius: 999px;
  padding: 2px 9px; transform: translateY(-3px);
}
.world-card label { display: block; font-size: 13px; color: #cfe0f5; margin: 14px 0 6px; font-weight: 600; }
.world-card input {
  width: 100%; height: 48px; padding: 0 14px;
  background: #141a28; border: 2px solid #3a4458; border-radius: 12px;
  color: #fff; font-size: 16px; font-family: inherit; outline: none;
  -webkit-user-select: text; user-select: text;
}
.world-card input:focus { border-color: #ffd24a; }
.world-btn {
  width: 100%; height: 50px; margin-top: 14px;
  border: none; border-radius: 13px; cursor: pointer;
  font-family: 'Oswald', 'Inter', sans-serif; font-weight: 400;
  font-size: 21px; letter-spacing: 0.4px; color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3), inset 0 2px 0 rgba(255,255,255,0.22);
  transition: transform 0.08s ease, filter 0.12s ease;
}
.world-btn:hover { filter: brightness(1.08); }
.world-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.world-btn.primary  { background: linear-gradient(180deg, #4fd1c5, #2c9a90); }
.world-btn.phantom  { background: linear-gradient(180deg, #ab7bf0, #6f37b3); }
.world-btn.ghost    { background: linear-gradient(180deg, #4f5d75, #3a4458); }
.world-btn.danger   { background: linear-gradient(180deg, #e06a5a, #b3402c); }
.world-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: #6b7790; font-size: 12px; letter-spacing: 1px; }
.world-divider::before, .world-divider::after { content: ''; flex: 1; height: 1px; background: #3a4458; }
.world-note { font-size: 12px; color: #8390a8; margin-top: 14px; text-align: center; line-height: 1.5; }
.world-err  { font-size: 13px; color: #ff9a8a; margin-top: 10px; min-height: 16px; }
.world-acct-id { font-size: 16px; color: #ffd24a; word-break: break-all; margin: 6px 0 2px; font-weight: 600; }
.world-bal { display: flex; gap: 10px; margin: 14px 0 4px; }
.world-bal span { flex: 1; text-align: center; padding: 12px 0; border-radius: 12px; background: #141a28; border: 1px solid #3a4458;
  font-family: 'Oswald', sans-serif; font-size: 22px; color: #fff; }
.world-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid #3a4458; color: #cfe0f5; font-size: 20px; cursor: pointer; line-height: 1; }
.world-close:hover { background: rgba(255,255,255,0.12); }
.world-hidden { display: none !important; }

/* Privy renders its login modal into a headless-ui portal appended to <body> with
   z-index:auto, which puts it UNDER our own overlays (#world-overlays is 1000).
   Lift the portal above everything so Privy's modal is the top layer. */
#headlessui-portal-root { position: relative; z-index: 4000; }
#privy-root { position: relative; z-index: 4000; }

/* ===================================================================== */
/* Mobile: rotate-to-landscape notice (game is a 1280x720 landscape HUD) */
/* ===================================================================== */
#rotate-notice {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 22px; text-align: center; padding: 32px;
  background: #0b0e16;
  color: #eef4ff; font-family: 'Inter', sans-serif;
}
#rotate-notice.show { display: flex; }
#rotate-notice .rot-icon {
  width: 84px; height: 84px; border: 5px solid #ffd24a; border-radius: 18px;
  animation: rothint 2.2s ease-in-out infinite;
}
#rotate-notice h2 { font-family: 'Oswald', sans-serif; font-weight: 400; font-size: 30px; color: #fff; }
#rotate-notice p { font-size: 16px; color: #9fb0c8; max-width: 320px; line-height: 1.5; }
@keyframes rothint { 0%,40% { transform: rotate(0deg); } 60%,100% { transform: rotate(-90deg); } }
