@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap');
:root {
  --bg: #fff3d6; --card: #ffffff; --ink: #1f2a44; --muted: #55607c; --line: #1f2a44; --outline: #1f2a44;
  --coral: #ff6b4a; --coral-d: #d9441f; --mint: #3cc5a0; --sun: #ffc83d; --sky: #4aa8ff; --pink: #ff4f9a; --gold: #c9a24a;
  --shadow: 5px 5px 0 var(--outline);
  --r: 22px;
  --font: "Fredoka", "Baloo 2", ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1b2140; --card: #262e55; --ink: #fff3d6; --muted: #bcc3e0; --line: #fff3d6; --outline: #0e1226; }
}
:root[data-theme="dark"] { --bg: #1b2140; --card: #262e55; --ink: #fff3d6; --muted: #bcc3e0; --line: #fff3d6; --outline: #0e1226; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); font: 500 18px/1.6 var(--font);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--sun) 35%, transparent) 0 70px, transparent 71px), radial-gradient(circle at 88% 8%, color-mix(in srgb, var(--mint) 30%, transparent) 0 90px, transparent 91px), radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--pink) 22%, transparent) 0 110px, transparent 111px);
  background-attachment: fixed;
}
a { color: var(--coral-d); font-weight: 600; }
img { max-width: 100%; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

header.top { position: sticky; top: 0; z-index: 20; background: var(--sun); border-bottom: 4px solid var(--outline); }
header.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 28px; color: #1f2a44; text-decoration: none; letter-spacing: .5px; line-height: 1; }
.brand img { width: 46px; height: 46px; transition: transform .25s; }
.brand:hover img { transform: rotate(-12deg) scale(1.12); }
.brand i { font-style: normal; color: #d9441f; }
nav.main { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
nav.main a { color: #1f2a44; text-decoration: none; padding: 5px 12px; border-radius: 999px; font-size: 16px; font-weight: 600; border: 3px solid transparent; }
nav.main a:hover { background: #fff; border-color: #1f2a44; transform: rotate(-2deg); }
nav.main a.on { background: #1f2a44; color: #fff3d6; }
.lang { border: 3px solid #1f2a44; background: #fff; color: #1f2a44; border-radius: 999px; padding: 3px 12px; font: 600 14px var(--font); cursor: pointer; box-shadow: 2px 2px 0 #1f2a44; }
.lang:hover { transform: translateY(-1px) rotate(2deg); }

.hero { padding: 40px 0 18px; text-align: center; position: relative; }
.hero .mascot { width: clamp(120px, 22vw, 190px); animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(5px 6px 0 rgba(31, 42, 68, .25)); cursor: pointer; }
.hero .mascot:hover { animation: wiggle .5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-12px) rotate(4deg); } }
@keyframes wiggle { 25% { transform: rotate(-10deg) scale(1.08); } 75% { transform: rotate(10deg) scale(1.08); } }
.hero h1 { font-size: clamp(34px, 7vw, 64px); line-height: 1.15; margin: 6px 0 24px; font-weight: 700; letter-spacing: .5px; }
.hero h1 .w1 { color: var(--coral); } .hero h1 .w2 { color: var(--sky); } .hero h1 .w3 { color: var(--mint); }
.hero h1 .sq { text-decoration: underline wavy var(--sun) 5px; text-underline-offset: 10px; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto 22px; font-size: 20px; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; width: 16px; height: 16px; border: 3px solid var(--outline); animation: floaty 6s ease-in-out infinite; opacity: .9; }
.confetti i:nth-child(1) { left: 8%; top: 24%; background: var(--coral); border-radius: 50%; }
.confetti i:nth-child(2) { left: 18%; top: 62%; background: var(--sky); transform: rotate(20deg); animation-delay: -1s; }
.confetti i:nth-child(3) { right: 10%; top: 30%; background: var(--mint); border-radius: 50%; animation-delay: -2s; }
.confetti i:nth-child(4) { right: 20%; top: 66%; background: var(--sun); transform: rotate(-15deg); animation-delay: -3s; }
.confetti i:nth-child(5) { left: 36%; top: 8%; background: var(--pink); border-radius: 50% 0; animation-delay: -4s; }
.confetti i:nth-child(6) { right: 34%; top: 10%; background: var(--sky); border-radius: 50%; width: 11px; height: 11px; animation-delay: -5s; }
@keyframes floaty { 50% { transform: translateY(-14px) rotate(25deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.btn { display: inline-block; background: var(--coral); color: #fff; border: 4px solid var(--outline); border-radius: 999px; padding: 10px 26px; font: 700 18px var(--font); text-decoration: none; cursor: pointer; box-shadow: 4px 4px 0 var(--outline); transition: transform .12s, box-shadow .12s; margin: 4px; }
.btn:hover { transform: translate(-2px, -2px) rotate(-1.5deg); box-shadow: 6px 6px 0 var(--outline); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--outline); }
.btn.alt { background: var(--sun); color: #1f2a44; }
.btn.ok { background: var(--mint); color: #063b2e; } .btn.no { background: #ffd2c8; color: #7a1d0b; }
.btn[disabled] { opacity: .5; cursor: default; }

section.block { padding: 26px 0; }
section.block h2, h2.fun { font-size: 32px; margin: 0 0 16px; display: inline-block; background: var(--card); border: 4px solid var(--outline); border-radius: 16px; padding: 2px 18px; box-shadow: 4px 4px 0 var(--outline); transform: rotate(-1.5deg); }
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.card { background: var(--card); border: 4px solid var(--outline); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.grid > .card:nth-child(odd) { transform: rotate(-.8deg); } .grid > .card:nth-child(even) { transform: rotate(.9deg); }
.grid > .card:hover { transform: rotate(0) translateY(-4px); box-shadow: 8px 10px 0 var(--outline); }
.card h3 { margin: 0 0 4px; font-size: 22px; }
.card p { margin: 6px 0 0; color: var(--muted); font-size: 16px; }
.app { display: flex; gap: 14px; }
.app img { width: 76px; height: 76px; border-radius: 20px; flex: none; border: 4px solid var(--outline); }
.app .ph { width: 76px; height: 76px; border-radius: 20px; flex: none; border: 4px dashed var(--outline); display: grid; place-items: center; font-size: 32px; background: var(--sun); }
.tag { display: inline-block; font-size: 13px; padding: 0 10px; border-radius: 999px; background: var(--mint); color: #063b2e; font-weight: 700; border: 3px solid var(--outline); }
.tag.soon { background: var(--sun); color: #5a3d00; }
.news .date { color: var(--coral-d); font-size: 14px; font-weight: 700; }

.banner { position: relative; overflow: hidden; border-radius: 30px; border: 5px solid var(--outline); background: #1a1209; color: #fff; min-height: 320px; display: grid; align-items: end; box-shadow: 8px 8px 0 var(--outline); }
.banner img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner .in { position: relative; padding: 26px; background: linear-gradient(transparent, rgba(20, 12, 30, .85)); }
section.block .banner h2 { margin: 0 0 6px; font-size: 34px; display: block; background: none; border: 0; box-shadow: none; transform: none; padding: 0; color: #fff; }
.banner p { margin: 0 0 14px; max-width: 560px; color: #ffe9bf; }
.marquee { overflow: hidden; background: var(--outline); color: var(--sun); border-block: 4px solid var(--outline); white-space: nowrap; margin: 22px 0; transform: rotate(-1deg); }
.marquee span { display: inline-block; padding: 8px 0; font-weight: 700; font-size: 20px; animation: slide 28s linear infinite; }
@keyframes slide { to { transform: translateX(-50%); } }

footer { margin-top: 40px; border-top: 4px solid var(--outline); padding: 24px 0 40px; color: var(--muted); font-size: 15px; background: color-mix(in srgb, var(--sun) 25%, transparent); }

/* forms (submit / status) */
.form { max-width: 640px; margin: 0 auto; }
.field { margin: 16px 0; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; }
.field input[type=text], .field input[type=email], .field input[type=file] { width: 100%; padding: 10px 14px; border: 3px solid var(--outline); border-radius: 16px; background: var(--card); color: var(--ink); font: inherit; }
.field input:focus { outline: 4px solid color-mix(in srgb, var(--sky) 55%, transparent); }
.hint { color: var(--muted); font-size: 15px; }
.preview { display: none; gap: 14px; align-items: center; background: var(--card); border: 4px solid var(--outline); border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
.preview img { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 14px; border: 3px solid var(--outline); }
.msg { padding: 12px 16px; border-radius: 16px; margin: 12px 0; border: 3px solid var(--outline); font-weight: 600; }
.msg.err { background: #ffd2c8; color: #7a1d0b; } .msg.ok { background: #bff0de; color: #07503d; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; padding: 0; list-style: none; }
.steps li { padding: 4px 12px; border-radius: 999px; background: var(--card); border: 3px solid var(--outline); font-size: 14px; color: var(--muted); font-weight: 600; }
.steps li.done { background: var(--mint); color: #063b2e; }
.steps li.now { background: var(--sun); color: #5a3d00; transform: rotate(-2deg) scale(1.06); }
.steps li.bad { background: #ffd2c8; color: #7a1d0b; }
.copybox { display: flex; gap: 8px; } .copybox input { flex: 1; min-width: 0; }
input.code { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 17px; letter-spacing: .5px; padding: 10px 14px; border: 3px solid var(--outline); border-radius: 16px; background: var(--card); color: var(--ink); }
.field .copybox .btn { margin: 0; white-space: nowrap; }

/* how to export the file (submit page) */
.howto { margin-bottom: 26px; }
.howsteps { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 18px; }
.howsteps li { background: var(--card); border: 4px solid var(--outline); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.hs-text { display: flex; gap: 12px; align-items: flex-start; font-weight: 600; margin-bottom: 10px; }
.hs-n { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--coral); color: #fff; border: 3px solid var(--outline); display: grid; place-items: center; font-weight: 700; }
.howsteps img { width: 100%; height: auto; border-radius: 14px; border: 3px solid var(--outline); display: block; }

/* store download badges (home, app cards) */
.stores { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.store { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 3px solid var(--outline); border-radius: 14px; background: #1f2a44; color: #fff3d6; text-decoration: none; font-weight: 700; font-size: 15px; line-height: 1.2; box-shadow: 3px 3px 0 var(--outline); transition: transform .12s; }
a.store:hover { transform: translate(-2px, -2px) rotate(-1.5deg); box-shadow: 5px 5px 0 var(--outline); }
.store small { display: block; font-size: 11px; font-weight: 600; opacity: .85; }
.store.off { background: repeating-linear-gradient(45deg, transparent 0 8px, color-mix(in srgb, var(--outline) 12%, transparent) 8px 16px), var(--card); color: var(--muted); border-style: dashed; box-shadow: none; }

/* exhibition hall: a bright gallery wall, one live framed scene hanging on top, small identical frames below */
body.hall2 { --ink: #1f2a44; --muted: #55607c; --card: #ffffff; --outline: #1f2a44; color: #1f2a44;
  background-color: #bfe6ff; background-image: radial-gradient(circle, rgba(255, 255, 255, .8) 0 5px, transparent 6px), radial-gradient(circle, rgba(255, 255, 255, .5) 0 5px, transparent 6px); background-size: 52px 52px; background-position: 0 0, 26px 26px; background-attachment: fixed; }
.hallpage { padding-top: 6px; }
.hang { display: block; width: 62%; max-width: 560px; height: 62px; margin: 0 auto -6px; position: relative; z-index: 1; }
/* the frame: warm wood with a bevel, an outline like the rest of the site, corner screws, a pale mat and a recessed picture */
.gframe, .pframe { border: 5px solid #1f2a44; border-radius: 12px; background-color: #ffb020;
  background-image: radial-gradient(circle, #fff6c9 0 2.5px, #b86a00 3px 5.5px, transparent 6px), radial-gradient(circle, #fff6c9 0 2.5px, #b86a00 3px 5.5px, transparent 6px), radial-gradient(circle, #fff6c9 0 2.5px, #b86a00 3px 5.5px, transparent 6px), radial-gradient(circle, #fff6c9 0 2.5px, #b86a00 3px 5.5px, transparent 6px), linear-gradient(145deg, #ffd84d 0%, #ffb020 50%, #ff9a1f 100%);
  background-repeat: no-repeat; background-size: 14px 14px, 14px 14px, 14px 14px, 14px 14px, 100% 100%;
  background-position: 6px 6px, calc(100% - 6px) 6px, 6px calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), 0 0;
  box-shadow: inset 4px 4px 0 rgba(255, 255, 255, .65), inset -5px -5px 0 rgba(150, 70, 0, .35), 7px 9px 0 rgba(31, 42, 68, .3); }
.gframe { position: relative; padding: 24px; }
.stage { position: relative; background: #1a1209; border: 5px solid #1f2a44; border-radius: 3px; overflow: hidden; aspect-ratio: 16 / 9; max-height: 72vh; width: 100%; box-shadow: 0 0 0 7px #fff3c4, inset 0 0 30px rgba(0, 0, 0, .6); }
.stage iframe, .stage .poster { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage .poster { object-fit: cover; transition: opacity .6s; filter: brightness(.85); z-index: 1; }   /* the picture of the scene covers the viewer until everything is loaded */
.stage.ready .poster, .stage.ready .loading { opacity: 0; pointer-events: none; }
.stage iframe { pointer-events: none; }   /* a click activates the scene; until then the wheel and touch scroll the page instead of zooming the scene */
.stage.active iframe, .stage:fullscreen iframe, .stage.pseudo iframe { pointer-events: auto; }
.stage .loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(78%, 420px); background: #fff; color: #1f2a44; border: 4px solid #1f2a44; padding: 12px 18px; border-radius: 22px; font-size: 17px; font-weight: 700; text-align: center; box-shadow: 5px 5px 0 #1f2a44; transition: opacity .4s; z-index: 2; }
.pbar { height: 18px; margin-top: 8px; border: 3px solid #1f2a44; border-radius: 999px; background: #fff3d6; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, #ff6b4a 0 12px, #ffc83d 12px 24px); transition: width .25s; }
.stage .bar { position: absolute; right: 10px; top: 10px; display: flex; gap: 8px; z-index: 3; }
.stage .bar button { background: #fff; color: #1f2a44; border: 3px solid #1f2a44; border-radius: 999px; padding: 3px 14px; font: 700 14px var(--font); cursor: pointer; box-shadow: 2px 2px 0 #1f2a44; }
.stage .bar button:hover { background: #ffc83d; }
.stage .hint2 { position: absolute; left: 10px; bottom: 10px; z-index: 3; background: #fff; color: #1f2a44; border: 3px solid #1f2a44; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; pointer-events: none; }
.stage .xfs { display: none; }
.stage:fullscreen, .stage.pseudo { position: fixed; inset: 0; z-index: 100; max-height: none; width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
.stage:fullscreen .xfs, .stage.pseudo .xfs { display: inline-block; }
.stage:fullscreen .fsb, .stage.pseudo .fsb { display: none; }
.plaque { margin: 22px auto 0; max-width: 640px; text-align: center; background: #fffdf4; border: 4px solid #1f2a44; border-radius: 14px; padding: 10px 18px; box-shadow: 5px 5px 0 #1f2a44; transform: rotate(-.6deg); }
.plaque h1 { margin: 0; font-size: 28px; }
.plaque .info { color: var(--muted); font-size: 16px; }
.plaque .btn { margin-top: 6px; padding: 6px 20px; font-size: 16px; }
.hallpage h2 { display: inline-block; font-size: 24px; margin: 34px 0 14px; background: #fff; border: 4px solid #1f2a44; border-radius: 16px; padding: 0 16px; box-shadow: 4px 4px 0 #1f2a44; transform: rotate(-1deg); color: #1f2a44; }
.onshow { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.piece, .mframe { padding: 12px 12px 14px; border-radius: 10px; }
.piece { border: 5px solid #1f2a44; cursor: pointer; text-align: center; color: #1f2a44; font: inherit; transition: transform .15s; }
.piece:hover { transform: rotate(-1.5deg) translateY(-3px); }
.piece img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; display: block; border: 3px solid #1f2a44; box-shadow: inset 0 0 10px rgba(0, 0, 0, .25); }
.piece b { display: block; margin-top: 6px; font-size: 15px; }
.piece small { display: block; font-size: 12px; opacity: .85; }
.rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; align-items: start; }
.mini { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-align: center; padding: 0; position: relative; }
.mframe { border: 5px solid #1f2a44; transition: transform .2s; }
.mini:hover .mframe, .mini:focus-visible .mframe { transform: rotate(-1.5deg) translateY(-4px); }
.mframe img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: #222; border: 3px solid #1f2a44; box-shadow: inset 0 0 10px rgba(0, 0, 0, .4); }
.mini .nm { margin-top: 10px; font-weight: 700; font-size: 17px; color: #1f2a44; }
.mini .ct { font-size: 13px; color: var(--muted); }
.mini .avs { display: flex; justify-content: center; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.mini .avs img { width: 28px; height: 28px; border-radius: 6px; background: #fff; object-fit: contain; border: 2px solid #1f2a44; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .75); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal.on { display: flex; }
.sheet { background: var(--card); color: var(--ink); border-radius: 22px; max-width: 560px; width: 100%; max-height: 92vh; overflow: auto; padding: 20px; position: relative; text-align: center; }
.sheet .x { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 26px; color: var(--ink); cursor: pointer; }
.sheet img.big { width: 100%; max-height: 60vh; object-fit: contain; background: #fff; border-radius: 12px; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  header.top .wrap { flex-wrap: wrap; padding-block: 6px; gap: 4px; }
  .brand { font-size: 24px; } .brand img { width: 38px; height: 38px; }
  nav.main { margin-left: 0; width: 100%; justify-content: center; }
  nav.main a { padding: 3px 9px; font-size: 15px; }
  .stage { aspect-ratio: 4 / 3; }
  .gframe { padding: 14px; }
  .stage { box-shadow: 0 0 0 5px #fff3c4, inset 0 0 20px rgba(0, 0, 0, .6); }
  .hero { padding-top: 24px; }
  .card { padding: 14px; }
  .btn { padding: 8px 20px; font-size: 16px; }
}

/* keyboard focus is always visible */
:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; border-radius: 6px; }
@media (max-width: 640px) {
  .lang { min-height: 40px; padding: 6px 16px; }
  nav.main a { padding: 8px 12px; }
  footer a { display: inline-block; padding: 9px 2px; }
  .stage .bar button { min-height: 40px; padding: 8px 16px; }
  .card a, .doc a, .toc a { padding: 6px 0; display: inline-block; }
}
