.festive-duel {
  --duel-gold: #ffe0a6;
  --duel-ink: #091421;
  background: linear-gradient(180deg,#09132224 12%,#111d3590 62%,#081421e6), url("./duel-art/arena.webp") center 58% / cover;
}
.festive-duel .full-game-header { background:#0a1625eb; min-height:60px; }
.festive-duel .full-game-header button { min-height:44px; }
.festive-duel .full-game-content { display:block; padding:0; }
.duel-stage {
  width:min(100%,890px);
  position:relative;
  margin:auto;
  min-height:100%;
  display:grid;
  align-items:center;
  padding:clamp(.7rem,3vw,1.6rem) max(.75rem,env(safe-area-inset-right))
    calc(1rem + env(safe-area-inset-bottom)) max(.75rem,env(safe-area-inset-left));
}
.duel-stage .game-setup { margin:auto; width:min(100%,570px); }
.duel-game,.duel-result {
  align-self:center;
  width:100%;
  text-align:center;
  padding:clamp(.75rem,2.5vw,1.65rem);
  border:1px solid #ddae718c;
  border-radius:clamp(16px,3vw,28px);
  background:linear-gradient(151deg,#13283dcb,#0d192ddf 66%,#1a233bc9);
  box-shadow:0 18px 60px #02081375,inset 0 0 0 4px #ffdcb511;
}
.duel-round-label {
  color:var(--duel-gold);
  font:650 .83rem/1.4 system-ui,sans-serif;
  letter-spacing:.09em;
  margin:0 0 .65rem;
}
.duel-scoreboard { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:clamp(.45rem,2vw,1rem); max-width:650px; margin:auto; }
.duel-score {
  --side:#67d8e0;
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:.25rem .35rem;
  padding:.45rem clamp(.4rem,2vw,.9rem);
  border:1px solid color-mix(in srgb,var(--side) 42%,#27334a);
  border-radius:12px;
  background:linear-gradient(145deg,color-mix(in srgb,var(--side) 18%,#11213a),#172039);
  box-shadow:inset 0 0 15px #0004;
}
.duel-score:nth-child(2) { --side:#f8a6ac; }
.duel-score.is-active { border-color:var(--side); box-shadow:0 0 15px color-mix(in srgb,var(--side) 33%,transparent); }
.duel-score .roster-badge { justify-self:start; min-width:0; max-width:100%; overflow-wrap:anywhere; text-align:left; font-size:clamp(.73rem,2.8vw,1rem); }
.duel-score strong { color:var(--duel-gold); font:700 clamp(1.35rem,5vw,2.5rem)/1 Georgia,serif; }
.duel-pips { grid-column:1/-1; display:flex; justify-content:space-between; padding-inline:.22rem; }
.duel-pips i { font-style:normal; color:#91a3bb; font-size:1rem; line-height:1; width:1rem; }
.duel-pips .is-lit { color:var(--side); text-shadow:0 0 8px var(--side); }
.duel-status {
  min-height:3em;
  display:grid;
  align-items:center;
  color:#fff0d4;
  font-weight:730;
  line-height:1.4;
  margin:.3rem 0;
  overflow-wrap:anywhere;
}
.duel-status[data-turn] {
  --turn-accent:#8ce5eb;
  --turn-panel:#18384f;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:clamp(.65rem,3vw,1.15rem);
  padding:.52rem .65rem;
  min-height:76px;
  margin:.75rem auto 0;
  max-width:650px;
  border:1px solid var(--turn-accent);
  border-radius:14px;
  background:radial-gradient(ellipse at 25% 0%,var(--turn-panel),#0d192d 90%);
  box-shadow:0 0 18px color-mix(in srgb,var(--turn-accent) 18%,transparent);
  text-align:left;
}
.duel-status[data-turn="1"] { --turn-accent:#ffb5be; --turn-panel:#4a2a44; }
.duel-status[data-turn] .roster-avatar {
  width:clamp(53px,15vw,79px);
  border-radius:50%;
  background:radial-gradient(circle,color-mix(in srgb,var(--turn-accent) 44%,transparent),transparent 68%);
  filter:drop-shadow(0 3px 4px #071424);
}
.duel-turn-message { display:grid; gap:.15rem; min-width:0; }
.duel-turn-name { color:var(--turn-accent); font:700 clamp(1.65rem,6.8vw,2.65rem)/1.05 Georgia,serif; }
.duel-turn-instruction { color:#fff2d6; font:700 clamp(1.22rem,5.2vw,1.8rem)/1.15 system-ui,sans-serif; }
.duel-status[data-turn]+.duel-board { min-height:0; margin-top:clamp(.8rem,3vw,1.25rem); }
.duel-board { display:grid; align-content:center; min-height:clamp(205px,42vw,340px); }
.festive-duel .arena-choice {
  position:relative;
  isolation:isolate;
  overflow:hidden;
  border:1px solid #eee0b7b2;
  padding:.72rem .2rem .8rem;
  gap:.52rem;
  min-height:124px;
  width:100%;
  border-radius:clamp(9px,2.4vw,17px);
  box-shadow:0 11px 23px #060b16af,inset 0 0 0 3px #efcd9022;
}
.festive-duel .arena-choice:nth-child(2) { --glint-delay:-3s; }
.festive-duel .arena-choice:nth-child(3) { --glint-delay:-5s; }
.festive-duel .arena-choice::before {
  content:"";
  z-index:-1;
  position:absolute;
  inset:0;
  background:linear-gradient(114deg,transparent 38%,#fff1ba32 51%,transparent 65%);
  transform:translateX(-115%);
  animation:duel-shimmer 7s var(--glint-delay,0s) ease-out infinite;
}
.festive-duel .arena-choice-rock { background:radial-gradient(ellipse at 43% 11%,#38658a,#131e37 74%); }
.festive-duel .arena-choice-paper { background:radial-gradient(ellipse at 43% 11%,#367778,#152b30 74%); }
.festive-duel .arena-choice-scissors { background:radial-gradient(ellipse at 43% 11%,#94566e,#3c1c33 74%); }
.festive-duel .arena-choice .rps-piece { width:100%; height:clamp(77px,22vw,210px); transition:transform .23s ease-out; }
.festive-duel :is(.arena-choice,.duel-primary):focus-visible { outline:3px solid #fff0b4; outline-offset:2px; }
.duel-handoff,.duel-countdown {
  min-height:clamp(160px,35vw,250px);
  display:grid;
  align-content:center;
  justify-items:center;
  gap:.6rem;
}
.duel-handoff h3,.duel-result h3 { color:var(--duel-gold); font:700 clamp(1.5rem,6vw,3.5rem)/1 Georgia,serif; margin:0; overflow-wrap:anywhere; }
.duel-handoff p { margin:0 0 .35rem; }
.duel-seal { color:#ffe6b2; text-shadow:0 0 14px #ffc478; font-size:1.75rem; }
.duel-primary { min-height:46px; margin:0; padding:.55rem 1.3rem; font-weight:760; }
.duel-countdown strong { color:var(--duel-gold); text-shadow:0 3px 4px #23182c,0 0 22px #fad284b0; font:700 clamp(2.2rem,12vw,6rem)/1 Georgia,serif; animation:duel-beat .22s ease-out both; }
.duel-actions { display:flex; align-items:center; justify-content:center; margin-top:.55rem; }
.festive-duel .rps-fighter .rps-piece { animation-duration:.35s; }
.festive-duel .rps-duel {
  container-type:inline-size;
  gap:2%;
  overflow:visible;
  min-height:clamp(150px,34vw,275px);
}
.festive-duel .rps-fighter strong { position:relative; padding:.35rem .42rem; }
.duel-figure {
  position:relative;
  display:grid;
  place-items:center;
  --strike:48cqw;
  --tilt:16deg;
  --fold-edge:left;
}
.rps-fighter:nth-child(2) .duel-figure { --strike:-48cqw; --tilt:-16deg; --fold-edge:right; }
.is-clashing .rps-winner,.has-result .rps-winner { z-index:2; }
.festive-duel .is-clashing .rps-winner .rps-piece { animation:duel-rock-charge .68s both; }
.is-clashing[data-effect="wrap"] .rps-winner .rps-piece { animation-name:duel-paper-swoop; }
.is-clashing[data-effect="snip"] .rps-winner .rps-piece { animation-name:duel-scissors-lunge; }
.is-clashing[data-effect="crush"] .rps-loser .rps-piece { animation:duel-squash .43s .25s both; }
.has-result[data-effect="crush"] .rps-loser .rps-piece { transform:scale(1.08,.58) translateY(23%) rotate(-8deg); opacity:.73; }
.duel-wrapped-rock,.duel-folding-paper,.duel-scrap {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  opacity:0;
  pointer-events:none;
}
.duel-wrapped-rock { filter:drop-shadow(0 8px 6px #090e1d7d); }
.duel-folding-paper {
  transform-origin:var(--fold-edge) 54%;
  filter:drop-shadow(2px 4px 4px #493116e0);
}
.is-clashing .duel-folding-paper { animation:duel-fold .38s .25s both; }
.is-clashing .duel-wrapped-rock { animation:duel-wrapped .27s .40s both; }
.is-clashing[data-effect="wrap"] .rps-loser .rps-piece { animation:duel-rock-under-paper .38s .26s both; }
.has-result[data-effect="wrap"] .rps-loser .rps-piece,
.has-result[data-effect="snip"] .rps-loser .rps-piece { opacity:0; }
.has-result .duel-wrapped-rock { opacity:1; }
.duel-scraps { position:absolute; inset:0; }
.duel-scrap-upper {
  clip-path:polygon(0 0,100% 0,100% 48%,0 64%);
  --cut-x:-13%; --cut-y:1%; --cut-tilt:-18deg;
}
.duel-scrap-lower {
  clip-path:polygon(0 64%,100% 48%,100% 100%,0 100%);
  --cut-x:16%; --cut-y:13%; --cut-tilt:12deg;
}
.is-clashing .duel-scrap { animation:duel-sever .41s .25s both; }
.is-clashing[data-effect="snip"] .rps-loser .rps-piece { animation:duel-hide-cut 1ms .25s both; }
.has-result .duel-scrap {
  transform:translate(var(--cut-x),var(--cut-y)) rotate(var(--cut-tilt)) scale(.86);
  opacity:.85;
}
.duel-score.is-round-winner {
  position:relative;
  border-color:#ffdc7b;
  background:linear-gradient(135deg,#53432b,#203047);
  box-shadow:0 0 16px #ffc46789,inset 0 0 13px #ffc46744;
}
.duel-status.duel-round-result {
  min-height:3em;
  align-content:center;
  gap:.13rem;
  color:#f9e4bb;
  font-size:clamp(.82rem,3.2vw,1rem);
}
.duel-round-result strong {
  color:#ffe297;
  font:800 clamp(1.18rem,4.8vw,1.7rem)/1.15 Georgia,serif;
  text-shadow:0 0 15px #fbc26071;
}
.has-result .rps-winner .duel-move-label {
  color:#21170c;
  background:linear-gradient(120deg,#ffdf82,#fff4c9 60%,#f2bb5e);
  border-color:#ffe6a6;
  box-shadow:0 0 14px #ffc96184;
}
.has-result .rps-winner .duel-figure::after {
  content:"";
  position:absolute;
  z-index:-1;
  inset:3% 0;
  pointer-events:none;
  background:radial-gradient(ellipse,#fcd27a87,transparent 66%);
}
.duel-sparks,.duel-dazed {
  position:absolute;
  inset:0;
  pointer-events:none;
  z-index:4;
}
.duel-sparks { --range:clamp(36px,10vw,75px); }
.duel-sparks i {
  position:absolute;
  top:46%;
  left:49%;
  opacity:0;
  color:#ffd875;
  text-shadow:0 0 8px #ffb929,0 0 16px #ffad41;
  font:normal 1rem/1 system-ui,sans-serif;
  scale:0;
}
.duel-sparks i:nth-child(3n) { color:#fffbea; }
.duel-sparks i:nth-child(4n) { color:#a9f8ff; }
.duel-item-sparks::before,.duel-hit-sparks::before {
  content:"";
  position:absolute;
  inset:25% 21%;
  border:2px solid #ffe7ad;
  border-radius:50%;
  box-shadow:0 0 20px #fbc65f;
  opacity:0;
  transform:scale(.3);
}
.duel-hit-sparks { --range:clamp(22px,7vw,49px); }
.duel-hit-sparks i { color:#ffecbd; font-size:.72rem; }
.is-clashing .duel-hit-sparks i { animation:duel-firework .41s calc(.24s + var(--lag)) both; }
.is-clashing .duel-hit-sparks::before { animation:duel-flash .42s .25s both; }
.has-result .duel-item-sparks i,.duel-score-sparks i { animation:duel-firework .76s var(--lag) both; }
.has-result .duel-item-sparks::before { animation:duel-flash .65s both; }
.duel-score-sparks { --range:clamp(33px,9vw,56px); }
.duel-score-sparks i { top:27%; left:37%; font-size:.78rem; }
.duel-score-sparks i:nth-child(even) { left:73%; top:41%; }
.duel-item-sparks i:nth-child(3n)::after,.duel-score-sparks i:nth-child(3n)::after {
  content:"";
  position:absolute;
  top:50%;
  right:85%;
  width:1.2em;
  height:2px;
  background:linear-gradient(90deg,transparent,currentColor);
}
.duel-dazed {
  --orbit:clamp(30px,9vw,65px);
  inset:4% 0 auto;
  height:22px;
  opacity:0;
}
.has-result .duel-dazed { opacity:1; }
.duel-dazed i {
  --phase:0s;
  position:absolute;
  left:calc(50% - .45em);
  top:3px;
  color:#f7df8d;
  text-shadow:0 0 8px #ffe082,0 0 16px #f9be3c;
  font:normal clamp(.8rem,4vw,1.25rem)/1 system-ui,sans-serif;
}
.duel-dazed i:nth-child(2) { --phase:-.35s; transform:translateX(calc(var(--orbit) * .8)); }
.duel-dazed i:nth-child(3) { --phase:-.7s; transform:translateX(calc(var(--orbit) * -.8)); }
.duel-dazed i:nth-child(4) { --phase:-1.05s; transform:translateY(-9px) scale(.7); }
.has-result .duel-dazed i { animation:duel-orbit 1.4s var(--phase) linear infinite; }
.duel-result { display:grid; justify-items:center; gap:.5rem; padding-top:.65rem; }
.duel-result p { margin:0; overflow-wrap:anywhere; }
.duel-result .roster-lineup { margin:0; }
.duel-trophy-spot {
  width:clamp(125px,31vw,235px);
  position:relative;
  background:radial-gradient(ellipse,#fcce7187 0%,#e79c3740 35%,transparent 67%);
}
.duel-trophy { width:100%; height:clamp(126px,30vh,237px); object-fit:contain; filter:drop-shadow(0 10px 15px #03060c9e); animation:duel-trophy-rise .46s cubic-bezier(.15,.73,.28,1) both; }
.duel-final-score { font-size:clamp(1rem,3.6vw,1.28rem); color:var(--duel-gold); font-weight:800; }
.duel-match-rule { font-size:.9rem; color:#efe4d3; }
.duel-record { background:#0a1528b5; border-radius:12px; border:1px solid #bc935969; padding:.47rem .7rem; color:#ffe9c2; font-size:.91rem; font-weight:650; }
.duel-history { display:flex; flex-wrap:wrap; gap:.32rem; justify-content:center; max-width:min(360px,100%); }
.duel-round-chip { display:grid; place-items:center; border:1px solid #83dbe3; color:#d6fbff; background:#1f4f67; border-radius:5px; min-width:1.45rem; min-height:1.45rem; padding-inline:.15rem; font-size:.72rem; font-weight:800; }
.duel-round-chip[data-winner="1"] { border-color:#ed9dbe; color:#ffe3ef; background:#623952; }
.duel-round-chip[data-winner="tie"] { border-color:#9aadc3; color:#e0e9f8; background:#283348; }
@keyframes duel-shimmer { 20%,100% { transform:translateX(115%); } }
@keyframes duel-beat { from { transform:scale(.8); opacity:.55; } to { transform:scale(1); opacity:1; } }
@keyframes duel-rock-charge {
  22% { transform:translateX(calc(var(--strike) * -.14)) translateY(-9%) rotate(calc(var(--tilt) * -2)); }
  39% { transform:translateX(calc(var(--strike) * .90)) translateY(9%) rotate(calc(var(--tilt) * 3)) scale(1.15); }
  67% { transform:translateX(calc(var(--strike) * .17)) translateY(-15%) rotate(var(--tilt)); }
  to { transform:none; }
}
@keyframes duel-paper-swoop {
  20% { transform:translateY(-32%) rotate(calc(var(--tilt) * -1.4)); }
  40% { transform:translateX(calc(var(--strike) * .91)) rotate(var(--tilt)) scale(1.08,.93); opacity:1; }
  62% { transform:translateX(calc(var(--strike) * .98)) rotate(var(--tilt)) scale(.08,.81); opacity:0; }
  63% { transform:translateY(-23%) scale(.65); opacity:0; }
  to { transform:none; opacity:1; }
}
@keyframes duel-scissors-lunge {
  22% { transform:translateX(calc(var(--strike) * -.10)) rotate(calc(var(--tilt) * -2)); }
  39% { transform:translateX(calc(var(--strike) * .76)) rotate(calc(var(--tilt) * 4)); }
  53% { transform:translateX(calc(var(--strike) * .81)) rotate(calc(var(--tilt) * 2.8)) scale(1.11,.95); }
  74% { transform:translateX(calc(var(--strike) * .24)) rotate(var(--tilt)); }
  to { transform:none; }
}
@keyframes duel-fold {
  from { transform:perspective(240px) rotateY(32deg) rotate(-18deg) scale(.85); opacity:1; }
  56% { transform:perspective(240px) rotateY(-39deg) rotate(16deg) scale(.83,.77); opacity:1; }
  to { transform:perspective(240px) rotateY(-61deg) rotate(26deg) scale(.49,.62); opacity:0; }
}
@keyframes duel-wrapped { from { transform:rotate(-8deg) scale(.85); opacity:0; } to { transform:none; opacity:1; } }
@keyframes duel-rock-under-paper { 45% { transform:rotate(9deg) scale(.92); opacity:1; } to { transform:rotate(-5deg) scale(.85); opacity:0; } }
@keyframes duel-sever { from { opacity:1; } to { transform:translate(var(--cut-x),var(--cut-y)) rotate(var(--cut-tilt)) scale(.86); opacity:.85; } }
@keyframes duel-hide-cut { to { opacity:0; } }
@keyframes duel-squash {
  28% { transform:scale(1.29,.34) translateY(48%) rotate(9deg); }
  66% { transform:scale(.93,.69) translateY(17%) rotate(-11deg); }
  to { transform:scale(1.08,.58) translateY(23%) rotate(-8deg); opacity:.73; }
}
@keyframes duel-firework {
  13% { opacity:1; scale:1.2; }
  52% { opacity:1; }
  to { transform:rotate(var(--angle)) translateX(calc(var(--range) * var(--reach))); opacity:0; scale:.45; }
}
@keyframes duel-flash { 16% { opacity:1; } to { opacity:0; transform:scale(1.8); } }
@keyframes duel-orbit {
  0%,100% { transform:translate(0,-7px) scale(.7); opacity:.48; }
  25% { transform:translateX(var(--orbit)) scale(.91); opacity:.85; }
  50% { transform:translate(0,7px) scale(1.12); opacity:1; }
  75% { transform:translateX(calc(var(--orbit) * -1)) scale(.91); opacity:.85; }
}
@keyframes duel-trophy-rise { from { transform:translateY(20px) scale(.8); opacity:.3; } to { transform: none; opacity:1; } }
@media (max-height:520px) and (orientation:landscape) {
  .duel-stage { padding-block:.55rem; }
  .duel-status[data-turn] { min-height:58px; padding:.3rem .65rem; margin-top:.45rem; }
  .duel-status[data-turn] .roster-avatar { width:48px; }
  .duel-turn-message { display:flex; align-items:baseline; flex-wrap:wrap; gap:.2em .4em; }
  .duel-turn-name { font-size:1.6rem; }
  .duel-turn-instruction { font-size:1.15rem; }
  .duel-status[data-turn]+.duel-board { margin-top:.55rem; }
  .duel-board,.duel-handoff,.duel-countdown { min-height:120px; }
  .festive-duel .arena-choice .rps-piece,.festive-duel .rps-fighter .rps-piece { height:clamp(70px,24vh,125px); }
  .festive-duel .rps-duel { min-height:auto; }
  .duel-trophy { height:110px; }
}
@media (prefers-reduced-motion:reduce) {
  .festive-duel .rps-fighter .rps-piece,.festive-duel .arena-choice::before,
  .duel-trophy { animation:none; }
  .has-result .duel-item-sparks i:first-child,
  .has-result .duel-item-sparks i:nth-child(2),
  .has-result .duel-item-sparks i:nth-child(3),
  .duel-score-sparks i:first-child,.duel-score-sparks i:nth-child(2) {
    opacity:1;
    scale:1;
    top:10%;
    left:12%;
  }
  .has-result .duel-item-sparks i:nth-child(2),.duel-score-sparks i:nth-child(2) { left:84%; }
  .has-result .duel-item-sparks i:nth-child(3) { top:68%; left:88%; }
}
