/* World Game — website styles */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* fill the whole window; never let content be narrower than the viewport */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
html { scroll-behavior: smooth; background: var(--bg); }
body { min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
/* hidden must win over author display rules (.gate uses display:grid, iframe is flex) */
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.05; font-weight: 600; }
.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
.eyebrow {
  font-family: var(--font-display); font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; font-size: .8rem; color: var(--accent);
}
.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; }

/* ---------- buttons ---------- */
.btn {
  --_bg: var(--accent); --_fg: var(--text-invert);
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  padding: .8em 1.4em; border: none; border-radius: 999px;
  background: var(--_bg); color: var(--_fg); cursor: pointer;
  text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), filter var(--dur-fast);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); filter: brightness(1.03); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.btn--ghost { --_bg: transparent; --_fg: var(--text); box-shadow: inset 0 0 0 2px var(--surface-ring); }
.btn--gold {
  --_fg: #4a2c00;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-500));
  box-shadow: var(--shadow-gold);
}
.btn--lg { font-size: 1.15rem; padding: .95em 1.8em; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; filter: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--surface-ring);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; padding: .8rem 0; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; text-decoration: none; }
.brand .logo { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-600)); color: #fff; font-size: 1.1rem; box-shadow: var(--shadow-sm); }
.nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.nav a.navlink { padding: .5rem .8rem; border-radius: 999px; text-decoration: none; font-weight: 700; color: var(--text-soft); }
.nav a.navlink:hover { color: var(--text); background: var(--bg-sunk); }
.theme-toggle { border: none; background: var(--bg-sunk); color: var(--text); width: 40px; height: 40px; border-radius: 999px; cursor: pointer; font-size: 1.1rem; }
.theme-toggle:hover { box-shadow: inset 0 0 0 2px var(--surface-ring); }

