/* ================================================================
   /fun/stick-figure  ·  /zh/fun/stick-figure
   Layout for the stick-figure motion lab page. The canvas paints its
   own violet stage; everything here is the frame around it.
   ================================================================ */

.fun-hero { padding: 62px 0 34px; }
.fun-hero .kicker {
  font-size: 12px; letter-spacing: .34em; text-indent: .34em;
  text-transform: uppercase; color: #b79ae0; margin-bottom: 10px;
}
.fun-hero h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(29px, 4.2vw, 42px); line-height: 1.24; letter-spacing: .015em;
}
.fun-hero .alt-name { margin-top: 8px; color: var(--text-dim); font-size: 15px; letter-spacing: .06em; }
.fun-hero p.lede { margin-top: 18px; max-width: 740px; color: var(--text-dim); font-size: 15.5px; }
.fun-hero .tags { margin-top: 18px; }

/* ---------- the stage ---------- */
/* On a phone the buttons sit under the stage so they never cover the figure;
   from tablet up they float over it. Full screen targets .stage-shell, which
   is why the buttons come along for the ride. */
.stage-section { padding: 0 0 90px; }
.stage-shell { position: relative; }
#stage-box {
  position: relative;
  height: min(60vh, 500px); min-height: 320px;
  border: 1px solid rgba(139, 106, 196, .26);
  border-radius: 20px; overflow: hidden;
  background: linear-gradient(160deg, #332a4a, #221b34 55%, #130f1e);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .55);
}
#stage { display: block; width: 100%; height: 100%; touch-action: manipulation; }

#hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 3; max-width: calc(100% - 32px); text-align: center;
  color: rgba(236, 231, 218, .5); font-size: 12.5px; letter-spacing: .09em;
  pointer-events: none;
}
#ui {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 3; display: flex; flex-wrap: wrap; justify-content: center; gap: 9px;
  max-width: calc(100% - 28px);
}
#ui button {
  background: rgba(19, 15, 30, .5);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #ece7da; border: 1.5px solid rgba(255, 255, 255, .4);
  padding: 9px 19px; border-radius: 999px;
  font-family: inherit; font-size: 13.5px; letter-spacing: .1em;
  cursor: pointer; transition: background .18s, color .18s, border-color .18s;
}
#ui button:hover { border-color: #fff; background: rgba(255, 255, 255, .12); }
#ui button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
#ui button.active { background: #fff; color: #14101d; border-color: #fff; }
#ui .util { border-color: rgba(212, 168, 92, .48); color: var(--gold-bright); letter-spacing: .06em; }
#ui .util:hover { background: rgba(212, 168, 92, .16); border-color: var(--gold); }

/* ---------- the three.js variant of the stage ---------- */
#stage-box.webgl {
  background: linear-gradient(180deg, #9db9cc 0%, #c8d6c4 55%, #7d8f72 100%);
  border-color: rgba(120, 168, 120, .3);
  cursor: pointer;                 /* 点哪走哪，光标先把这件事说出来 */
}
#stage-box canvas { display: block; width: 100%; height: 100%; }
/* the forest sky is bright, so the hint needs its own backing */
#stage-box.webgl + #ui,
.webgl #hint {
  color: #f2f7ff;
}
.webgl #hint {
  background: rgba(16, 26, 24, .42);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 7px 15px; border-radius: 999px;
  letter-spacing: .04em;
}
#loader {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; white-space: pre-wrap;
  background: linear-gradient(160deg, #1a2a25, #101a18);
  color: var(--text-dim); font-size: 14.5px; letter-spacing: .06em;
  transition: opacity .8s;
}
#loader.err { color: #ff9b9b; font-size: 13px; letter-spacing: 0; text-align: left; align-items: flex-start; }

.stage-shell:fullscreen { display: flex; flex-direction: column; background: #130f1e; }
.stage-shell:fullscreen #stage-box { flex: 1; height: auto; max-height: none; border-radius: 0; border: 0; }
.stage-shell:fullscreen #ui {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); margin: 0;
}
.stage-shell:fullscreen #hint { display: block; }

/* ---------- controls reference ---------- */
#controls { background: var(--bg-soft); }
.keys {
  max-width: 720px; margin: 0 auto;
  border: 1px solid var(--card-edge); border-radius: 16px; overflow: hidden;
}
.keys .row {
  display: grid; grid-template-columns: 108px 1fr; gap: 16px; align-items: baseline;
  padding: 14px 26px; font-size: 14.5px;
  border-bottom: 1px solid rgba(212, 168, 92, .1);
}
.keys .row:last-child { border-bottom: 0; }
.keys .row:nth-child(odd) { background: rgba(255, 255, 255, .017); }
.keys .v { color: var(--text-dim); }
kbd {
  display: inline-block; min-width: 26px; text-align: center;
  padding: 2px 8px; margin-right: 5px;
  font-family: var(--sans); font-size: 12.5px; color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(212, 168, 92, .3);
  border-bottom-width: 2px; border-radius: 6px;
}

/* keep the alternating band rhythm of the rest of the site */
#more { background: var(--bg-soft); }

/* ---------- 版权与使用 ---------- */
.rights-box {
  max-width: 720px; margin: 0 auto;
  border: 1px solid var(--card-edge); border-radius: 16px;
  padding: 30px 32px 28px;
  background: rgba(255, 255, 255, .017);
}
.rights-box p { color: var(--text-dim); font-size: 14.5px; margin-bottom: 14px; }
.rights-box p:last-child { margin-bottom: 0; }
.rights-box p.lead { color: var(--text); font-size: 15.5px; }
.rights-box p.credit {
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid rgba(212, 168, 92, .12);
  font-size: 13px;
}
.rights-box a { color: var(--gold); }
.rights-box a:hover { color: var(--gold-bright); }

@media (max-width: 760px) {
  .rights-box { padding: 24px 22px 22px; border-radius: 14px; }
}

.fun-note { max-width: 740px; margin: 26px auto 0; text-align: center; font-size: 13.5px; color: var(--text-dim); }
.fun-note a { color: var(--gold); }
.fun-note a:hover { color: var(--gold-bright); }

@media (max-width: 760px) {
  #stage-box { height: min(52vh, 400px); min-height: 280px; border-radius: 16px; }
  /* no keyboard on a phone — the Controls section below covers the keys */
  #hint { display: none; }
  #ui {
    position: static; transform: none; margin: 14px auto 0;
    max-width: none; gap: 8px;
  }
  #ui button { padding: 9px 15px; font-size: 13px; letter-spacing: .06em; }
  .keys .row { grid-template-columns: 1fr; gap: 4px; padding: 13px 20px; }
}
