/* 载入画面：还原英雄联盟对局载入界面。蓝色方、红色方各五张世界赛纪念皮肤的载入原画，
   每张卡有自己的载入进度，全部就绪后两队分别退场，主页浮现。固定深色，不随主题变化。
   原画来自 Riot 官方 Data Dragon 素材（assets/lol/），属 Riot Games 版权。 */
.ld {
  --ld-ink: #05070c; --ld-gold: #c8aa6e; --ld-gold-2: #f0e6d2; --ld-gold-3: #785a28;
  --ld-blue: #3fa7ff; --ld-red: #ff4e50; --ld-text: #f0e6d2; --ld-muted: #a09b8c;
  --ld-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --ld-cinzel: "Cinzel", "Trajan Pro", Georgia, serif;
  --p: 0;
  /* 卡片宽度：同时受屏幕宽度和高度约束 */
  --cw: min(calc((100vw - 72px) / 5), calc(((100vh - 300px) / 2 - 58px) * .55), 176px);
  position: fixed; inset: 0; z-index: 9999; overflow: hidden; color: var(--ld-text); background: var(--ld-ink);
  font-family: var(--f-body, system-ui, sans-serif); -webkit-font-smoothing: antialiased;
  cursor: pointer; user-select: none;
  display: grid; grid-template-rows: auto auto 1fr auto; justify-items: center;
}
.ld * { box-sizing: border-box; }
.ld-bg { position: absolute; inset: -4%; background: url(lol/rift.jpg) center 40% / cover no-repeat; filter: blur(3px) saturate(.9) brightness(.55);
  animation: ldDrift 14s ease-out both; }
.ld-shade { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 70% at 50% 50%, rgba(5, 7, 12, .25), rgba(5, 7, 12, .9) 100%),
              linear-gradient(180deg, rgba(5, 7, 12, .85), transparent 24%, transparent 72%, rgba(5, 7, 12, .95)); }

.ld-top { position: relative; width: 100%; display: flex; align-items: center; gap: 12px;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px)); }
.ld-top svg { width: 24px; height: 24px; flex: none; }
.ld-brand { font-family: var(--ld-cinzel); font-weight: 700; letter-spacing: .18em; font-size: .9375rem; color: var(--ld-gold-2); text-transform: uppercase; }
.ld-state { margin-left: auto; display: flex; align-items: center; gap: 8px; font-family: var(--f-mono, ui-monospace, monospace); font-size: .6875rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ld-muted); }
.ld-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--ld-gold); box-shadow: 0 0 10px var(--ld-gold); animation: ldBlink 1.1s ease-in-out infinite; }

.ld-head { position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 6px 16px 0; animation: ldFade .8s .1s both; }
.ld-kicker { font-family: var(--ld-cinzel); font-weight: 700; font-size: .75rem; letter-spacing: .38em; text-indent: .38em; color: var(--ld-gold); text-transform: uppercase; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.ld-kicker::before, .ld-kicker::after { content: ""; width: 40px; height: 1px; background: linear-gradient(90deg, transparent, var(--ld-gold)); }
.ld-kicker::after { transform: scaleX(-1); }
.ld-h { margin: 0; font-family: var(--ld-serif); font-weight: 900; font-size: clamp(1.375rem, 3vw, 2.25rem); line-height: 1.15; letter-spacing: .12em; text-indent: .12em;
  background: linear-gradient(180deg, #fffaf0, var(--ld-gold-2) 40%, var(--ld-gold) 75%, var(--ld-gold-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ld-h .en { font-family: var(--ld-cinzel); letter-spacing: .1em; }

.ld-teams { position: relative; align-self: center; display: grid; justify-items: center; gap: 10px; }
.ld-side { width: 100%; display: flex; align-items: center; gap: 10px; font-family: var(--ld-cinzel); font-weight: 700; font-size: .6875rem; letter-spacing: .3em; text-transform: uppercase; }
.ld-side::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, currentColor, transparent); opacity: .5; }
.ld-side.b { color: var(--ld-blue); } .ld-side.r { color: var(--ld-red); }
.ld-row { display: flex; gap: 8px; }
.ld-vs { font-family: var(--ld-cinzel); font-weight: 900; font-size: 1.125rem; letter-spacing: .2em; text-indent: .2em; color: var(--ld-gold);
  display: flex; align-items: center; gap: 14px; text-shadow: 0 0 18px rgba(200, 170, 110, .6); }
.ld-vs::before, .ld-vs::after { content: ""; width: min(30vw, 260px); height: 1px; background: linear-gradient(90deg, transparent, var(--ld-gold)); }
.ld-vs::after { transform: scaleX(-1); }

.ld-card { --c: var(--ld-blue); --cp: 0; margin: 0; width: var(--cw); display: grid; gap: 5px; animation: ldCard .7s calc(var(--i) * 70ms + .15s) cubic-bezier(.2, .8, .2, 1) both; }
.ld-row.r .ld-card { --c: var(--ld-red); animation-name: ldCardR; }
.ld-art { position: relative; aspect-ratio: 308 / 560; overflow: hidden; background: #0b0f17;
  border: 1px solid var(--ld-gold-3); box-shadow: 0 10px 30px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .6); transition: border-color .4s, box-shadow .4s; }
.ld-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.06);
  filter: grayscale(.6) brightness(.7); transition: opacity .6s, transform 1.2s cubic-bezier(.2, .8, .2, 1), filter .6s; }