/* auth chip */
.auth-slot { display: flex; align-items: center; gap: .6rem; }
.user-chip { display: flex; align-items: center; gap: .5rem; padding: .3rem .3rem .3rem .8rem; background: var(--bg-elev); border-radius: 999px; box-shadow: var(--shadow-sm); }
.user-chip img, .user-chip .avatar-fallback { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; }
.user-chip .uname { font-weight: 800; font-size: .9rem; max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { background: none; border: none; color: var(--text-soft); cursor: pointer; font-weight: 700; font-size: .85rem; text-decoration: underline; }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(3rem,2rem+6vw,7rem) 0 var(--space-section); overflow: hidden; }
.hero::before, .hero::after { content:""; position:absolute; border-radius:50%; filter: blur(60px); opacity:.55; z-index:0; }
.hero::before { width:460px; height:460px; background: radial-gradient(circle, var(--pink-400), transparent 70%); top:-120px; right:-80px; }
.hero::after { width:380px; height:380px; background: radial-gradient(circle, var(--gold-400), transparent 70%); bottom:-140px; left:-100px; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.5rem,3vw,4rem); align-items: center; }
.hero h1 { font-size: var(--text-hero); letter-spacing: -.02em; }
.hero h1 .grad { background: linear-gradient(120deg, var(--pink-500), var(--gold-500)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: var(--text-lead); color: var(--text-soft); margin: 1.2rem 0 2rem; max-width: 42ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.hero-note { font-size: .85rem; color: var(--text-soft); margin-top: 1rem; }

/* hero visual — floating avatar stack */
.hero-visual { position: relative; aspect-ratio: 1; min-height: 320px; }
.hero-visual .board {
  position:absolute; inset:8%; border-radius: var(--radius-lg);
  background:
    conic-gradient(from 45deg, var(--pink-200), var(--gold-300), var(--sky), var(--pink-200));
  box-shadow: var(--shadow-lg); transform: rotate(-6deg);
  border: 8px solid var(--bg-elev);
}
.hero-visual figure { position:absolute; width: 40%; border-radius: var(--radius); overflow:hidden;
  box-shadow: var(--shadow-md); border: 4px solid var(--bg-elev); background: var(--bg-elev); }
.hero-visual figure img { aspect-ratio: 1; object-fit: cover; }
.hero-visual .f1 { top: 2%; left: 8%; transform: rotate(-8deg); animation: float 6s var(--ease) infinite; }
.hero-visual .f2 { top: 30%; right: 0; transform: rotate(6deg); animation: float 6s var(--ease) infinite .8s; }
.hero-visual .f3 { bottom: 2%; left: 26%; transform: rotate(-3deg); animation: float 6s var(--ease) infinite 1.6s; }
@keyframes float { 0%,100%{ translate:0 0 } 50%{ translate:0 -12px } }
@media (prefers-reduced-motion: reduce){ .hero-visual figure{ animation:none } }

/* ---------- sections ---------- */
section { padding-block: var(--space-section); }
.section-head { max-width: 60ch; margin-bottom: clamp(1.5rem,3vw,3rem); }
.section-head h2 { font-size: var(--text-h2); margin-top: .4rem; }
.section-head p { color: var(--text-soft); font-size: var(--text-lead); margin-top: .6rem; }

/* feature row */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.feature {
  --_hue: var(--accent);
  position: relative; overflow: hidden;
  background: var(--bg-elev); border-radius: var(--radius); padding: 1.8rem 1.6rem 1.6rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--surface-ring);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feature::before { content:""; position:absolute; inset:0 0 auto 0; height:5px;
  background: linear-gradient(90deg, var(--_hue), color-mix(in srgb, var(--_hue) 40%, transparent)); }
.feature:nth-child(1) { --_hue: var(--sky); }
.feature:nth-child(2) { --_hue: var(--pink-500); }
.feature:nth-child(3) { --_hue: var(--mint); }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature .ico {
  width: 56px; height: 56px; display: grid; place-items: center; font-size: 1.7rem;
  border-radius: 16px; background: color-mix(in srgb, var(--_hue) 16%, var(--bg-elev));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--_hue) 35%, transparent);
}
.feature h3 { font-size: 1.2rem; margin: .9rem 0 .3rem; }
.feature p { color: var(--text-soft); font-size: .95rem; }

/* ---------- avatar gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1.2rem; }
.avatar-card {
  position: relative; background: var(--bg-elev); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--surface-ring);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  text-align: left;
}
.avatar-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.avatar-card .thumb { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--bg-sunk); }
.avatar-card .thumb img { width:100%; height:100%; object-fit: cover; transition: transform var(--dur) var(--ease); }
.avatar-card:hover .thumb img { transform: scale(1.06); }
.avatar-card .body { padding: .9rem 1rem 1.1rem; }
.avatar-card .name { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.avatar-card .title { color: var(--text-soft); font-size: .85rem; }
.avatar-card .meta { display:flex; align-items:center; justify-content:space-between; margin-top:.6rem; }
.chip-el { font-size: .72rem; font-weight: 800; letter-spacing:.04em; text-transform: uppercase; padding:.2rem .55rem; border-radius:999px; background: var(--bg-sunk); color: var(--text-soft); }
.tier-badge { position: absolute; top: .7rem; left: .7rem; z-index: 2; font-size: .72rem; font-weight: 800; letter-spacing:.05em; text-transform: uppercase; padding:.28rem .6rem; border-radius:999px; box-shadow: var(--shadow-sm); }
.tier-free { background: var(--mint); color:#053b36; }
.tier-gold { background: linear-gradient(135deg, var(--gold-300), var(--gold-500)); color:#4a2c00; }
.avatar-card.is-gold { outline: 2px solid var(--gold-400); outline-offset: -2px; }
.avatar-card.is-gold .thumb::after { content:"🔒"; position:absolute; inset:0; display:grid; place-items:center; font-size:2rem;
  background: color-mix(in srgb, var(--plum) 42%, transparent); opacity:0; transition: opacity var(--dur); }
.avatar-card.is-gold:not(.unlocked):hover .thumb::after { opacity:1; }
.avatar-card .view3d { position:absolute; bottom:.7rem; right:.7rem; z-index:2; font-size:.72rem; font-weight:800; padding:.3rem .6rem; border-radius:999px; border:none; background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); cursor:pointer; opacity:0; transition: opacity var(--dur); }
.avatar-card:hover .view3d { opacity:1; }

/* ---------- gold section ---------- */
.gold-band { background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--gold-400) 26%, var(--bg)) 0%, var(--bg) 55%); }
.gold-card {
  display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(1.5rem,3vw,3rem); align-items: center;
  background: var(--bg-elev); border-radius: var(--radius-lg); padding: clamp(1.6rem,3vw,3rem);
  box-shadow: var(--shadow-lg); border: 1px solid var(--gold-soft); position: relative; overflow: hidden;
}
.gold-card::before { content:"GOLD"; position:absolute; top:-.3em; right:.2em; font-family:var(--font-display); font-weight:600;
  font-size: clamp(5rem,12vw,11rem); color: color-mix(in srgb, var(--gold-400) 22%, transparent); pointer-events:none; letter-spacing:-.04em; }
