/*
 * fuse.css — Fusion Lab (route /fuse, js/pages/fuse.js).
 * 2026-09-10 redesign to a 3-column craft screen per a user reference
 * (AFK-Journey-style artifact screen): a left material rail, a center
 * "fusion chamber" (3 slots as a triangle around a predicted-result core +
 * a chance meter + an effect blurb), a right stage with a big result orb
 * and an E→U grade ladder, and a floating bottom-right action cluster.
 * Cream-on-tan palette kept. The full-viewport "fusion ritual" overlay
 * (.fuse-anim-* / .fuse-result-* / .fuse-used-* below) is unchanged.
 */

.fuse2-wrap {
    position: relative; z-index: 2; flex: 1; min-height: 0;
    display: flex; gap: 14px; padding: 14px 18px 14px 14px;
}

/* ── Left: material rail ────────────────────────────────────────────── */
.fuse2-rail {
    flex: 0 0 220px; display: flex; flex-direction: column; min-height: 0;
    padding: 12px 10px;
}
.fuse2-rail-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 14px; font-weight: 800; letter-spacing: .5px; color: #2c1a08;
    padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid rgba(58,36,16,.14);
}
.fuse2-rail-head span:last-child { font-size: 12px; font-weight: 600; color: #8a6a48; font-family: var(--font-mono); }

.fuse2-grades { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.fuse2-grade {
    padding: 4px 9px; border-radius: 6px; cursor: pointer;
    font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: .5px;
    color: #8a6a48; background: rgba(58,36,16,.07); border: 1px solid rgba(58,36,16,.16);
    transition: filter .12s;
}
.fuse2-grade:hover { filter: brightness(1.12); }

.fuse2-rail-list { flex: 1; overflow-y: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 8px; }
.fuse2-rail-list::-webkit-scrollbar { display: none; }

.fuse2-mat {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 4px; border-radius: 12px; cursor: pointer;
    transition: background .12s;
}
.fuse2-mat:hover { background: rgba(58,36,16,.06); }
.fuse2-mat.in-slot { background: rgba(200,100,26,.12); }
.fuse2-mat.spent { opacity: .4; }
.fuse2-mat-orb {
    position: relative; width: 62px; height: 62px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 28px;
    background: radial-gradient(circle at 50% 35%, #fff6e6, #f3d3a4 72%, #e0b070);
    border: 3px solid var(--gc, #6e7681);
    box-shadow: inset 0 0 8px rgba(255,255,255,.5);
}
.fuse2-mat-orb img { width: 68%; height: 68%; object-fit: contain; image-rendering: pixelated; }
.fuse2-mat-badge {
    position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center; border-radius: 999px;
    color: #fff8ec; font-size: 11px; font-weight: 800; font-family: var(--font-mono);
    border: 1.5px solid #fffdf8;
}
.fuse2-mat-name {
    font-size: 12px; font-weight: 700; color: #2c1a08; text-align: center; line-height: 1.2;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fuse2-mat-qty { font-size: 12px; font-weight: 800; font-family: var(--font-mono); }

/* ── Center: fusion chamber ─────────────────────────────────────────── */
.fuse2-chamber {
    flex: 0 1 380px; min-width: 280px; display: flex; flex-direction: column; gap: 12px;
    padding: 14px 16px 16px; overflow-y: auto; scrollbar-width: none;
}
.fuse2-chamber::-webkit-scrollbar { display: none; }

.fuse2-chamber-head { display: flex; align-items: center; gap: 10px; }
.fuse2-chamber-ic {
    width: 42px; height: 42px; flex-shrink: 0; font-size: 21px;
    display: flex; align-items: center; justify-content: center; border-radius: 10px;
    background: rgba(200,100,26,.14); border: 1.5px solid rgba(200,100,26,.4);
}
.fuse2-chamber-tt { flex: 1; min-width: 0; }
.fuse2-chamber-title { font-size: 15px; font-weight: 800; color: #2c1a08; letter-spacing: .5px; }
.fuse2-chamber-sub { display: block; font-size: 12px; color: #8a6a48; margin-top: 1px; }
.fuse2-chance-pill {
    flex-shrink: 0; font-family: var(--font-mono); font-size: 14px; font-weight: 800;
    color: #7c3fd1; background: rgba(124,63,209,.12); border: 1px solid rgba(124,63,209,.35);
    border-radius: 999px; padding: 5px 12px;
}

/* triangle of 3 slots around a center core */
.fuse2-diamond { position: relative; width: 100%; height: 252px; flex-shrink: 0; }
.fuse2-lines { position: absolute; inset: 0; width: 100%; height: 100%; }

.fuse2-slot {
    position: absolute; width: 98px; height: 98px; margin: -49px 0 0 -49px;
    border-radius: 50%; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    transition: filter .12s, transform .12s;
}
.fuse2-slot.pos-top { left: 50%; top: 26px; }
.fuse2-slot.pos-bl  { left: 26%; top: 79%; }
.fuse2-slot.pos-br  { left: 74%; top: 79%; }
.fuse2-slot.empty { border: 2px dashed rgba(58,36,16,.28); background: rgba(58,36,16,.04); cursor: default; }
.fuse2-slot.filled { border: 3px solid var(--gc, #c8641a); background: color-mix(in srgb, var(--gc) 12%, #fffdf8); }
.fuse2-slot.filled:hover { transform: scale(1.05); }
.fuse2-slot-orb {
    width: 54px; height: 54px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 27px;
    background: radial-gradient(circle at 50% 35%, #fff6e6, #f3d3a4 72%, #e0b070);
}
.fuse2-slot.empty .fuse2-slot-orb { background: rgba(58,36,16,.06); }
.fuse2-slot-orb img { width: 68%; height: 68%; object-fit: contain; image-rendering: pixelated; }
.fuse2-slot-lbl { font-size: 10px; letter-spacing: 1.5px; color: rgba(58,36,16,.4); font-family: var(--font-mono); }
.fuse2-slot-grade {
    position: absolute; bottom: -7px; font-size: 10px; font-weight: 800; color: #fff8ec;
    padding: 2px 7px; border-radius: 999px; border: 1.5px solid #fffdf8;
}
.fuse2-slot-x {
    position: absolute; top: 2px; right: 6px; font-size: 11px; color: #a3291d; opacity: 0; transition: opacity .12s;
}
.fuse2-slot.filled:hover .fuse2-slot-x { opacity: .85; }

.fuse2-core {
    position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px;
    border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(circle, #fff, rgba(255,255,255,.4) 70%);
    border: 2px solid rgba(58,36,16,.2);
}
.fuse2-core.has { border-color: var(--gc); background: radial-gradient(circle, color-mix(in srgb, var(--gc) 20%, #fff), #fff 72%); box-shadow: 0 0 14px color-mix(in srgb, var(--gc) 40%, transparent); }
.fuse2-core-q { font-size: 30px; font-weight: 800; color: rgba(58,36,16,.35); }
.fuse2-core-hint { font-size: 10.5px; font-family: var(--font-mono); color: #8a6a48; }
.fuse2-core-grade { font-size: 24px; font-weight: 800; color: #2c1a08; line-height: 1; }
.fuse2-core-up { font-size: 9.5px; font-family: var(--font-mono); font-weight: 700; color: #7c3fd1; margin-top: 3px; }

.fuse2-chance {
    background: rgba(124,63,209,.06); border: 1px solid rgba(124,63,209,.22);
    border-radius: 9px; padding: 11px 14px;
}
.fuse2-chance-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.fuse2-chance-row span:first-child { font-size: 12px; letter-spacing: 1.5px; font-weight: 700; color: #7c3fd1; }
.fuse2-chance-row span:last-child { font-family: var(--font-mono); font-size: 17px; font-weight: 800; color: #7c3fd1; }
.fuse2-chance-track { height: 7px; border-radius: 4px; background: rgba(124,63,209,.14); overflow: hidden; }
.fuse2-chance-fill { height: 100%; background: linear-gradient(90deg,#7c3fd1,#a371f7); border-radius: 4px; }

.fuse2-effect {
    display: flex; gap: 12px; align-items: flex-start;
    background: rgba(58,36,16,.05); border: 1px solid rgba(58,36,16,.12);
    border-radius: 10px; padding: 12px 14px;
}
.fuse2-effect-ic {
    width: 36px; height: 36px; flex-shrink: 0; font-size: 18px;
    display: flex; align-items: center; justify-content: center; border-radius: 9px;
    background: rgba(200,100,26,.14); color: #c8641a;
}
.fuse2-effect-name { font-size: 14px; font-weight: 800; color: #2c1a08; display: flex; align-items: center; gap: 7px; }
.fuse2-effect-tag {
    font-size: 9.5px; font-weight: 800; letter-spacing: .5px; color: #fff8ec;
    background: #c8641a; border-radius: 4px; padding: 2px 6px;
}
.fuse2-effect-desc { font-size: 13px; color: #6b4520; line-height: 1.5; margin-top: 5px; }

/* ── Right: stage (orb + grade ladder) ──────────────────────────────── */
.fuse2-stage {
    flex: 1; min-width: 0; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.fuse2-orb {
    position: relative; width: 258px; height: 258px;
    display: flex; align-items: center; justify-content: center;
}
.fuse2-orb-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 3px dashed rgba(200,100,26,.4);
    animation: fuse2-spin 24s linear infinite;
}
.fuse2-orb.ready .fuse2-orb-ring { border-color: var(--gc); border-style: solid; box-shadow: 0 0 40px color-mix(in srgb, var(--gc) 45%, transparent), inset 0 0 40px color-mix(in srgb, var(--gc) 30%, transparent); animation-duration: 8s; }
.fuse2-orb-ring.idle { opacity: .5; }
@keyframes fuse2-spin { to { transform: rotate(360deg); } }

.fuse2-orb-core {
    width: 152px; height: 152px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 52px; font-weight: 800; color: #2c1a08;
    background: radial-gradient(circle at 50% 38%, #fff8ec, #f0d8b4 68%, #e0bd8e);
    box-shadow: inset 0 0 24px rgba(255,255,255,.6), 0 6px 18px rgba(58,36,16,.28);
}
.fuse2-orb-core.idle { color: rgba(58,36,16,.4); font-size: 46px; }
.fuse2-orb.ready .fuse2-orb-core { background: radial-gradient(circle at 50% 38%, #fff, color-mix(in srgb, var(--gc) 24%, #fff) 70%); color: var(--gc); text-shadow: 0 2px 10px color-mix(in srgb, var(--gc) 55%, transparent); }

.fuse2-orb-cap {
    position: absolute; bottom: -58px; left: 50%; transform: translateX(-50%);
    text-align: center; white-space: nowrap;
    font-size: 13.5px; color: #8a6a48; line-height: 1.5;
}
.fuse2-orb-cap b { color: #7c3fd1; font-family: var(--font-mono); }

.fuse2-ladder {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 4px;
}
.fuse2-rung {
    width: 32px; height: 25px; display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 12px; font-weight: 800;
    color: rgba(58,36,16,.4); background: rgba(58,36,16,.05);
    border: 1px solid rgba(58,36,16,.12); border-radius: 6px;
    transition: all .15s;
}
.fuse2-rung.on { color: var(--gc); background: color-mix(in srgb, var(--gc) 14%, transparent); border-color: color-mix(in srgb, var(--gc) 50%, transparent); }
.fuse2-rung.result { transform: scale(1.15); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gc) 40%, transparent); }
.fuse2-rung.target { border-style: dashed; }

/* ── Bottom-right floating actions ──────────────────────────────────── */
.fuse2-actions {
    position: absolute; right: 22px; bottom: 78px; z-index: 3;
    display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.fuse2-act {
    border: 1px solid rgba(58,36,16,.2); cursor: pointer;
    background: rgba(255,248,236,.9); color: #6b4520;
    font-size: 13px; font-weight: 700; letter-spacing: .5px;
    padding: 10px 17px; border-radius: 999px; transition: filter .12s, transform .1s;
    box-shadow: 0 3px 10px rgba(58,36,16,.15);
}
.fuse2-act:hover:not(:disabled) { filter: brightness(1.05); }
.fuse2-act:active:not(:disabled) { transform: translateY(1px); }
.fuse2-act.primary {
    background: linear-gradient(180deg,#f0883e,#c8641a); color: #fff8ec; border-color: transparent;
    font-size: 14px; font-weight: 800; letter-spacing: 1.5px; padding: 13px 26px;
}
.fuse2-act:disabled { opacity: .5; cursor: default; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@container (max-width: 980px) {
    .fuse2-wrap { flex-direction: column; overflow-y: auto; padding: 10px 12px 90px; }
    .fuse2-rail { flex: 0 0 auto; }
    .fuse2-rail-list { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
    .fuse2-mat { flex: 0 0 64px; }
    .fuse2-chamber { flex: 1 1 auto; }
    .fuse2-stage { min-height: 340px; }
    .fuse2-actions { position: static; flex-direction: row; align-items: stretch; margin-top: 10px; }
    .fuse2-act, .fuse2-act.primary { flex: 1; text-align: center; }
}

/* ══════════════════════════════════════════════════════════════════════
 * Fuse ritual animation — js/pages/fuse.js's beginFuseAnimation().
 * Full-viewport overlay: screen dims, the 3 filled slots' orb icons are
 * cloned at their exact on-screen rect and flung toward centre (spinning
 * + shrinking) with a ring of particles, then a bright core flash morphs
 * into a held result modal. Unchanged from the pre-redesign version.
 * ════════════════════════════════════════════════════════════════════ */
.fuse-anim-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(10,5,2,0); pointer-events: none; overflow: hidden;
    transition: background .25s ease;
}
.fuse-anim-overlay.converging { background: rgba(10,5,2,.72); }
.fuse-anim-overlay.fading { background: rgba(10,5,2,0); }
.fuse-anim-overlay.fading .fuse-anim-core,
.fuse-anim-overlay.fading .fuse-anim-flyer { opacity: 0 !important; transition: opacity .3s ease; }

.fuse-anim-flyer {
    position: fixed; z-index: 2; margin: 0;
    transform: translate(0,0) rotate(0deg) scale(1);
    transition: transform 2.2s cubic-bezier(.55,0,.85,.35), opacity 2.2s ease .9s;
}
.fuse-anim-flyer.flying {
    transform: translate(var(--dx), var(--dy)) rotate(var(--spin, 720deg)) scale(.2);
    opacity: .25;
}

.fuse-anim-particle {
    position: fixed; left: 50%; top: 50%; z-index: 1;
    width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
    background: radial-gradient(circle, #ffd98e, #c8641a 70%, transparent);
    opacity: 0;
    animation: fuse-particle-in 2.2s cubic-bezier(.55,0,.85,.35) forwards;
}
@keyframes fuse-particle-in {
    0%   { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
    15%  { opacity: 1; }
    100% { transform: translate(0,0) scale(0); opacity: 0; }
}

.fuse-anim-core {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.4);
    z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 10px;
    width: 0; height: 0; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,217,142,.9), rgba(200,100,26,0) 70%);
    opacity: 0; pointer-events: auto;
    transition: width .3s ease, height .3s ease, opacity .3s ease;
}
.fuse-anim-core.charging {
    width: 90px; height: 90px; opacity: 1;
    animation: fuse-core-charge .45s ease-in-out infinite alternate;
}
@keyframes fuse-core-charge {
    0%   { transform: translate(-50%,-50%) scale(.85); filter: brightness(1); }
    100% { transform: translate(-50%,-50%) scale(1.2); filter: brightness(1.5); }
}
.fuse-anim-core.burst {
    width: 260px; height: 260px; opacity: 1;
    animation: fuse-core-pulse .6s ease-out;
}
@keyframes fuse-core-pulse {
    0%   { transform: translate(-50%,-50%) scale(.4); }
    60%  { transform: translate(-50%,-50%) scale(1.15); }
    100% { transform: translate(-50%,-50%) scale(1); }
}
.fuse-anim-core.panel {
    width: min(340px, 90vw); height: auto; max-height: 82vh; overflow-y: auto;
    border-radius: 14px; background: linear-gradient(180deg,#ecdcbb,#dcc79a);
    border: 2px solid rgba(200,100,26,.55);
    box-shadow: 0 16px 44px rgba(10,5,2,.55);
    padding: 26px 20px 20px; color: #3a2410; text-align: center;
    animation: fuse-modal-pop .4s cubic-bezier(.34,1.56,.64,1) both;
    scrollbar-width: none;
}
.fuse-anim-core.panel::-webkit-scrollbar { display: none; }
@keyframes fuse-modal-pop {
    0%   { transform: translate(-50%,-50%) scale(.7); opacity: 0; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
}
.fuse-anim-result {
    width: 84px !important; height: 84px !important; font-size: 40px !important;
    border-width: 2px; border-style: solid; margin: 4px 0 !important;
}
.fuse-anim-close-btn { width: 100%; margin-top: 12px; }

.fuse-upgrade-tag {
    margin-bottom: 8px; font-family: var(--font-mono);
    font-size: 11.5px; letter-spacing: 2px; color: #7c3fd1;
    background: rgba(163,80,247,.12); border: 1px solid rgba(163,80,247,.4);
    padding: 4px 12px; border-radius: 4px; display: inline-block;
}
.fuse-result-name { font-size: 13px; font-weight: 800; color: #2c1a08; margin: 6px 0 4px; }
.fuse-result-arrow { font-size: 11.5px; color: #7c3fd1; font-family: var(--font-mono); }
.fuse-result-desc { font-size: 11.5px; color: #6b4520; margin-top: 8px; line-height: 1.4; }
.fuse-used-row { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 10px; }
.fuse-used-chip {
    display: flex; align-items: center; gap: 5px; padding: 3px 8px;
    background: rgba(58,36,16,.08); border-radius: 4px; border: 1px solid rgba(58,36,16,.15);
    font-size: 10.5px; color: #6b4520; font-family: var(--font-mono);
}
.fuse-used-icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fuse-used-icon img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
