/* Capybara Universe — warm, chunky, retro-game UI over a live 3D world.
   Layout: full-screen WebGL canvas; HTML UI floats on top per view. */
:root {
  --cream: #fbf3e3;
  --cream-2: #f3e6cd;
  --cream-edge: #dcc7a1;
  --tile: #efe2c9;
  --brown: #5a3215;
  --brown-ink: #3d200c;
  --gold: #f7c948;
  --gold-deep: #f0a623;
  --gold-shadow: #c47a12;
  --green: #6cc04a;
  --green-shadow: #3f8a2a;
  --navy: #1f2a44;
  --telegram: #229ed9;
  --font-display: 'Lilita One', 'Arial Black', system-ui, sans-serif;
  --font-ui: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  background: #8cc8f5;
  font-family: var(--font-ui);
  color: var(--brown);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px var(--brown); }

/* ---------- loader ---------- */
.loader {
  --load-ms: 2500ms;
  position: fixed; inset: 0; z-index: 50; overflow: hidden;
  display: grid; place-content: center; justify-items: center; gap: 0;
  /* soft daylight: muted sky blue fading into warm cream (bright, not glaring) */
  background: linear-gradient(180deg, #a9d4f2 0%, #cfe6f5 48%, #f6ecd9 100%);
  font: 600 18px var(--font-ui); color: var(--brown);
  transition: opacity .6s ease, transform .6s ease;
}
.loader.done { opacity: 0; transform: scale(1.03); pointer-events: none; }
.loader-stage { position: relative; display: grid; justify-items: center; }
.loader-cabi { position: relative; display: grid; place-items: end center; height: 130px; padding-right: 14px; animation: loader-hop 1.1s cubic-bezier(.3,0,.4,1) infinite; transform-origin: 50% 100%; }
.loader-shadow { width: 110px; height: 14px; margin-top: -6px; border-radius: 50%; background: rgba(61,32,12,.18); filter: blur(3px); animation: loader-shadow 1.1s cubic-bezier(.3,0,.4,1) infinite; }
@keyframes loader-hop { 0%, 100% { transform: translateY(0) scale(1.03, .97); } 45% { transform: translateY(-18px) scale(.98, 1.02); } }
@keyframes loader-shadow { 0%, 100% { transform: scale(1); opacity: 1; } 45% { transform: scale(.72); opacity: .5; } }
.loader-title {
  margin: 16px 0 0; font: 400 clamp(60px, 8vw, 96px)/.9 var(--font-display); letter-spacing: .04em;
  color: var(--brown); animation: loader-in .6s ease both;
}
.loader-sub { margin: 10px 0 0; font: 600 15px var(--font-ui); letter-spacing: .2em; text-transform: uppercase; color: var(--brown); opacity: .6; animation: loader-in .6s .1s ease both; }
.loader-bar { position: relative; width: min(260px, 64vw); height: 8px; margin-top: 30px; border-radius: 99px; background: rgba(90,50,21,.12); overflow: hidden; }
.loader-bar span { position: absolute; inset: 0; transform-origin: left; transform: scaleX(0); border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  animation: loader-fill var(--load-ms) cubic-bezier(.45,.05,.3,1) forwards; }
@keyframes loader-fill { to { transform: scaleX(1); } }
.loader-tip { margin: 14px 0 0; min-height: 1.4em; font: 600 14px var(--font-ui); color: var(--brown); opacity: .55; }
.loader-ticker { position: absolute; bottom: 26px; left: 0; right: 0; margin: 0; text-align: center; font: 700 12px var(--font-ui); letter-spacing: .22em; color: var(--brown); opacity: .4; }
@keyframes loader-in { from { opacity: 0; transform: translateY(10px); } }
.loader-face { width: 111px; height: 96px; border-radius: 33px 39px 27px 27px; background: #c98a51; border: 6px solid var(--brown); position: relative; }
.loader-face::after { content: ""; position: absolute; right: -12px; top: 27px; width: 60px; height: 51px; border-radius: 15px; background: #9d6538; border: 6px solid var(--brown); }
@media (max-height: 640px) { .loader-cabi { height: 110px; } .loader-face { scale: .8; transform-origin: 50% 100%; } .loader-title { font-size: 60px; } }
@media (prefers-reduced-motion: reduce) { .loader-cabi, .loader-shadow { animation: none; } }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) calc(var(--gutter-r) + 18px) 0 calc(var(--gutter-l) + 18px);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.logo img { width: 84px; height: 84px; display: block; filter: drop-shadow(0 4px 0 rgba(61,32,12,.25)); transition: transform .2s; }
.logo:hover img { transform: rotate(-6deg) scale(1.05); }
.navpill {
  display: flex; align-items: stretch; gap: 4px; padding: 5px;
  background: var(--cream); border: 2px solid var(--cream-edge); border-radius: 22px;
  box-shadow: 0 5px 0 rgba(140,100,50,.35), 0 10px 24px rgba(0,0,0,.12);
}
.navpill a {
  display: grid; place-items: center; padding: 10px 22px; border-radius: 16px;
  font: 600 19px var(--font-ui); text-decoration: none; color: var(--brown-ink);
  transition: background .15s;
}
.navpill a:hover { background: var(--cream-2); }
.navpill a.active { background: #fff; box-shadow: inset 0 -3px 0 var(--cream-edge); }
.nav-home { padding: 8px 16px !important; }
.nav-home svg { width: 26px; height: 26px; fill: var(--brown); }
.socials { justify-self: end; display: flex; gap: 14px; }
.social {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); border: 3px solid rgba(255,255,255,.85);
  box-shadow: 0 4px 0 rgba(0,0,0,.25); transition: transform .15s;
}
.social:hover { transform: translateY(-2px) scale(1.05); }
.social svg { width: 26px; height: 26px; fill: #fff; }
/* music track switcher pill (Chill / Sigma) */
.socials { align-items: center; }
.track-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 12px; border-radius: 999px;
  border: 3px solid rgba(255,255,255,.85); background: var(--navy); color: #fff;
  font: 400 17px var(--font-display); letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 4px 0 rgba(0,0,0,.25); transition: transform .15s, background .2s;
}
.track-pill svg { width: 20px; height: 20px; }
.track-pill:hover { transform: translateY(-2px); }
.track-pill[data-track="sigma"] { background: linear-gradient(135deg, #1a1a1f, #3b0d16); border-color: #ff4d6d; box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 16px rgba(255,60,90,.45); }
.track-pill[data-track="sigma"] span { color: #ffd1d9; }
.track-pill[data-track="tiki"] { background: linear-gradient(135deg, #12324a, #0b5d63); border-color: #4fe3c1; box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 16px rgba(80,230,190,.45); }
.track-pill[data-track="tiki"] span { color: #c9fff1; }
@media (min-width: 2200px) and (min-height: 1150px) { .track-pill { height: 60px; font-size: 22px; padding: 0 22px 0 16px; } .track-pill svg { width: 26px; height: 26px; } }
@media (max-width: 820px), (max-aspect-ratio: 9/10) { .track-pill { height: 38px; font-size: 13px; padding: 0 10px 0 8px; gap: 5px; } .track-pill svg { width: 16px; height: 16px; } }

/* sound toggle: speaker icon + a tiny bouncing equalizer while music plays */
.sound-btn { position: relative; border: 3px solid rgba(255,255,255,.85); cursor: pointer; padding: 0; color: #fff; }
.sound-btn svg { fill: none; }
.sound-btn .ico-off { display: none; }
.sound-btn[aria-pressed="false"] .ico-on { display: none; }
.sound-btn[aria-pressed="false"] .ico-off { display: block; }
.sound-btn[aria-pressed="false"] { background: #5b6478; }
.eq { position: absolute; right: -4px; bottom: -4px; display: flex; align-items: flex-end; gap: 2px; height: 16px; padding: 3px 4px; border-radius: 8px; background: var(--gold); border: 2px solid #fff; }
.eq i { width: 3px; background: var(--brown-ink); border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 10px; } }
.sound-btn[aria-pressed="false"] .eq, body:not(.audio-live) .eq { display: none; }

/* ---------- views ---------- */
.view { position: fixed; inset: 0; z-index: 5; pointer-events: none; display: none; }
.view > * { pointer-events: auto; }
body[data-view="home"] .view-home,
body[data-view="create"] .view-create,
body[data-view="gallery"] .view-gallery,
body[data-view="community"] .view-community,
body[data-view="explore"] .view-explore { display: block; }
body[data-view="explore"] .topbar { display: none; }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--cream); --edge: var(--cream-edge); --sh: #c9b28a; --fg: var(--brown-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 14px 26px; border-radius: 18px; border: 3px solid var(--edge);
  background: var(--bg); color: var(--fg);
  font: 400 20px/1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; text-decoration: none;
  box-shadow: 0 6px 0 var(--sh), 0 12px 20px rgba(0,0,0,.15);
  transition: transform .1s, box-shadow .1s, filter .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--sh), 0 4px 10px rgba(0,0,0,.15); }
.btn svg { width: 1.2em; height: 1.2em; fill: currentColor; flex: none; }
.btn-primary { --bg: linear-gradient(#ffd75a, var(--gold-deep)); --edge: #e8961a; --sh: var(--gold-shadow); }
.btn-green { --bg: linear-gradient(#86d65e, #57b03a); --edge: #4c9c31; --sh: var(--green-shadow); --fg: #fff; }
.btn-cream { --bg: var(--cream); }
.btn-dark { --bg: var(--navy); --edge: #0f1626; --sh: #0a0f1a; --fg: #fff; }
.btn-telegram { --bg: var(--telegram); --edge: #1a86bd; --sh: #136a96; --fg: #fff; }
.social-tg { background: var(--telegram); }
.btn-xl { font-size: clamp(20px, 2vw, 30px); padding: 22px 40px; border-radius: 24px; }
.btn-sm { font-size: 16px; padding: 10px 18px; }
.btn-icon { padding: 0; height: 78px; flex: 1; border-radius: 20px; }
.btn-icon svg { width: 44px; height: 44px; }
.round-btn {
  width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--cream); border: 3px solid var(--cream-edge); color: var(--brown);
  box-shadow: 0 4px 0 #c9b28a;
}
.round-btn svg { width: 26px; height: 26px; }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c9b28a; }

/* ---------- home ---------- */
/* Home hero lives in the band between the top bar and the card carousel and is centered in it.
   Type scales with both width and height, so short laptop screens shrink it instead of colliding. */
:root { --hero-top: 104px; --carousel-h: 230px; }
.hero-copy {
  position: absolute; right: calc(var(--gutter-r) + 3vw);
  top: calc(env(safe-area-inset-top, 0px) + var(--hero-top));
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--carousel-h));
  width: min(48vw, 760px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: min(10px, 1vh);
}
.title, .tagline { position: relative; isolation: isolate; margin: 0; text-align: center; transform: rotate(-3deg); }
.title { font: 400 clamp(64px, min(12vw, 17vh), 210px)/0.9 var(--font-display); letter-spacing: .03em; }
.title, .tagline, .from-line { position: relative; isolation: isolate; margin: 0; text-align: center; transform: rotate(-3deg); }
.from-line { font: 400 clamp(18px, min(2.4vw, 3.6vh), 42px)/1 var(--font-display); letter-spacing: .04em; margin-top: -.15em; }
.from-line::before {
  content: attr(data-text); position: absolute; inset: 0; z-index: -1;
  color: var(--brown); -webkit-text-stroke: .22em var(--brown);
  text-shadow: 0 .08em 0 var(--brown-ink);
}
.from-line span { color: #fbe7b8; }
.title::before, .tagline::before {
  content: attr(data-text); position: absolute; inset: 0; z-index: -1;
  color: var(--brown); -webkit-text-stroke: .17em var(--brown);
  text-shadow: 0 .07em 0 var(--brown-ink), 0 .12em .25em rgba(0,0,0,.25);
}
.title span {
  background: linear-gradient(180deg, #fff2a8 0%, #ffd23f 30%, #f7a823 70%, #e9861a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font: 400 clamp(22px, min(3.6vw, 5.4vh), 64px)/1.05 var(--font-display); margin-top: -.1em; }
.tagline::before { -webkit-text-stroke: .2em var(--brown); }
.tagline span { color: #fffaf0; }
.hero-ctas { display: flex; flex-direction: column; align-items: center; gap: min(18px, 2vh); margin-top: min(3vh, 28px); }
.hero-ctas .btn-xl { font-size: clamp(18px, min(2vw, 3.1vh), 30px); padding: min(22px, 2.5vh) min(40px, 3vw); }

/* Desktop / laptop: shorter windows put the two buttons side by side and use smaller cards */
@media (min-width: 821px) and (min-aspect-ratio: 9/10) and (max-height: 880px) {
  :root { --hero-top: 96px; --carousel-h: 186px; }
  .hero-ctas { display: grid; grid-template-columns: auto auto; justify-items: center; align-items: center; column-gap: 14px; }
  .hero-ctas .ca-pill { grid-column: 1 / -1; }
  .hero-ctas .btn-cream { font-size: 15px; padding: 12px 16px; }
  .carousel .card { width: 122px; height: 128px; }
  .carousel .round-btn { width: 46px; height: 46px; }
}
@media (min-width: 821px) and (min-aspect-ratio: 9/10) and (max-height: 700px) {
  :root { --hero-top: 88px; --carousel-h: 166px; }
  .carousel .card { width: 106px; height: 110px; }
  .logo img { width: 60px; height: 60px; }
}

.carousel {
  position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.cards {
  display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth; scroll-snap-type: x mandatory;
  max-width: min(1160px, calc(100vw - 180px)); padding: 6px 4px 12px;
  scrollbar-width: none;
}
.cards::-webkit-scrollbar { display: none; }
.card {
  flex: none; width: 150px; height: 158px; scroll-snap-align: start;
  border-radius: 18px; border: 3px solid var(--cream-edge); background: var(--cream);
  box-shadow: 0 5px 0 #c9b28a, inset 0 0 0 4px #fff6e6; padding: 0; position: relative; overflow: hidden;
  transition: transform .15s;
}
.card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card:hover { transform: translateY(-4px); }
.card.active { border-color: var(--gold-deep); box-shadow: 0 5px 0 var(--gold-shadow), inset 0 0 0 4px #fff3c4; }
.card .card-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px 6px;
  font: 600 13px var(--font-ui); text-align: center; color: var(--brown-ink);
  background: linear-gradient(transparent, rgba(251,243,227,.95) 40%);
  opacity: 0; transition: opacity .15s;
}
.card:hover .card-name, .card.active .card-name { opacity: 1; }

/* ---------- premium touches: shine sweep, title shimmer, CA pill, ticker ---------- */
.btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::after {
  content: ""; position: absolute; inset: -20% auto -20% -40%; width: 30%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-18deg); animation: shine 3.6s ease-in-out infinite;
}
@keyframes shine { 0%, 55% { left: -40%; } 85%, 100% { left: 130%; } }
.btn-primary:hover { box-shadow: 0 6px 0 var(--sh), 0 0 0 4px rgba(255,214,90,.35), 0 14px 30px rgba(240,160,30,.35); }
.title span { background-size: 100% 220%; animation: goldShift 6s ease-in-out infinite; }
@keyframes goldShift { 0%, 100% { background-position: 50% 0%; } 50% { background-position: 50% 60%; } }
.social:hover { box-shadow: 0 4px 0 rgba(0,0,0,.25), 0 0 0 4px rgba(255,255,255,.35); }

.ca-pill {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 7px 14px 7px 7px; border-radius: 999px; border: 2px solid rgba(255,255,255,.7);
  background: rgba(31,42,68,.78); color: #fff; backdrop-filter: blur(8px);
  font: 600 14px var(--font-ui); box-shadow: 0 6px 18px rgba(0,0,0,.18);
  transition: transform .15s, background .15s;
}
.ca-pill:hover { transform: translateY(-1px); background: rgba(31,42,68,.9); }
.ca-tag { background: linear-gradient(#ffd75a, var(--gold-deep)); color: var(--brown-ink); font: 400 14px var(--font-display); padding: 4px 9px; border-radius: 999px; letter-spacing: .04em; }
.ca-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-variant-numeric: tabular-nums; }
.ca-pill svg { width: 18px; height: 18px; flex: none; opacity: .85; }

.ticker {
  position: absolute; left: 0; right: 0; bottom: 0; height: 34px; overflow: hidden;
  background: linear-gradient(90deg, #2a1a0b, #3d2410 50%, #2a1a0b); border-top: 2px solid #f0b43a;
  padding-bottom: env(safe-area-inset-bottom, 0px); pointer-events: none;
}
.ticker-track { display: inline-flex; align-items: center; height: 34px; white-space: nowrap; animation: ticker 38s linear infinite; }
.tick { font: 400 15px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: #ffe08a; padding: 0 18px; }
.tick-coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a6, #f5b324 60%, #c98614); box-shadow: 0 0 8px rgba(255,200,60,.8); flex: none; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
body[data-view="home"] .carousel { bottom: calc(env(safe-area-inset-bottom, 0px) + 48px); }

.bag {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: rgba(31,42,68,.82); color: #fff; font: 600 14px var(--font-ui); border: 2px solid rgba(255,255,255,.7);
}
.bag b { font: 400 20px var(--font-display); color: #ffe08a; font-variant-numeric: tabular-nums; }
.coin-ico { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3a6, #f5b324 60%, #c98614); box-shadow: inset 0 0 0 3px #e3a21c, 0 0 10px rgba(255,200,60,.7); }
.bag.pop { animation: pop .35s ease-out; }
@keyframes pop { 40% { transform: scale(1.15); } }

/* ---------- create ---------- */
.drag-hint {
  position: absolute; left: calc(var(--gutter-l) + 26vw); bottom: calc(env(safe-area-inset-bottom, 0px) + 200px); transform: translateX(-50%);
  padding: 8px 14px; border-radius: 999px; background: rgba(251,243,227,.85);
  font: 600 14px var(--font-ui); color: var(--brown); pointer-events: none;
  transition: opacity .6s;
}
.drag-hint.gone { opacity: 0; }
.creator {
  position: absolute; right: calc(var(--gutter-r) + 2vw); top: calc(env(safe-area-inset-top, 0px) + 120px);
  width: min(600px, 42vw); display: flex; flex-direction: column; gap: 22px;
  /* never run into the preset strip at the bottom: the item grid shrinks instead */
  max-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 120px - 196px);
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 120px - 196px);
}
.creator .panel { flex: 1 1 auto; min-height: 0; }
.creator-actions { flex: none; }
.panel {
  background: var(--cream); border: 3px solid var(--cream-edge); border-radius: 26px;
  box-shadow: 0 6px 0 #c9b28a, 0 18px 40px rgba(0,0,0,.18);
  overflow: hidden; display: flex; flex-direction: column;
}
.tabs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 10px 10px 0; background: var(--cream-2); }
.tab {
  aspect-ratio: 1.15; border: 0; border-radius: 16px 16px 0 0; background: transparent;
  display: grid; place-items: center; color: #6b5a48; position: relative;
}
.tab svg { width: 56%; height: 56%; fill: currentColor; }
.tab:hover { background: rgba(255,255,255,.45); }
.tab[aria-selected="true"] { background: var(--cream); color: var(--brown-ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; inset: 4px 4px 0; border: 4px solid var(--gold); border-bottom: 0; border-radius: 14px 14px 0 0; pointer-events: none;
}
.grid-wrap { flex: 1 1 auto; min-height: 90px; max-height: 430px; overflow-y: auto; padding: 16px; scrollbar-color: #d8c3a0 transparent; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  aspect-ratio: 1; border-radius: 16px; border: 3px solid transparent; background: var(--tile);
  box-shadow: inset 0 -4px 0 rgba(160,120,70,.18), inset 0 2px 0 #fff8ea; padding: 4px; position: relative;
  display: grid; place-items: center;
}
.tile img { width: 100%; height: 100%; object-fit: contain; }
.tile:hover { background: #f6ead4; }
.tile.selected { border-color: var(--gold-deep); background: #fff4d6; }
.tile .tile-none { font: 600 14px var(--font-ui); color: #9a8164; }
.tile .tip {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  white-space: nowrap; padding: 4px 8px; border-radius: 8px; background: var(--brown-ink); color: #fff;
  font: 500 12px var(--font-ui); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 2;
}
.tile:hover .tip { opacity: 1; }
.tile-swatch { width: 70%; height: 70%; border-radius: 14px; border: 3px solid rgba(0,0,0,.15); }
.swatches { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 2px solid var(--cream-2); flex-wrap: wrap; }
.swatch { flex: 1 1 26px; min-width: 26px; max-width: 40px; aspect-ratio: 1; border-radius: 8px; border: 3px solid rgba(0,0,0,.12); padding: 0; }
.swatch.selected { border-color: var(--brown); box-shadow: 0 0 0 2px #fff inset; }
.swatches .swatch-label { width: 100%; font: 500 13px var(--font-ui); color: #8b7358; margin-bottom: -2px; }
.creator-actions { display: flex; gap: 18px; }

.strip-wrap { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; justify-content: safe center; }
.strip::-webkit-scrollbar { display: none; }
.strip .card { width: 132px; height: 140px; }

/* ---------- pages (gallery / community) ---------- */
.view-page { overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 130px) var(--gutter-r) 40px var(--gutter-l); }
.page-card {
  max-width: 1100px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 36px) 36px;
  background: rgba(251,243,227,.96); border: 3px solid var(--cream-edge); border-radius: 28px;
  box-shadow: 0 6px 0 #c9b28a, 0 20px 50px rgba(0,0,0,.18);
}
.page-title { font: 400 clamp(36px, 5vw, 56px)/1 var(--font-display); margin: 0 0 8px; color: var(--brown-ink); }
.sub { font: 400 24px var(--font-display); margin: 26px 0 10px; color: var(--brown); letter-spacing: .02em; }
.muted { color: #8b7358; margin: 0 0 12px; }
.small { font-size: 13px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.g-item { display: flex; flex-direction: column; gap: 6px; }
.g-item .card { width: 100%; height: auto; aspect-ratio: 1 / 1.05; }
.g-item .card-name { opacity: 1; }
.g-meta { display: flex; gap: 6px; }
.g-meta button { flex: 1; border: 2px solid var(--cream-edge); background: #fff8ea; border-radius: 10px; padding: 6px; font: 600 13px var(--font-ui); color: var(--brown); }
.g-meta button:hover { background: #fff; }
.empty { grid-column: 1 / -1; padding: 22px; border: 3px dashed var(--cream-edge); border-radius: 18px; text-align: center; color: #8b7358; }
.empty a { font-weight: 700; color: var(--brown); }

.community-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 16px; }
.c-block { background: #fff8ea; border: 3px solid var(--cream-edge); border-radius: 22px; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.c-block h3 { font: 400 30px/1.05 var(--font-display); margin: 0; color: var(--brown-ink); text-wrap: balance; }
.c-block p { margin: 0; line-height: 1.45; max-width: 60ch; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--gold); color: var(--brown-ink); font: 600 12px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.chip-green { background: #bfe6a6; } .chip-blue { background: #bcdcf7; }
.countdown { display: flex; gap: 10px; font-variant-numeric: tabular-nums; }
.countdown div { background: var(--cream-2); border-radius: 12px; padding: 8px 12px; text-align: center; min-width: 64px; }
.countdown b { display: block; font: 400 28px var(--font-display); color: var(--brown-ink); }
.countdown span { font-size: 12px; color: #8b7358; text-transform: uppercase; letter-spacing: .05em; }
.c-otd { align-items: center; }
.c-otd img { width: 200px; height: 210px; object-fit: contain; }
.otd-name { font: 400 22px var(--font-display) !important; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.4; }
.join-btns { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- explore ---------- */
.explore-hud { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 18px); left: var(--gutter-l); right: var(--gutter-r); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.hud-tip { padding: 8px 14px; border-radius: 999px; background: rgba(251,243,227,.9); font: 600 14px var(--font-ui); }
.dpad { position: absolute; right: calc(var(--gutter-r) + 10px); bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); display: none; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(3, 58px); gap: 6px; }
.dpad button { border-radius: 16px; border: 3px solid var(--cream-edge); background: rgba(251,243,227,.92); font-size: 20px; color: var(--brown); touch-action: none; }
.dpad [data-dir="up"] { grid-area: 1 / 2; } .dpad [data-dir="left"] { grid-area: 2 / 1; } .dpad [data-dir="hop"] { grid-area: 2 / 2; }
.dpad [data-dir="right"] { grid-area: 2 / 3; } .dpad [data-dir="down"] { grid-area: 3 / 2; }
.hud-tip .tip-touch { display: none; }
@media (pointer: coarse) {
  .dpad { display: grid; }
  .hud-tip .tip-keys { display: none; }
  .hud-tip .tip-touch { display: inline; }
}

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px var(--gutter-r) 20px var(--gutter-l); background: rgba(40,22,8,.45); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(640px, 100%); max-height: 100%; overflow-y: auto; background: var(--cream); border: 3px solid var(--cream-edge); border-radius: 26px; padding: 24px; box-shadow: 0 8px 0 #c9b28a; display: flex; flex-direction: column; gap: 14px; }
.modal-title { margin: 0; font: 400 30px var(--font-display); color: var(--brown-ink); }
.modal-x { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--cream-2); font-size: 26px; line-height: 1; color: var(--brown); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--cream-2); border-radius: 14px; align-self: flex-start; }
.seg-btn { border: 0; background: transparent; padding: 8px 14px; border-radius: 10px; font: 600 15px var(--font-ui); color: #8b7358; }
.seg-btn[aria-selected="true"] { background: #fff; color: var(--brown-ink); box-shadow: inset 0 -2px 0 var(--cream-edge); }
.share-stage { position: relative; display: grid; place-items: center; }
.share-img { width: 100%; border-radius: 16px; border: 3px solid var(--cream-edge); background: #8cc8f5; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.share-img.is-square { width: min(100%, 46vh, 420px); aspect-ratio: 1; }
.share-loading { position: absolute; padding: 8px 14px; border-radius: 999px; background: rgba(251,243,227,.92); font: 600 14px var(--font-ui); color: var(--brown); }
.name-field { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--cream-edge); border-radius: 14px; padding: 6px 6px 6px 14px; }
.name-field span { font: 600 14px var(--font-ui); color: #8b7358; text-transform: uppercase; letter-spacing: .06em; }
.name-field input { flex: 1; min-width: 0; border: 0; outline: 0; font: 400 22px var(--font-display); color: var(--brown-ink); background: transparent; }
.mini-dice { border: 0; background: var(--cream-2); border-radius: 10px; width: 40px; height: 40px; font-size: 20px; }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 160px; font-size: 17px; padding: 14px 16px; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 200px); transform: translate(-50%, 20px); z-index: 40; padding: 12px 20px; border-radius: 14px; background: var(--brown-ink); color: #fff; font: 600 16px var(--font-ui); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .navpill a { padding: 8px 14px; font-size: 16px; }
  .social { width: 46px; height: 46px; } .social svg { width: 22px; height: 22px; }
  .logo img { width: 64px; height: 64px; }
  .card { width: 128px; height: 136px; }
}
/* big monitors (1440p / 4K at 100%): scale the interface up so it doesn't look tiny */
@media (min-width: 2200px) and (min-height: 1150px) {
  :root { --hero-top: 140px; --carousel-h: 290px; }
  .topbar { padding-top: calc(env(safe-area-inset-top, 0px) + 30px); }
  .logo img { width: 110px; height: 110px; }
  .navpill { padding: 7px; border-radius: 26px; }
  .navpill a { font-size: 24px; padding: 13px 30px; border-radius: 19px; }
  .nav-home svg { width: 32px; height: 32px; }
  .social { width: 70px; height: 70px; } .social svg { width: 32px; height: 32px; }
  .carousel .card { width: 196px; height: 206px; }
  .round-btn { width: 68px; height: 68px; }
  .ticker { height: 44px; } .ticker-track { height: 44px; } .tick { font-size: 20px; }
  body[data-view="home"] .carousel { bottom: calc(env(safe-area-inset-bottom, 0px) + 60px); }
  .ca-pill { font-size: 17px; } .ca-tag { font-size: 17px; }
  .hero-ctas .btn-cream { font-size: 24px; padding: 18px 30px; }
  .creator { width: min(780px, 40vw); top: calc(env(safe-area-inset-top, 0px) + 160px);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 160px - 250px); }
  .grid-wrap { max-height: 560px; }
  .strip .card { width: 170px; height: 180px; }
  .btn-icon { height: 96px; } .btn-icon svg { width: 54px; height: 54px; }
  .page-card { max-width: 1500px; }
  .view-page { padding-top: calc(env(safe-area-inset-top, 0px) + 170px); }
  .drag-hint { bottom: calc(env(safe-area-inset-bottom, 0px) + 252px); font-size: 17px; }
}

/* short desktop windows: smaller preset cards and buttons so the item grid keeps room */
@media (max-height: 780px) and (min-width: 821px) and (min-aspect-ratio: 9/10) {
  .strip .card { width: 100px; height: 106px; }
  .drag-hint { bottom: calc(env(safe-area-inset-bottom, 0px) + 158px); }
  .btn-icon { height: 58px; } .btn-icon svg { width: 34px; height: 34px; }
  .creator { top: calc(env(safe-area-inset-top, 0px) + 104px); gap: 14px;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 104px - 156px); }
  .tab { aspect-ratio: 1.5; }
}
@media (max-width: 820px), (max-aspect-ratio: 9/10) {
  .topbar { grid-template-columns: auto 1fr; padding-top: calc(env(safe-area-inset-top, 0px) + 12px); row-gap: 8px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
  .navpill { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .socials { gap: 8px; }
  .logo img { width: 52px; height: 52px; }
  .social { width: 42px; height: 42px; }
  .navpill a { padding: 8px 12px; font-size: 15px; }
  .hero-copy { left: var(--gutter-l); right: var(--gutter-r); width: auto; top: calc(env(safe-area-inset-top, 0px) + 146px); bottom: auto; justify-content: flex-start; gap: 4px; }
  .title { font-size: clamp(72px, 24vw, 140px); }
  .from-line { font-size: clamp(18px, 5.4vw, 30px); }
  .tagline { font-size: clamp(24px, 7vw, 44px); }
  .hero-ctas { position: fixed; left: var(--gutter-l); right: var(--gutter-r); bottom: calc(env(safe-area-inset-bottom, 0px) + 170px); margin: 0; gap: 12px; }
  .btn-xl, .hero-ctas .btn-xl { font-size: 20px; padding: 16px 24px; width: min(420px, 100%); }
  .hero-ctas .btn-cream { padding: 10px 18px; font-size: 16px; }
  .carousel .round-btn { display: none; }
  .cards { max-width: 100%; }
  .card { width: 108px; height: 116px; }
  .carousel { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
  body[data-view="home"] .carousel { bottom: calc(env(safe-area-inset-bottom, 0px) + 40px); }
  .ticker { height: 28px; } .ticker-track { height: 28px; } .tick { font-size: 13px; padding: 0 12px; }
  .ca-pill { font-size: 12px; padding: 5px 12px 5px 5px; }
  .hero-ctas { bottom: calc(env(safe-area-inset-bottom, 0px) + 190px); }

  .drag-hint { display: none; }
  .creator { left: var(--gutter-l); right: var(--gutter-r); width: auto; top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 128px); gap: 10px; }
  .creator { max-height: none; }
  .grid-wrap { flex: none; height: 19vh; min-height: 0; padding: 10px; }
  .swatches { flex-wrap: nowrap; }
  .swatch { flex: 1 1 0; min-width: 0; border-width: 2px; border-radius: 6px; }
  .grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .tile .tip { display: none; }
  .tabs { padding: 6px 6px 0; }
  .tab { aspect-ratio: 1.5; }
  .swatches { padding: 8px 10px 10px; gap: 6px; }
  .swatches .swatch-label { display: none; }
  .btn-icon { height: 52px; } .btn-icon svg { width: 30px; height: 30px; }
  .strip .card { width: 88px; height: 94px; }
  .strip-wrap { bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); }
  .strip { justify-content: flex-start; }
  .community-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
  .g-meta button { padding: 5px 4px; font-size: 12px; }
  .view-page { padding-top: calc(env(safe-area-inset-top, 0px) + 120px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