.gold-card h2 { font-size: var(--text-h2); }
.gold-card .price { font-family: var(--font-display); font-weight: 600; font-size: 2.4rem; color: var(--gold-600); }
.gold-card .price small { font-size: .9rem; color: var(--text-soft); font-weight: 700; }
.perks { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .55rem; }
.perks li { display:flex; gap:.6rem; align-items:flex-start; }
.perks li::before { content:"✦"; color: var(--gold-500); font-weight: 900; }
.gold-visual { position: relative; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-md); border:4px solid var(--gold-soft); }
.gold-visual img { width:100%; height:100%; object-fit: cover; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 1.2rem;
  background: color-mix(in srgb, var(--plum) 55%, transparent); backdrop-filter: blur(6px); }
.modal[open], .modal.show { display: grid; }
.modal-card { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--bg-elev); border-radius: var(--radius-lg); padding: clamp(1.4rem,3vw,2.4rem); box-shadow: var(--shadow-lg); position: relative; }
.modal-card h3 { font-size: 1.6rem; }
.modal-close { position:absolute; top:1rem; right:1rem; border:none; background: var(--bg-sunk); width:38px; height:38px; border-radius:999px; font-size:1.1rem; cursor:pointer; color: var(--text); }
.modal .model-frame { width:100%; aspect-ratio: 1; border-radius: var(--radius); overflow:hidden; background: var(--bg-sunk); margin: 1rem 0; }
model-viewer { width:100%; height:100%; }
.login-options { display: grid; gap: .8rem; margin-top: 1.2rem; }
.gsi-wrap { display: grid; place-items: center; min-height: 44px; }
.divider { display:flex; align-items:center; gap:.8rem; color: var(--text-soft); font-size:.8rem; }
.divider::before, .divider::after { content:""; flex:1; height:1px; background: var(--surface-ring); }

/* ---------- play page ---------- */
/* The game iframe is auto-sized to its content height (by JS) and the whole
   page scrolls naturally, so every part of the game (incl. the Start/Adventure
   button) is reachable. The bar stays pinned on top. */
