/* Jakobs.ai hub – floating-island world. Tablet-first, also phone + desktop. */
:root {
  --ink: #2b3a55;
  --ink-soft: #5a6b88;
  --sun: #ffd24a;
  --orange: #ff7a45;
  --paper: #fffaf0;
  --sky-top: #6ec6ff;
  --sky-mid: #a9e0ff;
  --sky-low: #e6f7ff;
  --shadow: 0 10px 0 rgba(43, 58, 85, .12), 0 18px 34px rgba(43, 58, 85, .16);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 100%) fixed;
  background-color: var(--sky-mid);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- sky scenery ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sun {
  position: absolute; top: -70px; right: -50px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0 38%, var(--sun) 39% 55%, rgba(255, 210, 74, 0) 70%);
}
.sun-rays {
  position: absolute; inset: -60px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 236, 150, .38) 0 8deg, rgba(255, 236, 150, 0) 8deg 22deg);
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 42%, transparent 72%);
          mask: radial-gradient(circle, transparent 30%, #000 42%, transparent 72%);
  animation: spin 80s linear infinite;
}
.cloud {
  position: absolute; width: 180px; height: 56px; border-radius: 60px; background: #fff; opacity: .9;
  animation: drift linear infinite;
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 80px; height: 80px; left: 26px; top: -38px; }
.cloud::after { width: 100px; height: 100px; right: 22px; top: -52px; }
.c1 { top: 14%; animation-duration: 95s; animation-delay: -20s; }
.c2 { top: 38%; transform: scale(.7); animation-duration: 120s; animation-delay: -70s; opacity: .75; }
.c3 { top: 62%; transform: scale(.55); animation-duration: 140s; animation-delay: -40s; opacity: .7; }
.c4 { top: 6%; transform: scale(.45); animation-duration: 110s; animation-delay: -95s; opacity: .8; }
.birds { position: absolute; top: 20%; left: 8%; width: 90px; animation: birds 40s linear infinite; opacity: .7; }
.sea { position: absolute; left: 0; bottom: 0; width: 100%; height: 90px; }
.wave { animation: waves 12s linear infinite; }
.w2 { animation-duration: 8s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift {
  from { translate: -260px 0; }
  to { translate: calc(100vw + 260px) 0; }
}
@keyframes birds {
  0% { translate: -120px 20px; }
  50% { translate: 50vw -20px; }
  100% { translate: 105vw 10px; }
}
@keyframes waves { from { transform: translateX(0); } to { transform: translateX(-300px); } }

/* ---------- header ---------- */
.top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) 6px max(18px, env(safe-area-inset-left, 0px));
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  background: rgba(255, 255, 255, .7); padding: 6px 18px 6px 6px; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(43, 58, 85, .1);
}
.brand img { width: 48px; height: 48px; display: block; }
.brand-name { font-size: 28px; font-weight: 700; letter-spacing: .5px; }
.brand-name .dot { color: var(--orange); }

.langs { display: flex; gap: 10px; }
.lang {
  width: 56px; height: 56px; padding: 5px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .75); cursor: pointer;
  box-shadow: 0 4px 0 rgba(43, 58, 85, .12);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  touch-action: manipulation;
}
.lang .flag { display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .08); }
.lang .flag svg { display: block; width: 100%; height: 100%; }
.lang:not(.on) .flag { opacity: .6; filter: saturate(.6); }
.lang.on { background: #fff; box-shadow: 0 0 0 4px var(--sun), 0 4px 0 rgba(43, 58, 85, .12); transform: scale(1.06); }
.lang:active { transform: scale(.94); }
.lang:focus-visible, .island:focus-visible, .parents summary:focus-visible, .brand:focus-visible {
  outline: 4px solid var(--orange); outline-offset: 4px;
}

/* ---------- hero ---------- */
main { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; padding: 0 16px; }
.hero { text-align: center; margin: 4px auto 0; max-width: 900px; }
.hero h1 {
  margin: 0; font-size: clamp(26px, 4.4vw, 48px); font-weight: 700; line-height: 1.1;
  color: #fff; text-shadow: 0 3px 0 rgba(43, 58, 85, .25), 0 0 18px rgba(43, 90, 160, .25);
}
.hero p { margin: 6px 0 0; font-size: clamp(16px, 2.2vw, 22px); font-weight: 500; color: var(--ink); opacity: .85; }

/* ---------- world / islands ---------- */
.world {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(10px, 2.5vh, 28px); padding: clamp(8px, 2vh, 24px) 0 110px;
}
.live-row, .soon-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.live-row { gap: 28px; }
.soon-row { gap: clamp(8px, 2.4vw, 28px); }

.island {
  --w: min(520px, 90vw);
  position: relative; display: flex; flex-direction: column; align-items: center;
  width: var(--w); padding: 0; border: 0; background: none; font: inherit; color: inherit;
  text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.island.soon { --w: clamp(104px, 28vw, 230px); cursor: default; }

.isle {
  width: 100%; aspect-ratio: 300 / 260;
  animation: bob 6s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -1.7s);
  filter: drop-shadow(0 18px 14px rgba(43, 58, 85, .18));
}
.isle-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.isle-svg text { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }

.art-bob { transform-box: fill-box; transform-origin: 50% 100%; animation: hop 3.2s ease-in-out infinite; }
.art-wave { transform-box: fill-box; transform-origin: 20% 90%; animation: wave 1.6s ease-in-out infinite; }
.soon .isle-centre { opacity: .55; }
.soon .isle-land { filter: saturate(.55) brightness(1.05); }
.cover-drift { animation: puff 7s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes hop { 0%, 70%, 100% { transform: translateY(0) scale(1, 1); } 78% { transform: translateY(0) scale(1.05, .95); } 86% { transform: translateY(-8px) scale(.97, 1.03); } }
@keyframes wave { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-18deg); } }
@keyframes puff { 0%, 100% { transform: scale(1) translateX(0); } 50% { transform: scale(1.03) translateX(4px); } }

