.ll-game {
  --ll-ink: #fdf3e3;
  --ll-muted: #a79bb8;
  --ll-gold: #ffc66b;
  --ll-ember: #ff8a4c;
  --ll-line: #c9b8e626;
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
  color: var(--ll-ink);
  background: #0c0a1d;
  font-family: Inter, "Noto Sans", system-ui, sans-serif;
  color-scheme: dark;
}
.ll-game * { box-sizing: border-box; }
.ll-game [hidden] { display: none !important; }
.ll-game button,
.ll-game a { -webkit-tap-highlight-color: transparent; }
.ll-game button { font: inherit; color: inherit; cursor: pointer; }
.ll-game a { color: inherit; text-decoration: none; }
.ll-game button:focus-visible,
.ll-game a:focus-visible { outline: 2px solid var(--ll-gold); outline-offset: 3px; }
.ll-game button:disabled { opacity: .5; cursor: default; }

.ll-shell {
  height: 100%;
  max-width: 1280px;
  margin: auto;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Header */
.ll-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--ll-line);
  flex-shrink: 0;
}
.ll-brand { display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: 2px; white-space: nowrap; }
.ll-brand b { font-weight: 500; color: var(--ll-muted); }
.ll-emblem {
  width: 18px;
  height: 22px;
  border-radius: 45% / 38%;
  background: radial-gradient(circle at 50% 60%, #ffd98a, #ff8a4c 55%, #c8402f);
  box-shadow: 0 0 14px #ff8a4c66;
}
.ll-stats { display: flex; align-items: center; gap: 36px; }
.ll-label { display: block; margin-bottom: 4px; font-size: 9px; font-weight: 600; letter-spacing: 2px; color: var(--ll-muted); }
.ll-stats strong { font: 500 20px/1.2 "Noto Sans Mono", monospace; font-variant-numeric: tabular-nums; }
.ll-lives { display: flex; gap: 7px; height: 24px; align-items: center; }
.ll-lives i {
  width: 11px;
  height: 15px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: var(--ll-ember);
  box-shadow: 0 0 8px #ff8a4c80;
  transition: background .2s, box-shadow .2s;
}
.ll-lives i.is-lost { background: #3a3350; box-shadow: none; }
.ll-controls { display: flex; gap: 8px; align-items: center; }
.ll-controls button,
.ll-controls a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  min-width: 36px;
  border: 1px solid var(--ll-line);
  border-radius: 8px;
  background: #1a153066;
  color: #c9bfd8;
  font-size: 18px;
}
.ll-controls button:first-child { font-size: 11px; padding: 0 11px; }
.ll-controls button:hover,
.ll-controls a:hover { border-color: #c9b8e666; color: var(--ll-ink); }

.ll-progress { padding: 10px 28px 0; flex-shrink: 0; }
.ll-progress-caption {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font: 10px "Noto Sans Mono", monospace;
  letter-spacing: 1px;
  color: var(--ll-muted);
}
.ll-meter { height: 5px; overflow: hidden; border-radius: 3px; background: #ffc66b24; }
.ll-meter i {
  display: block;
  height: 100%;
  background: var(--ll-gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease-out;
}

/* Sky */
.ll-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  outline: none;
  background:
    radial-gradient(1px 1px at 12% 22%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 31% 9%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 47% 31%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 14%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 27%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 8%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 48%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 52%, #fff5 50%, transparent 51%),
    radial-gradient(ellipse at 50% 115%, #5a2a4a 0%, #2a1840 38%, transparent 70%),
    linear-gradient(#0c0a1d, #171233);
}
.ll-sky { position: absolute; inset: 0; pointer-events: none; }
.ll-limit {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  border-top: 1px dashed #c9b8e633;
  transition: border-color .3s, box-shadow .3s;
}
.ll-stage.is-danger .ll-limit { border-top-color: #ff6a5acc; box-shadow: 0 0 22px 3px #ff6a5a66; }
.ll-far {
  position: absolute;
  width: 7px;
  height: 9px;
  border-radius: 45% / 38%;
  background: radial-gradient(circle at 50% 60%, #ffe6a8, #ff9a52);
  box-shadow: 0 0 10px 2px #ff9a5266;
  transform: scale(var(--ll-far-scale, 1));
  animation: ll-far-in 1.4s ease-out both, ll-far-drift 7s ease-in-out 1.4s infinite alternate;
}
@keyframes ll-far-in { from { opacity: 0; transform: translateY(60px) scale(var(--ll-far-scale, 1)); } }
@keyframes ll-far-drift { to { transform: translateY(-7px) scale(var(--ll-far-scale, 1)); } }

.ll-flight {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  display: grid;
  grid-template-columns: repeat(var(--ll-cols, 4), minmax(0, 146px));
  justify-content: center;
  justify-items: center;
  gap: 10px 26px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px;
  will-change: transform;
}

/* Lantern */
.ll-lantern {
  position: relative;
  width: 100%;
  max-width: 146px;
  padding: 9px 0 20px;
  border: 0;
  background: none;
  transition: transform .15s;
}
.ll-flight .ll-lantern:nth-child(even) { top: 12px; }
.ll-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1.04;
  border: 1px solid #ffb48a59;
  border-radius: 44% / 36%;
  background:
    repeating-linear-gradient(90deg, transparent 0 15%, #0000001a 15% 16.5%),
    radial-gradient(ellipse at 50% 62%, #f08a4a 0%, #c9472f 48%, #8a2a26 100%);
  box-shadow: 0 0 26px #ff7a4026, inset 0 -10px 22px #5a141480;
  transition: box-shadow .15s, border-color .15s, filter .15s;
}
/* Caps and tassel */
.ll-body::before,
.ll-body::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 46%;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(#e2b25c, #9a6a25);
  transform: translateX(-50%);
}
.ll-body::before { top: -6px; }
.ll-body::after { bottom: -6px; }
.ll-lantern::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(#e2b25c, #c9472f);
  transform: translateX(-50%);
}
.ll-word {
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-weight: 600;
  font-size: 42px;
  line-height: 1;
  color: #fff6de;
  text-shadow: 0 1px 6px #5a1414cc;
  white-space: nowrap;
}
.ll-lantern[data-len="2"] .ll-word { font-size: 36px; }
.ll-lantern[data-len="3"] .ll-word { font-size: 28px; }
.ll-lantern[data-len="4"] .ll-word { font-size: 23px; }
/* Flip levels: the lantern carries a meaning. */
.ll-lantern.is-meaning .ll-word {
  padding: 0 9px;
  font: 600 17px/1.2 Inter, "Noto Sans", system-ui, sans-serif;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
.ll-key {
  position: absolute;
  top: 0;
  right: 6px;
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0c0a1dcc;
  color: var(--ll-muted);
  font: 10px/18px "Noto Sans Mono", monospace;
  text-align: center;
}
@media (hover: hover) and (pointer: fine) {
  .ll-key { display: block; }
  .ll-flight .ll-lantern:hover .ll-body { border-color: #ffd9a8; box-shadow: 0 0 34px #ff9a5266, inset 0 -10px 22px #5a141480; }
}
.ll-flight .ll-lantern:active { transform: scale(.96); }
.ll-lantern.is-entering { animation: ll-enter .3s ease-out both; }
@keyframes ll-enter { from { transform: translateY(30px) scale(.94); } }
.ll-lantern.is-wrong .ll-body { filter: saturate(.35) brightness(.7); border-color: #ff6a5a; }
.ll-lantern.is-wrong { animation: ll-shake .32s; }
@keyframes ll-shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}
.ll-lantern.is-answer .ll-body {
  border-color: #ffe6a8;
  box-shadow: 0 0 0 3px #ffe6a8, 0 0 40px #ffc66bb3, inset 0 -10px 22px #5a141480;
}
/* After a miss the sky waits for a tap on the answer. */
.ll-stage.is-review .ll-flight .ll-lantern:not(.is-answer) { opacity: .4; pointer-events: none; }
.ll-stage.is-review .ll-lantern.is-answer .ll-body { animation: ll-answer .8s ease-in-out infinite alternate; }
@keyframes ll-answer { to { box-shadow: 0 0 0 6px #ffe6a8, 0 0 60px 8px #ffc66b, inset 0 -10px 22px #5a141480; } }
.ll-ghost { position: absolute; margin: 0; pointer-events: none; }
.ll-ghost .ll-key { display: none; }
.ll-ghost.is-launching { animation: ll-launch 1.1s cubic-bezier(.4, 0, .7, .4) both; }
.ll-ghost.is-launching .ll-body {
  border-color: #fff1c4;
  background: radial-gradient(ellipse at 50% 62%, #fff3bf 0%, #ffb648 45%, #e8632e 100%);
  box-shadow: 0 0 60px 10px #ffc66b99;
}
@keyframes ll-launch {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  18% { transform: translateY(6px) scale(1.06); opacity: 1; }
  100% { transform: translateY(-110vh) scale(.5); opacity: .6; }
}
.ll-ghost.is-fading { animation: ll-fade .55s ease-in both; }
@keyframes ll-fade { to { transform: translateY(28px); opacity: 0; filter: saturate(0) brightness(.5); } }

.ll-banner {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%);
  padding: 10px 26px;
  border: 1px solid #ffc66b66;
  border-radius: 8px;
  background: #0c0a1de6;
  color: var(--ll-gold);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation: ll-enter .3s ease-out both;
}

/* Clue */
.ll-console { flex-shrink: 0; padding: 0 18px 16px; border-top: 1px solid var(--ll-line); background: #0c0a1d; }
.ll-receipt { display: flex; flex-direction: column; justify-content: center; height: 54px; font-size: 14px; }
.ll-receipt-row { display: flex; align-items: baseline; justify-content: center; gap: 9px; min-width: 0; line-height: 1.35; }
.ll-receipt-row em {
  flex-shrink: 0;
  font: normal 600 10px "Noto Sans Mono", monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ll-gold);
}
.ll-receipt.is-miss .ll-receipt-row em { color: #ff8f80; }
.ll-receipt-row b { flex-shrink: 0; font: 600 17px "Noto Sans SC", "Microsoft YaHei", sans-serif; }
.ll-pinyin { flex-shrink: 0; color: #e8dcc8; }
.ll-meaning { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ll-muted); }
.ll-clue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 640px;
  min-height: 96px;
  margin: 0 auto;
  padding: 12px 18px;
  border: 1px solid #ffc66b40;
  border-radius: 10px;
  background: #1a1530;
  text-align: center;
}
.ll-clue-label { font: 600 10px "Noto Sans Mono", monospace; letter-spacing: 3px; color: var(--ll-gold); }
.ll-clue-text { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ll-clue-text.is-word { font: 600 40px/1.1 "Noto Sans SC", "Microsoft YaHei", sans-serif; }
.ll-progress-caption b { font-weight: 600; color: var(--ll-gold); }
/* A gust is coming: the limit line flickers and the lanterns sway. */
.ll-stage.is-gust .ll-limit { border-top-color: #ffc66bcc; box-shadow: 0 0 22px 3px #ffc66b66; }
.ll-stage.is-gust .ll-flight .ll-lantern { animation: ll-sway .35s ease-in-out infinite alternate; }
@keyframes ll-sway { from { rotate: -4deg; } to { rotate: 4deg; } }
.ll-listen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 1px solid #ffc66b80;
  border-radius: 50%;
  background: #ffc66b1f;
  color: var(--ll-gold);
}
.ll-listen:hover { background: #ffc66b33; }
.ll-clue.is-flip { display: grid; grid-template-columns: auto auto; column-gap: 14px; }
.ll-clue.is-flip .ll-clue-label { grid-column: 1 / -1; }
.ll-clue.is-flip .ll-listen { width: 40px; height: 40px; }
/* The last lanterns of a level. */
.ll-game.is-rush .ll-meter i { background: #ff9d5c; box-shadow: 0 0 10px 1px #ff9d5c; }
.ll-game.is-rush .ll-progress-caption b { color: #ff9d5c; }
.ll-game.is-rush .ll-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 118%, #ff7a3d59 0%, transparent 62%);
  animation: ll-pulse .6s ease-in-out infinite alternate;
}
.ll-listen.is-loading { animation: ll-pulse .9s ease-in-out infinite alternate; }
@keyframes ll-pulse { to { opacity: .45; } }

/* Dialog */
.ll-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #0a0818f2;
  overflow: auto;
}
.ll-dialog {
  margin: auto;
  width: 100%;
  max-width: 460px;
  padding: 28px 32px 20px;
  border: 1px solid #c9b8e633;
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 0, #4a254066, transparent 62%), #151128;
  box-shadow: 0 28px 100px #0006;
  text-align: center;
  outline: none;
}
.ll-eyebrow { margin: 0 0 10px; font: 600 10px "Noto Sans Mono", monospace; letter-spacing: 3px; color: var(--ll-gold); }
.ll-dialog h1 { margin: 0; font-size: 34px; font-weight: 700; line-height: 1.15; letter-spacing: 0; }
.ll-dialog-copy { margin: 10px 0 0; font-size: 15px; color: #d6cbe2; }
.ll-intro { margin-top: 20px; }
.ll-example {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  justify-content: center;
  gap: 10px 14px;
  padding: 16px 0 14px;
  border: 1px solid var(--ll-line);
  border-radius: 10px;
  background: #0c0a1d80;
}
.ll-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  border: 1px solid #ffb48a59;
  border-radius: 44% / 36%;
  background: radial-gradient(ellipse at 50% 62%, #f08a4a, #c9472f 48%, #8a2a26);
  font: 600 26px "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: #fff6de;
}
.ll-mini.is-lit {
  border-color: #fff1c4;
  background: radial-gradient(ellipse at 50% 62%, #fff3bf, #ffb648 45%, #e8632e);
  box-shadow: 0 0 30px #ffc66b99;
  color: #5a1d0c;
  transform: translateY(-8px);
}
.ll-example-clue {
  grid-column: 1 / -1;
  justify-self: center;
  padding: 5px 16px;
  border: 1px solid #ffc66b40;
  border-radius: 8px;
  background: #1a1530;
  font-size: 15px;
  font-weight: 600;
}
.ll-intro-notes { display: grid; gap: 6px; margin-top: 14px; font-size: 13px; color: var(--ll-muted); }
.ll-results { margin-top: 20px; }
.ll-result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ll-result-stats > div { padding: 10px 6px; border: 1px solid var(--ll-line); border-radius: 8px; background: #0c0a1d80; }
.ll-result-stats span { display: block; font: 600 9px "Noto Sans Mono", monospace; letter-spacing: 2px; color: var(--ll-muted); }
.ll-result-stats strong { display: block; margin-top: 4px; font: 500 22px "Noto Sans Mono", monospace; font-variant-numeric: tabular-nums; }
.ll-save-status { min-height: 18px; margin: 10px 0 0; font-size: 12px; color: var(--ll-gold); }
.ll-review { margin-top: 12px; text-align: left; }
.ll-review h2 { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 1px; color: var(--ll-muted); text-transform: uppercase; }
.ll-review-word {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-top: 1px solid var(--ll-line);
  background: none;
  font-size: 14px;
  text-align: left;
}
button.ll-review-word:hover { background: #ffc66b14; }
.ll-review-word b { flex-shrink: 0; font: 600 18px "Noto Sans SC", "Microsoft YaHei", sans-serif; }
.ll-review-word span { flex-shrink: 0; color: #e8dcc8; }
.ll-review-word small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--ll-muted); }
.ll-load-status { margin: 16px 0 0; font-size: 13px; color: var(--ll-muted); }
.ll-primary {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #ffe6a880;
  border-radius: 8px;
  background: var(--ll-gold);
  color: #3a1d08 !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}
.ll-primary:hover { background: #ffd58f; }
.ll-dialog-exit { display: inline-block; margin-top: 14px; font-size: 12px; color: #b9aecb !important; }
.ll-dialog-exit:hover { color: var(--ll-ink) !important; }
.ll-dialog-footnote { margin: 12px 0 0; font-size: 11px; color: #8b7fa0; }
.ll-feedback {
  margin-top: 10px;
  padding: 4px 8px;
  border: 0;
  background: none;
  font-size: 11px;
  color: #8b7fa0 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ll-noscript { position: absolute; inset: auto 0 0; padding: 16px; text-align: center; background: #151128; }
@media (pointer: coarse) { .ll-dialog-footnote { display: none; } }

@media (max-width: 720px) {
  .ll-header { padding: 10px 12px; gap: 8px; }
  .ll-brand > span:last-child { display: none; }
  .ll-stats { gap: 14px; }
  .ll-controls { gap: 6px; }
  .ll-controls button:first-child { font-size: 10px; padding: 0 8px; white-space: nowrap; }
  .ll-stats strong { font-size: 17px; }
  .ll-progress { padding: 8px 14px 0; }
  .ll-flight { gap: 8px 10px; padding: 0 14px; }
  .ll-lantern { max-width: 118px; }
  .ll-word { font-size: 36px; }
  .ll-lantern[data-len="2"] .ll-word { font-size: 30px; }
  .ll-lantern[data-len="3"] .ll-word { font-size: 23px; }
  .ll-lantern[data-len="4"] .ll-word { font-size: 19px; }
  .ll-console { padding: 0 12px 12px; }
  .ll-clue { min-height: 84px; }
  .ll-clue-text { font-size: 20px; }
  .ll-clue-text.is-word { font-size: 34px; }
  .ll-lantern.is-meaning .ll-word { font-size: 14px; padding: 0 6px; }
  .ll-dialog { padding: 22px 20px 16px; }
  .ll-dialog h1 { font-size: 28px; }
}
@media (max-width: 350px) { .ll-brand { display: none; } }
@media (max-height: 640px) {
  .ll-lantern { max-width: 96px; }
  .ll-word { font-size: 30px; }
  .ll-lantern[data-len="2"] .ll-word { font-size: 25px; }
  .ll-lantern[data-len="3"] .ll-word { font-size: 19px; }
  .ll-lantern[data-len="4"] .ll-word { font-size: 16px; }
  .ll-receipt { height: 46px; font-size: 13px; }
  .ll-clue { min-height: 70px; padding-block: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .ll-game * { transition: none !important; animation: none !important; }
  .ll-ghost { display: none; }
}