.play-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.play-bar { position: sticky; top: 0; z-index: 40; flex: none; display:flex; align-items:center; gap:.8rem; padding:.5rem .9rem; background: var(--bg-elev); border-bottom:1px solid var(--surface-ring); box-shadow: var(--shadow-sm); }
.play-bar .brand { font-size: 1rem; }
.play-frame { border:none; width:100%; background:#fff; display:block; min-height: 60vh; }
.play-promo { flex:none; display:flex; align-items:center; gap:.7rem; flex-wrap:wrap; padding:.4rem .9rem; font-size:.82rem; font-weight:700;
  background:linear-gradient(135deg,var(--pink-500),var(--pink-600)); color:#fff; overflow-x:auto; white-space:nowrap; }
.play-promo a { color:#fff; text-decoration:underline; text-underline-offset:2px; padding:.15rem .3rem; }
.play-promo a:hover { color:var(--gold-300); }
@media (max-width:520px){ .play-promo { font-size:.75rem; gap:.4rem; } }
.gate { min-height: 70vh; display:grid; place-items:center; text-align:center; padding:2rem; }
.gate .card { max-width: 460px; background: var(--bg-elev); padding: 2.4rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }

/* ---------- footer ---------- */
.site-footer { background: var(--bg-sunk); border-top: 1px solid var(--surface-ring); padding-block: 2.4rem; margin-top: var(--space-section); }
.site-footer .wrap { display:flex; flex-wrap:wrap; gap:1rem; justify-content:space-between; align-items:center; color: var(--text-soft); font-size:.9rem; }
.site-footer a { color: var(--text-soft); }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 1.2rem; left: 50%; translate: -50% 0; z-index: 200; background: var(--plum); color:#fff; padding:.8rem 1.2rem; border-radius: 999px; box-shadow: var(--shadow-lg); opacity:0; pointer-events:none; transition: opacity var(--dur); font-weight:700; }
.toast.show { opacity:1; }

/* icon-only button + play-bar collapse helpers */
.btn--icon { padding: .55em; width: 42px; height: 42px; justify-content: center; }
.edition-tag { color: var(--text-soft); font-weight: 700; font-size: .9rem; }
.gold-short { display: none; }

/* ---------- responsive ---------- */
/* Tablet (two-up where it helps) */
@media (max-width: 1024px) {
  .wrap { width: min(100% - 2rem, var(--maxw)); }
  .features { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; text-align: center; }
  .hero p.lead { margin-inline: auto; }
  .hero-cta { justify-content: center; }
  .hero-visual { order: -1; max-width: 380px; margin-inline: auto; width: 100%; }
  .gold-card { grid-template-columns: 1fr; }
  .gold-visual { max-width: 300px; margin-inline: auto; }
  .gold-card::before { font-size: clamp(4rem, 16vw, 7rem); }
}
/* Landscape phones / small tablets */
@media (max-width: 680px) {
  .features { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: .8rem; }
  .avatar-card .view3d { opacity: 1; }           /* no hover on touch → always show */
  .avatar-card .name { font-size: 1.05rem; }
  .site-header .wrap { gap: .5rem; }
  .nav { gap: .2rem; }
  .nav a.navlink { padding: .45rem .55rem; font-size: .9rem; }
  .edition-tag { display: none; }                 /* play-bar breathing room */
  .site-footer .wrap { flex-direction: column; text-align: center; gap: .6rem; }
}
/* Phones */
@media (max-width: 520px) {
  :root { --space-section: clamp(2.8rem, 2rem + 6vw, 4rem); }
  .nav a.navlink { display: none; }               /* rely on scroll + CTA */
  .brand .brand-txt { display: inline; }
  .hero h1 { font-size: clamp(2.2rem, 9vw, 3rem); }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .gold-copy .hero-cta .btn { width: 100%; }
  .gold-txt { display: none; }                     /* compact gold button in bar */
  .gold-short { display: inline; }
  .modal-card { padding: 1.2rem; }
  .user-chip .uname { max-width: 6ch; }
}
/* Very small / narrow */
@media (max-width: 380px) {
  /* keep the gallery 2-up — one column makes the page enormously long */
  .gallery { gap: .6rem; }
  .avatar-card .body { padding: .7rem .8rem .9rem; }
  .brand .brand-txt { display: none; }             /* logo-only brand */
  .hero-visual { min-height: 260px; }
}
/* Touch devices: make all tap targets comfortable, kill hover-only reveals */
@media (hover: none) {
  .btn, .theme-toggle, .navlink, .link-btn { min-height: 44px; }
  .avatar-card .view3d, .avatar-card.is-gold .thumb::after { opacity: 1; }
}
/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
