.duel-layout { display:grid; gap:14px; min-width:0; }
.duel-header { display:flex; flex-wrap:wrap; justify-content:space-between; gap:10px; align-items:center; }
.duel-players { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.duel-player { display:grid; gap:6px; min-width:0; }
.duel-player b { color:var(--gold); font-family:var(--pixel); font-size:.7rem; line-height:1.7; }
.duel-player span { font-size:.8rem; }
.duel-player.foe { text-align:right; }
.duel-player.foe .hp i { background:repeating-linear-gradient(90deg,#d86c85 0 7px,#843d5b 7px 8px); }
.duel-arena { position:relative; height:190px; overflow:hidden; background:linear-gradient(#111937,#26365b 75%,#15162c 75%); }
.duel-arena::before { content:""; position:absolute; inset:0; background:repeating-linear-gradient(90deg,transparent 0 46px,#97baff0b 46px 48px); }
.duel-ground { position:absolute; bottom:0; left:0; right:0; height:24%; background:repeating-linear-gradient(90deg,#283d43 0 16px,#1c2f38 16px 18px); border-top:4px solid #72928f; }
.duel-mage { position:absolute; bottom:20%; width:75px; z-index:2; }
.duel-mage.you { left:8%; }
.duel-mage.foe { right:8%; transform:scaleX(-1); }
.duel-mage.warded::before { content:""; position:absolute; inset:-8px; border:2px solid #6fe3e3; border-radius:50%; background:#6fe3e315; box-shadow:0 0 14px #6fe3e355; }
.duel-mage img { width:100%; image-rendering:pixelated; }
.duel-arena-label { position:absolute; top:15px; left:0; right:0; text-align:center; color:var(--gold); font:.75rem var(--pixel); line-height:1.7; }
.duel-shot { position:absolute; z-index:3; min-width:24px; padding:5px; border-radius:50%; text-align:center; color:#211526; background:#ffca6b; box-shadow:0 0 18px #ffb655aa; font-weight:700; font-variant-numeric:tabular-nums; }
.duel-shot.incoming { background:#ff9eaa; box-shadow:0 0 18px #ff6b81aa; }
.duel-incoming { padding:10px; background:#111833; border-radius:4px; color:var(--muted); font-variant-numeric:tabular-nums; }
.duel-incoming.danger { color:#ffb4b4; background:#3b2039; }
.duel-crystals { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.duel-crystal { display:grid; place-items:center; gap:2px; width:70px; height:74px; background:#172142; clip-path:polygon(20% 0,80% 0,100% 30%,80% 100%,20% 100%,0 30%); color:var(--muted); }
.duel-crystal.charged { background:linear-gradient(135deg,#ffe8a4,#e0a841 45%,#977526); color:#251f35; }
.duel-crystal.cracked { background:linear-gradient(135deg,#d497ae,#75495e 45%,#382f4d); color:#fff0f5; }
.duel-crystal span { font:1rem var(--pixel); }
.duel-crystal small { font-size:.65rem; font-weight:700; }
.duel-bank-label { font-size:.8rem; line-height:1.8; color:var(--gold); }
.duel-current { position:relative; padding:14px; min-width:0; }
.duel-sentence-head { display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; font-size:.75rem; margin-bottom:10px; color:var(--gold); }
#duelText { overflow-wrap:anywhere; margin-bottom:8px; font-family:var(--mono); font-size:1.3rem; line-height:1.7; }
#duelText .done { color:var(--mend); }
#duelText .cur { background:#ffe49a; color:#1b1730; }
#duelText .cur.bad { background:#ff8796; }
#duelPotential.duel-unstable { color:#ff9eaa; }
#duelSink { position:absolute; width:1px; height:1px; opacity:0; border:0; padding:0; font-size:16px; }
#duelTypingNote,.duel-help { font-size:.85rem; color:var(--muted); }
.duel-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.duel-actions .btn { white-space:normal; line-height:1.7; }
.duel-result { padding:18px; }
#duelConnection { color:#ffc1a8; min-height:1.5em; }
@media(max-width:600px) { .duel-players { gap:12px; } .duel-player b { font-size:.6rem; } .duel-player span { font-size:.7rem; } .duel-arena { height:145px; } .duel-mage { width:58px; } .duel-actions { grid-template-columns:minmax(0,1fr); gap:10px; } .duel-crystal { width:58px; height:64px; } .duel-bank-label { width:100%; } }
@media(prefers-reduced-motion:reduce) { .duel-shot { box-shadow:none; } }
/* Illustrated Scriptorium art and fighting-game presentation. */
.duel-layout { gap:10px; }
.duel-arena { height:350px; background:#14182d url('assets/duel/scriptorium-arena.webp') center 72% / cover no-repeat; border-color:#e3c895; box-shadow:0 0 0 3px #49405f,0 12px 36px #0008; }
.duel-arena::before { background:linear-gradient(#060b20bd 0,transparent 35%,transparent 75%,#060b2033); z-index:1; }
.duel-ground { background:none; border:0; height:0; }
.duel-players { position:absolute; top:0; left:0; right:0; z-index:6; gap:30px; padding:12px 16px; background:linear-gradient(#071022ef,#07102299,transparent); }
.duel-player { position:relative; gap:3px; padding-left:72px; }
.duel-player.foe { padding-left:0; padding-right:72px; }
.duel-portrait { position:absolute; width:62px; height:62px; left:0; top:0; object-fit:cover; border:2px solid #ddc485; border-radius:8px 8px 22px 8px; background:#192345; box-shadow:0 2px 12px #0008; }
.duel-player.foe .duel-portrait { left:auto; right:0; transform:scaleX(-1); border-radius:8px 8px 8px 22px; }
.duel-player b { font-size:.65rem; text-shadow:2px 2px #11182a; }
.duel-player span { font-size:.7rem; line-height:1.35; }
.duel-player .bar { height:10px; box-shadow:0 1px 5px #0008; }
.duel-mage { width:clamp(165px,24%,250px); bottom:11%; z-index:3; }
.duel-mage.you { left:4%; }
.duel-mage.foe { right:4%; transform:none; }
.duel-mage::after { content:""; position:absolute; bottom:-2%; left:15%; right:15%; height:12%; background:#090b1980; border-radius:50%; filter:blur(4px); z-index:-1; }
.duel-mage img { image-rendering:auto; filter:drop-shadow(0 6px 3px #0008); transform-origin:50% 88%; animation:duel-breathe 2.4s ease-in-out infinite; }
.duel-mage.foe img { animation-delay:-1.2s; }
.duel-mage.warded::before { inset:-10px -12px; border:3px solid #a2ffff; background:radial-gradient(ellipse,#70ffff08 45%,#70ffff44 85%,#e6ffffaa); box-shadow:inset 0 0 22px #5ee7ff77,0 0 22px #5ee7ff88; z-index:3; animation:duel-shield 1.5s ease-in-out infinite; }
.duel-mage.warded { filter:drop-shadow(0 0 8px #84fdff88); }
.duel-arena-label { top:94px; left:35%; right:35%; z-index:6; border:1px solid #dcc58055; border-radius:20px; background:#101830bb; padding:7px 10px; font-size:.55rem; }
.duel-shot { width:var(--shot-size,42px); height:var(--shot-size,42px); min-width:0; display:grid; place-items:center; padding:0; transform:translate(-50%,-50%); border:1px solid #fff6; background:radial-gradient(circle at 35% 35%,#fffde8 0 8%,#ffe792 20%,#ffba45 45%,#f0672977 75%,transparent 95%); box-shadow:0 0 14px #fff1aa,0 0 34px #ffab45aa; color:#38223b; font-size:.9rem; text-shadow:0 1px #fff9; z-index:5; }
.duel-shot::before { content:""; position:absolute; top:10%; right:55%; width:calc(var(--shot-size,42px) * 2.1); height:80%; background:linear-gradient(90deg,transparent,#ffaf3933,#ffe48699); clip-path:polygon(0 50%,30% 15%,100% 25%,100% 75%,30% 85%); z-index:-1; }
.duel-shot.incoming { background:radial-gradient(circle at 35% 35%,#fff2f7 0 8%,#ffd2e0 20%,#ed85d8 45%,#a04ad477 75%,transparent 95%); box-shadow:0 0 14px #ffd7ee,0 0 34px #bf65eeaa; }
.duel-shot.incoming::before { right:auto; left:55%; background:linear-gradient(270deg,transparent,#b751ce33,#ffbdea99); }
.duel-shot.counter { background:radial-gradient(circle at 35% 35%,#fff 5%,#bafffa 20%,#50dce9 55%,#228fff44 80%,transparent 95%); box-shadow:0 0 28px #77fbffee; }
.duel-crystals { gap:10px; padding:4px 0; }
.duel-crystal { position:relative; width:65px; height:70px; background:linear-gradient(135deg,#26314f,#151b33); clip-path:polygon(50% 0,92% 25%,90% 70%,50% 100%,10% 70%,8% 25%); }
.duel-crystal.charged { background:conic-gradient(from 45deg,#fcf3c7,#d89525,#fff0aa,#9662e4,#fcf3c7); color:#251f35; filter:drop-shadow(0 0 7px #ffc46488); }
.duel-crystal.cracked { background:linear-gradient(50deg,transparent 46%,#2a1b3a 47% 51%,transparent 52%),conic-gradient(from 45deg,#eaa4bf,#704567,#e7a5c7,#42356f,#eaa4bf); }
.duel-crystal::before { content:""; position:absolute; left:18%; top:12%; width:35%; height:28%; background:#ffffff44; clip-path:polygon(60% 0,100% 30%,25% 100%,0 65%); }
.duel-crystal span { z-index:1; }
.duel-crystal small { z-index:1; font-size:.6rem; }
.duel-current { background:linear-gradient(135deg,#253873,#141c44); border-color:#a7c6ec; }
.duel-actions .btn { display:grid; gap:4px; padding:10px; text-align:center; background:linear-gradient(#3c2c4c,#231a36); color:#fff3d3; border-color:#baa079; }
.duel-actions #duelAttack { background:linear-gradient(#ffcc75,#e69b47); color:#2d2038; border-color:#ffe1a2; }
.duel-actions #duelDefend { background:linear-gradient(#253e60,#142741); border-color:#8ddbed; }
.duel-actions #duelBlock { background:linear-gradient(#47325d,#281f40); border-color:#d2aff6; }
.duel-action-symbol { font-size:1.2rem; }
.duel-action-power { font:700 .95rem var(--body); }
.duel-actions small { font:400 .7rem var(--body); }
.duel-burst { position:absolute; z-index:7; width:24px; height:24px; border-radius:50%; border:3px solid var(--fx-color,#ffe4a0); transform:translate(-50%,-50%); animation:duel-ring .65s ease-out forwards; pointer-events:none; }
.duel-spark { position:absolute; left:50%; top:50%; width:5px; height:5px; background:var(--fx-color,#ffe4a0); box-shadow:0 0 8px var(--fx-color,#ffe4a0); animation:duel-spark .6s ease-out forwards; }
.duel-fx-label { position:absolute; z-index:8; left:20%; right:20%; top:40%; color:var(--fx-color,#ffe4a0); font:.9rem var(--pixel); text-align:center; text-shadow:2px 2px #14152c,0 0 16px var(--fx-color,#ffe4a0); animation:duel-label .9s ease-out forwards; pointer-events:none; }
.duel-mage.casting img { animation:duel-cast .4s ease-out; }
.duel-mage.hurt img { animation:duel-recoil .4s ease-out; }
@keyframes duel-breathe { 50% { transform:translateY(-3px) rotate(.6deg); } }
@keyframes duel-shield { 50% { opacity:.65; transform:scale(1.025); } }
@keyframes duel-cast { 35% { transform:translateX(10px) rotate(-4deg); } }
@keyframes duel-recoil { 25% { transform:translateX(-9px) rotate(4deg); filter:brightness(1.8) drop-shadow(0 0 14px #fff); } }
@keyframes duel-ring { to { transform:translate(-50%,-50%) scale(7); opacity:0; } }
@keyframes duel-spark { to { transform:translate(var(--dx),var(--dy)); opacity:0; } }
@keyframes duel-label { 70% { opacity:1; } to { opacity:0; transform:translateY(-24px); } }
@media(max-width:600px) { .duel-arena { height:270px; } .duel-players { padding:9px 10px; gap:12px; } .duel-player { padding-left:0; } .duel-player.foe { padding-right:0; } .duel-portrait { display:none; } .duel-mage { width:clamp(120px,37%,180px); bottom:11%; } .duel-mage.you { left:0; } .duel-mage.foe { right:0; } .duel-arena-label { left:28%; right:28%; top:88px; font-size:.45rem; } .duel-actions { grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; } .duel-actions .btn { padding:9px 5px; font-size:.5rem; } .duel-actions small { font-size:.6rem; } .duel-bank-label { width:auto; flex:1; min-width:125px; } .duel-current { padding:10px; } #duelText { font-size:1.1rem; } }
@media(prefers-reduced-motion:reduce) { .duel-mage img,.duel-mage.warded::before,.duel-mage.casting img,.duel-mage.hurt img { animation:none; } .duel-burst,.duel-spark { display:none; } .duel-fx-label { animation:none; } }

.duel-arena .duel-result { position:absolute; z-index:20; top:50%; left:50%; transform:translate(-50%,-50%); width:65%; max-width:510px; box-sizing:border-box; text-align:center; background:linear-gradient(#293f83ee,#141e49f5); border-color:#ffe4a0; box-shadow:0 0 50px #050818aa; }
.duel-arena .duel-result h2 { font:.9rem var(--pixel); line-height:1.8; color:var(--gold); }
.duel-arena .duel-result p { font-size:.8rem; }
.duel-mage.victorious img { animation:duel-victory .75s ease-in-out infinite; }
.duel-mage.defeated img { animation:none; filter:grayscale(.7) opacity(.55); transform:rotate(-10deg) translateY(9px); }
@keyframes duel-victory { 50% { transform:translateY(-10px) rotate(-3deg); } }
@media(max-width:600px) { .duel-arena .duel-result { width:85%; padding:12px; } .duel-arena .duel-result h2 { font-size:.7rem; } }
@media(prefers-reduced-motion:reduce) { .duel-mage.victorious img,.duel-mage.defeated img { animation:none; transform:none; } }

.duel-word { display:inline-block; white-space:nowrap; }
.duel-actions .btn:disabled { opacity:.5; filter:saturate(.4); box-shadow:none; cursor:default; }
@media(max-width:600px) { .duel-mage { bottom:20%; } }

.duel-journey { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; margin:18px 0; }
.duel-journey-stop { display:grid; gap:9px; align-content:start; justify-items:center; padding:16px; color:var(--text); background:linear-gradient(#27396f,#151e44); font:inherit; text-align:center; cursor:pointer; }
.duel-journey-stop img { width:105px; height:105px; object-fit:contain; filter:drop-shadow(0 6px 6px #0006); }
.duel-journey-stop b { color:var(--gold); font-family:var(--pixel); font-size:.7rem; line-height:1.8; }
.duel-journey-stop small { font-size:.8rem; line-height:1.6; }
.duel-journey-stop:disabled { opacity:.45; filter:grayscale(.65); cursor:default; }
.duel-journey-stop:not(:disabled):hover { border-color:var(--gold); }
.duel-journey-stop .eyebrow { font-size:.55rem; }
.duel-arena .duel-result { max-height:95%; overflow-y:auto; }