/* signboard */
.sign {
  position: relative; margin-top: -4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--paper); border-radius: 26px; padding: 12px 22px 14px;
  box-shadow: var(--shadow); text-align: center; min-width: 70%;
  transition: transform .18s ease;
}
.sign .title { font-size: clamp(26px, 4vw, 40px); font-weight: 700; line-height: 1.05; color: var(--ink); }
.sign .tag { font-size: clamp(16px, 2.2vw, 22px); font-weight: 500; color: var(--ink-soft); }
.sign .meta { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.age {
  font-size: 18px; font-weight: 600; padding: 6px 14px; border-radius: 999px;
  background: #e6f4dc;
  background: color-mix(in srgb, var(--c) 25%, #fff); color: var(--ink);
}
.play {
  display: inline-flex; align-items: center; gap: 6px; min-height: 64px; padding: 0 28px 0 20px;
  border-radius: 999px; font-size: 26px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, #ff9a5c, var(--orange));
  box-shadow: 0 6px 0 #d9582a, 0 10px 18px rgba(217, 88, 42, .35);
  animation: glow 2.4s ease-in-out infinite;
}
.play svg { width: 30px; height: 30px; }
@keyframes glow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.sign.small { padding: 8px 12px 10px; border-radius: 18px; min-width: 0; width: 100%; max-width: 200px; background: rgba(255, 250, 240, .88); }
.sign.small .title { font-size: clamp(16px, 2.6vw, 24px); }
.sign.small .tag { font-size: clamp(12px, 1.7vw, 16px); }

/* press feedback */
.island.live:hover .sign, .island.live:focus-visible .sign { transform: translateY(-3px); }
.island.live:active .sign { transform: scale(.97); }
.island.live:active .play { box-shadow: 0 2px 0 #d9582a; transform: translateY(4px); animation: none; }
.island.going .isle { animation: launch .6s ease-in forwards; }
@keyframes launch { to { transform: translateY(-24px) scale(1.06); opacity: .85; } }
.island.wobble .isle { animation: wobble .55s ease; }
@keyframes wobble {
  0%, 100% { transform: rotate(0); } 20% { transform: rotate(-5deg); } 40% { transform: rotate(4deg); }
  60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); z-index: 5;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(560px, calc(100vw - 32px)); padding: 14px 22px; border-radius: 22px;
  background: #fff; color: var(--ink); font-size: 20px; font-weight: 500; text-align: center;
  box-shadow: var(--shadow); transition: opacity .25s ease, transform .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- parents footer ---------- */
.parents {
  position: relative; z-index: 2; text-align: center; color: #fff;
  padding: 0 16px calc(12px + var(--safe-b)); margin-top: -96px;
}
.parents details { display: inline-block; max-width: 640px; }
.parents summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 16px; font-weight: 600;
  background: rgba(30, 90, 140, .35); color: #fff;
}
.parents summary::-webkit-details-marker { display: none; }
.parents summary::before { content: 'ℹ️'; font-size: 15px; }
.parents details[open] summary { background: rgba(30, 90, 140, .55); }
.parents details p {
  margin: 8px 0 0; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.45;
  background: rgba(255, 255, 255, .92); color: var(--ink); text-align: left;
  -webkit-user-select: text; user-select: text;
}
.parents .made { margin: 8px 0 0; font-size: 13px; opacity: .9; text-shadow: 0 1px 2px rgba(0, 60, 110, .4); }

/* ---------- avatar ---------- */
.who { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  flex: none; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: #fff; font-size: 34px; line-height: 1;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .55), 0 4px 0 rgba(43, 58, 85, .12);
  transition: transform .15s ease; touch-action: manipulation;
}
.avatar.empty { background: rgba(255, 255, 255, .6); font-size: 26px; box-shadow: inset 0 0 0 3px rgba(43, 58, 85, .25); animation: nudge 3.5s ease-in-out infinite; }
.avatar.empty .avatar-face { opacity: .7; }
.avatar:active { transform: scale(.92); }
.avatar.picked { animation: picked .5s ease; }
.avatar:focus-visible, .avatar-opt:focus-visible { outline: 4px solid var(--orange); outline-offset: 3px; }
@keyframes nudge { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
@keyframes picked { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

.avatar-pop {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 10;
  width: max-content; max-width: calc(100vw - 32px); padding: 14px; border-radius: 24px;
  background: var(--paper); box-shadow: var(--shadow);
}
.avatar-pop[hidden] { display: none; }
.avatar-title { margin: 0 0 10px; text-align: center; font-size: 20px; font-weight: 600; }
.avatar-grid { display: grid; grid-template-columns: repeat(3, 72px); gap: 10px; }
.avatar-opt {
  width: 72px; height: 72px; padding: 0; border: 0; border-radius: 20px; cursor: pointer;
  background: #fff; font-size: 44px; line-height: 1; touch-action: manipulation;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  box-shadow: 0 4px 0 rgba(43, 58, 85, .12); transition: transform .12s ease;
}
.avatar-opt.on { box-shadow: 0 0 0 4px var(--sun), 0 4px 0 rgba(43, 58, 85, .12); }
.avatar-opt:active { transform: scale(.9); }

/* ---------- saved-progress chips on the sign ---------- */
.progress { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px;
  font-size: 18px; font-weight: 600; color: var(--ink); background: #fff3c4;
  box-shadow: inset 0 0 0 2px rgba(242, 201, 76, .55);
}
.chip-i { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; font-size: 17px; }

/* ---------- island details: windmill, hen, clouds under the island ---------- */
.mill-blades { transform-box: fill-box; transform-origin: 50% 50%; animation: spin 7s linear infinite; }
.hen { transform-box: fill-box; transform-origin: 40% 100%; animation: peck 3.4s ease-in-out infinite; }
.under-cloud { opacity: .85; animation: under 19s linear infinite; }
.under-cloud.uc2 { opacity: .7; animation-duration: 25s; animation-delay: -11s; animation-direction: reverse; }
@keyframes peck {
  0%, 55%, 100% { transform: rotate(0); }
  62% { transform: rotate(16deg); } 67% { transform: rotate(5deg); }
  72% { transform: rotate(16deg); } 80% { transform: rotate(0); }
}
@keyframes under {
  0% { transform: translateX(-150px); opacity: 0; }
  12%, 88% { opacity: .85; }
  100% { transform: translateX(150px); opacity: 0; }
}

.noscript-banner {
  position: relative; z-index: 3; margin: 12px auto 0; max-width: min(640px, calc(100vw - 32px));
  padding: 14px 20px; border-radius: 22px; background: var(--paper); box-shadow: var(--shadow);
  text-align: center; font-size: 20px; line-height: 1.35;
}
.noscript-banner p { margin: 0; }
.noscript-banner p + p { margin-top: 6px; font-size: 16px; color: var(--ink-soft); }
.noscript { text-align: center; font-size: 24px; }
.noscript a { color: var(--ink); }

/* ---------- layouts ---------- */
/* Landscape tablets / desktop: big island left, cloudy archipelago right */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .world { flex-direction: row; align-items: center; justify-content: center; gap: clamp(20px, 4vw, 64px); }
  .island.live { --w: min(500px, 44vw, 62vh); }
  .soon-row { max-width: min(520px, 42vw); }
  .island.soon { --w: clamp(140px, min(19vw, 26vh), 230px); }
}
/* Short landscape screens (phones turned sideways) */
@media (max-height: 520px) and (orientation: landscape) {
  .top { padding-top: 8px; }
  .hero h1 { font-size: 24px; }
  .hero p { display: none; }
  .world { flex-direction: row; padding-bottom: 80px; }
  .island.live { --w: min(340px, 44vw, 58vh); }
  .island.soon { --w: clamp(96px, 16vw, 150px); }
  .soon-row { max-width: 52vw; }
  .sign { padding: 8px 14px 10px; }
  .play { min-height: 52px; font-size: 22px; }
}
/* Phones (portrait) */
@media (max-width: 600px) {
  .brand-name { font-size: 22px; }
  .brand img { width: 40px; height: 40px; }
  .brand { padding-right: 14px; }
  .lang { width: 48px; height: 48px; padding: 4px; }
  .langs { gap: 6px; }
  .sign { padding: 10px 16px 12px; }
  .play { font-size: 22px; min-height: 56px; }
  .age { font-size: 16px; }
  .sign.small { padding: 6px 6px 8px; border-radius: 14px; }
}
@media (max-width: 600px) {
  .avatar { width: 48px; height: 48px; font-size: 28px; }
  .who { gap: 8px; }
  .chip { font-size: 16px; padding: 3px 10px; }
}
@media (max-width: 440px) {
  .top { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); gap: 8px; }
  .brand { gap: 6px; padding-right: 12px; }
  .brand img { width: 34px; height: 34px; }
  .brand-name { font-size: 18px; }
  .avatar { width: 44px; height: 44px; font-size: 26px; }
  .lang { width: 44px; height: 44px; }
  .langs { gap: 4px; }
  .avatar-grid { grid-template-columns: repeat(3, 64px); gap: 8px; }
  .avatar-opt { width: 64px; height: 64px; font-size: 38px; }
}
@media (max-width: 380px) {
  .brand-name { font-size: 17px; }
  .lang { width: 42px; height: 42px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cloud { display: none; }
}
