/* The link page, in the game's style: chunky rounded buttons with a dark outline and a bottom shadow, Lilita One,
   text in the ink or in white only (one solid colour, no outline, stroke or shadow), the sky gradient. */
@font-face {
  font-family: "Lilita One";
  src: url("/fonts/lilita-one-latin.woff2?v=1") format("woff2");
  font-display: block;
}

:root {
  --ink: #1c2b4a;
  --white: #fff;
  --sky-top: #38a8ee;
  --sky-mid: #6fcbf8;
  --sky-bottom: #bfeaff;
  --panel: #fff3a8;
  --line: 5px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--sky-mid); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  font-weight: bold;
  letter-spacing: -0.03em;
  color: var(--ink);
  background: var(--sky-mid);
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  padding: calc(var(--safe-t) + 14px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 28px) calc(var(--safe-l) + 16px);
  background:
    radial-gradient(ellipse 85% 14% at 50% 100%, #7ad65a 0%, #7ad65a 62%, transparent 63%),
    linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-bottom) 100%);
}

/* Clouds drift behind everything. */
.cloud {
  position: absolute;
  z-index: 0;
  width: 120px; height: 38px;
  border-radius: 999px;
  background: var(--white);
  opacity: 0.85;
  pointer-events: none;
  animation: drift 60s linear infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: var(--white); border-radius: 50%; }
.cloud::before { width: 54px; height: 54px; left: 16px; top: -28px; }
.cloud::after { width: 40px; height: 40px; left: 62px; top: -20px; }
.cloud.c1 { top: 9%; left: -160px; }
.cloud.c2 { top: 41%; left: -160px; animation-duration: 85s; animation-delay: -40s; transform: scale(0.7); }
@keyframes drift { to { translate: calc(100vw + 320px) 0; } }
@media (prefers-reduced-motion: reduce) { .cloud { animation: none; left: 62%; } .cloud.c2 { left: 6%; } }

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.top { width: 100%; display: flex; flex-direction: column; align-items: center; }

.logo { margin: 0; width: min(76vw, 320px); }
.logo img { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 0 rgba(28, 43, 74, 0.28)); }

/* The island: a framed picture, like the game's cards. Its height follows the screen so the panel stays in view. */
.hero {
  width: 100%;
  height: clamp(110px, 23vh, 230px);
  margin-top: 10px;
  border: var(--line) solid var(--ink);
  border-radius: 28px;
  overflow: hidden;
  background: var(--sky-bottom);
  box-shadow: 0 6px 0 var(--ink);
}
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; }

