/* Crossle web shell — layout knobs live in shell.js (FRAME). Keep #frame aspect-ratio equal to FRAME.aspect. */
:root {
  --bg: #0f1d4a;
  --bg-2: #1c3a8f;
  --frame-border: #4e7ed8;
  --text: #ffffff;
  --muted: #8fb0f0;
  --link: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Placeholder background (D4): deep-blue gradient + faint tile grid. Swap for brand art later. */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(120, 170, 255, 0.35), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 55%, #0a1533 100%);
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.2));
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), rgba(0,0,0,0.2));
}

/* Top band: right-aligned fullscreen button (Zynga: 33px + 7/5 padding) */
.top {
  height: 45px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 0 auto;
  padding: 7px 0 5px;
  width: 100%;
}

.fs-button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease, transform 120ms ease;
}
.fs-button:hover { background: rgba(255, 255, 255, 0.22); transform: translateY(-1px); }
.fs-button img { width: 22px; height: 22px; filter: invert(1); }
.fs-button .icon-exit { display: none; }
body.fs .fs-button .icon-enter { display: none; }
body.fs .fs-button .icon-exit { display: inline; }
body.no-fullscreen .fs-button { display: none; }

/* Frame: border box around the game, sized by shell.js */
#frame-wrapper {
  margin: 0 auto;
  padding: 5px;
  background: var(--frame-border);
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

#frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;   /* CSS fallback before shell.js sizes it — keep equal to FRAME.aspect */
  background: #000;
  overflow: hidden;
}

#frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0f1d4a;
}

/* Fullscreen: #frame is the fullscreen element; iframe is letterboxed inside by shell.js */
#frame:fullscreen, #frame:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 0;
}
#frame:fullscreen iframe, #frame:-webkit-full-screen iframe {
  inset: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* Footer (Zynga measurements: 1170px, Roboto 16/1.5, muted copy) */
footer {
  margin-top: auto;
  padding: 36px 16px 20px;
  display: flex;
  justify-content: center;
  font-size: 15px;
  line-height: 1.5;
}
.footer-inner {
  width: 100%;
  max-width: 1170px;
  display: flex;
  align-items: flex-start;
  gap: 42px;
}
.footer-left { flex: 0 0 auto; }
.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
}
.footer-right { flex: 1 1 auto; min-width: 0; }
.links {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.links a { color: var(--link); text-decoration: none; }
.links a:hover { text-decoration: underline; }
.legal { color: var(--muted); margin: 6px 0 0; }
.version { color: var(--muted); opacity: 0.7; margin: 4px 0 0; font-size: 12px; }

/* Compact (phone) mode — toggled by shell.js below FRAME.minWidth */
body.compact { overflow: hidden; height: 100vh; height: 100dvh; }
body.compact .top { position: fixed; top: 0; right: 0; width: auto; z-index: 10; padding: 8px; height: auto; }
body.compact .top .fs-button { background: rgba(0, 0, 0, 0.35); }
body.compact #frame-wrapper { padding: 0; border-radius: 0; box-shadow: none; width: 100vw !important; }
body.compact #frame { width: 100vw !important; height: 100vh !important; height: 100dvh !important; aspect-ratio: auto; }
body.compact footer { display: none; }
/* Pin the iframe to the viewport itself so wrapper geometry can never leak in on phones */
body.compact #frame iframe { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; transform: none; }