.ld-art img.ok { opacity: 1; transform: none; }
.ld-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(5, 7, 12, .85)); }
.ld-cap { position: absolute; z-index: 1; left: 0; right: 0; bottom: 6px; display: grid; justify-items: center; gap: 1px; text-align: center; padding-inline: 4px; }
.ld-cap b { font-family: var(--ld-serif); font-weight: 900; font-size: clamp(.6875rem, 1.3vw, .9375rem); letter-spacing: .08em; color: var(--ld-gold-2); text-shadow: 0 1px 6px #000; }
.ld-cap span { font-family: var(--ld-cinzel); font-weight: 700; font-size: .5625rem; letter-spacing: .14em; color: var(--ld-gold); }
.ld-cbar { position: relative; height: 3px; background: rgba(255, 255, 255, .1); }
.ld-cbar i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--cp)); background: var(--c); box-shadow: 0 0 8px var(--c); }
.ld-cpct { font-family: var(--ld-cinzel); font-weight: 700; font-size: .6875rem; letter-spacing: .08em; text-align: center; color: var(--ld-muted); font-variant-numeric: tabular-nums; line-height: 1; }
.ld-card.done .ld-art { border-color: var(--ld-gold); box-shadow: 0 10px 34px rgba(0, 0, 0, .6), 0 0 18px var(--c), inset 0 0 0 1px rgba(240, 230, 210, .25); }
.ld-card.done .ld-art img { filter: none; }
.ld-card.done .ld-cpct { color: var(--ld-gold-2); }

.ld-foot { position: relative; width: min(560px, 100%); display: grid; gap: 8px;
  padding: 0 max(20px, env(safe-area-inset-right, 0px)) max(22px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.ld-frow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ld-step { font-size: .8125rem; letter-spacing: .06em; color: var(--ld-text); opacity: .85; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-pct { font-family: var(--ld-cinzel); font-weight: 700; font-size: 1.5rem; line-height: 1; color: var(--ld-gold-2); font-variant-numeric: tabular-nums; }
.ld-pct small { font-size: .5em; margin-left: 2px; color: var(--ld-gold); }
.ld-track { position: relative; height: 3px; background: rgba(255, 255, 255, .08); }
.ld-fill { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p)); background: linear-gradient(90deg, var(--ld-gold-3), var(--ld-gold-2)); box-shadow: 0 0 12px rgba(200, 170, 110, .8); }
.ld-tip { margin: 0; font-size: .8125rem; line-height: 1.6; color: var(--ld-muted); text-align: center; min-height: 3.2em; }
.ld-tip b { color: var(--ld-gold); font-weight: 600; margin-right: 6px; letter-spacing: .1em; }
.ld-hint { position: absolute; z-index: 2; left: 0; right: 0; bottom: 120px; margin: 0; text-align: center; font-size: .8125rem; color: var(--ld-text); opacity: 0; transition: opacity .4s; pointer-events: none; }
.ld-hint.on { opacity: .8; }

/* 退场：蓝色方向上、红色方向下离场，背景淡出 */
.ld.out { pointer-events: none; transition: opacity .55s .35s ease; opacity: 0; }
.ld.out .ld-row.b .ld-card { animation: ldExitB .6s calc(var(--i) * 40ms) cubic-bezier(.5, 0, .7, .4) both; }
.ld.out .ld-row.r .ld-card { animation: ldExitR .6s calc(var(--i) * 40ms) cubic-bezier(.5, 0, .7, .4) both; }
.ld.out .ld-head, .ld.out .ld-foot, .ld.out .ld-vs, .ld.out .ld-side { transition: opacity .3s; opacity: 0; }

@media (max-width: 720px) {
  .ld { --cw: min(calc((100vw - 56px) / 5), calc(((100vh - 300px) / 2 - 50px) * .55)); }
  .ld-row { gap: 6px; }
  .ld-cap span { display: none; }
  .ld-cap b { font-size: .625rem; letter-spacing: .02em; }
  .ld-kicker { font-size: .625rem; letter-spacing: .24em; text-indent: .24em; gap: 8px; }
  .ld-kicker::before, .ld-kicker::after { width: 18px; }
  .ld-cpct { font-size: .625rem; }
}

@keyframes ldBlink { 50% { opacity: .25; } }
@keyframes ldFade { from { opacity: 0; } }
@keyframes ldDrift { from { transform: scale(1.1); } }
@keyframes ldCard { from { opacity: 0; transform: translateY(-28px); } }
@keyframes ldCardR { from { opacity: 0; transform: translateY(28px); } }
@keyframes ldExitB { to { opacity: 0; transform: translateY(-60px) scale(.96); } }
@keyframes ldExitR { to { opacity: 0; transform: translateY(60px) scale(.96); } }
.ld.quick .ld-card { animation-duration: .35s; animation-delay: calc(var(--i) * 25ms); }
.ld.quick .ld-head { animation-duration: .3s; animation-delay: 0s; }

/* 揭幕：主页在底下已经画好，退场时依次浮现 */
html.ld-in .topbar { animation: ldNav .9s .05s cubic-bezier(.2,.8,.2,1) both; }
html.ld-in .hero .wrap > *, html.ld-in .docs-layout > * { animation: ldRise 1s cubic-bezier(.2,.8,.2,1) both; }
html.ld-in .hero .wrap > :nth-child(2), html.ld-in .docs-layout > :nth-child(2) { animation-delay: .15s; }
@keyframes ldNav { from { opacity: 0; transform: translateY(-100%); } }
@keyframes ldRise { from { opacity: 0; transform: translateY(40px); } }

@media (prefers-reduced-motion: reduce) {
  .ld *, .ld, html.ld-in * { animation: none !important; transition: none !important; }
}
html.ld-hold { overflow: hidden; }
.ld-side.r { flex-direction: row-reverse; }
.ld-side.r::after { background: linear-gradient(270deg, currentColor, transparent); }