/* The panel: the game's cream popup body with a ribbon on top. */
.panel {
  position: relative;
  width: 100%;
  margin-top: 34px;
  padding: 34px 16px 16px;
  border: var(--line) solid var(--ink);
  border-radius: 28px;
  background: linear-gradient(to bottom, #fff9c9 0%, var(--panel) 100%);
  box-shadow: 0 8px 0 var(--ink), 0 14px 18px rgba(28, 43, 74, 0.28);
}
.ribbon {
  position: absolute;
  left: 50%; top: -25px;
  transform: translateX(-50%);
  margin: 0;
  min-width: 200px;
  padding: 7px 22px 5px;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(to bottom, #d23a46 0%, #a9232f 100%);
  box-shadow: 0 5px 0 var(--ink);
  color: var(--white);
  font-size: clamp(19px, 6.4vw, 26px);
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

/* The code: a fixed-size box, so the page never moves whatever the code is. */
.code-row { display: flex; gap: 10px; align-items: stretch; margin-bottom: 14px; }
.code-box {
  flex: 1 1 auto;
  min-width: 0;
  height: 86px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 4px solid var(--ink);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 4px 0 rgba(28, 43, 74, 0.12);
}
.code-label { font-size: 15px; line-height: 1; letter-spacing: 0; }
.code {
  margin-top: 4px;
  font-size: clamp(28px, 9.4vw, 44px); line-height: 1;
  letter-spacing: 0.08em;
  padding-left: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  -webkit-user-select: all; user-select: all;
}
.kind-course .code { font-size: clamp(16px, 10vw - 14px, 27px); letter-spacing: 0.02em; padding-left: 0.02em; }

/* Buttons: dark outline, bottom shadow, gradient fill. They press down on a tap. */
.btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60px;
  padding: 6px 14px 4px;
  border: var(--line) solid var(--ink);
  border-radius: 22px;
  color: var(--ink);
  font: inherit;
  font-size: 26px; line-height: 1.1;
  letter-spacing: -0.03em;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  box-shadow: 0 6px 0 var(--ink), inset 0 4px 0 rgba(255, 255, 255, 0.5), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink), inset 0 4px 0 rgba(255, 255, 255, 0.5), inset 0 -4px 0 rgba(0, 0, 0, 0.12); }
.btn:focus-visible { outline: 4px solid var(--white); outline-offset: 3px; }
.btn-green { background: linear-gradient(to bottom, #86e87a 0%, #2fb84a 100%); }
.btn-yellow { background: linear-gradient(to bottom, #ffe97a 0%, #ffc928 45%, #ffa028 100%); }
.btn-blue { background: linear-gradient(to bottom, #a8e2ff 0%, #3ea0f0 100%); }
.btn small { display: block; font-size: 13px; line-height: 1; letter-spacing: 0; margin-bottom: 2px; }

/* COPY: fixed width and height. COPY and COPIED sit in the same cell, so nothing moves when the word changes. */
.btn-copy { flex: 0 0 100px; min-height: 0; padding: 0 4px; display: grid; place-items: center; font-size: 23px; }
.btn-copy .lbl { grid-area: 1 / 1; }
.btn-copy .lbl-done { visibility: hidden; }
.btn-copy.is-done .lbl-copy { visibility: hidden; }
.btn-copy.is-done .lbl-done { visibility: visible; }
.btn-copy.is-done { background: linear-gradient(to bottom, #ffe97a 0%, #ffc928 45%, #ffa028 100%); }

.btn-open { margin-bottom: 14px; min-height: 66px; font-size: 30px; display: none; }
.android .btn-open { display: flex; }
.android .btn-open[hidden] { display: none !important; }

.stores { display: flex; flex-direction: column; gap: 14px; }
.store { min-height: 64px; }
.ios .store-play, .android .store-app { display: none; }

.how {
  margin: 14px 4px 4px;
  font-size: 19px; line-height: 1.45;
  text-align: center;
  letter-spacing: -0.01em;
}
.how .line { display: block; }
.chip {
  display: inline-block;
  margin: 0 1px;
  padding: 1px 9px 0;
  border-radius: 999px;
  background: linear-gradient(to bottom, #3a4d80 0%, #26345a 100%);
  color: var(--white);
  font-size: 0.9em; line-height: 1.35;
  letter-spacing: 0;
  white-space: nowrap;
}
.studio { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.copy-sink { position: fixed; left: -9999px; top: 0; opacity: 0; }

/* With scripts on, the panel waits for its words (no flash of the generic text). */
.js[data-page="invite"]:not(.ready) .panel { visibility: hidden; }

/* Tablets and computers: the same page, bigger. */
@media (min-width: 700px) {
  .wrap { max-width: 520px; }
  .logo { width: 400px; }
  .hero { height: clamp(160px, 28vh, 300px); }
  .panel { padding: 38px 22px 22px; }
  .stores { flex-direction: row; }
  .stores .store { flex: 1 1 0; }
  .how { font-size: 22px; }
}

/* Wide and short (a computer window, a tablet or a phone on its side): the logo and the picture on the left, the panel
   on the right, the whole thing centred. */
@media (orientation: landscape) and (min-width: 560px) {
  .stage { display: flex; align-items: center; padding-top: calc(var(--safe-t) + 14px); }
  .wrap { max-width: 980px; flex-direction: row; align-items: center; gap: 36px; }
  .top { flex: 1 1 0; min-width: 0; }
  .panel { flex: 1 1 0; min-width: 0; margin-top: 30px; }
  .logo { width: min(100%, 380px); }
  .hero { height: clamp(170px, 40vh, 340px); }
}

/* A phone on its side is short: everything shrinks to fit without scrolling, and the first line of help goes. */
@media (orientation: landscape) and (max-height: 520px) {
  .stage { padding-bottom: calc(var(--safe-b) + 14px); padding-top: calc(var(--safe-t) + 8px); }
  .wrap { gap: 28px; }
  .logo { width: min(100%, 290px); }
  .hero { height: clamp(90px, 33vh, 150px); margin-top: 8px; }
  .panel { margin-top: 28px; padding: 28px 16px 14px; }
  .ribbon { top: -23px; font-size: 24px; padding-top: 5px; padding-bottom: 3px; }
  .code-box { height: 68px; }
  .code-label { font-size: 13px; }
  .code { margin-top: 2px; font-size: clamp(28px, 6vh, 38px); }
  .kind-course .code { font-size: clamp(18px, 4.4vh, 24px); }
  .code-row, .btn-open { margin-bottom: 10px; }
  .btn { min-height: 52px; }
  .btn-open { min-height: 56px; font-size: 26px; }
  .store { min-height: 54px; }
  .store small { display: none; }
  .how { margin: 10px 4px 2px; font-size: 16px; line-height: 1.35; }
  .how .line:first-child { display: none; }
}
