/* Duolingo-style Learning Path — SOGED Guna */

.duo-path {
    --duo-green: #58cc02;
    --duo-green-deep: #46a302;
    --duo-gold: #e3a008;
    --duo-blue: #1cb0f6;
    --duo-purple: #ce82ff;
    --duo-locked: #e5e5e5;
    --duo-locked-ink: #afafaf;
    --duo-ink: #3d1f0a;
    --duo-muted: #6b4f3a;
    --duo-surface: rgba(255, 254, 249, 0.92);
    --duo-track: #d7efc0;
    --duo-water: #1a8faf;
    --duo-sand: #f0d7a0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 1.5rem;
    align-items: start;
    padding: 1rem 0.5rem 2rem;
}

.duo-path__board {
    position: relative;
    border-radius: 28px;
    background:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(88, 204, 2, 0.08), transparent 60%),
        var(--duo-surface);
    border: 1px solid rgba(17, 128, 43, 0.15);
    box-shadow: 0 16px 40px rgba(61, 31, 10, 0.08);
    padding: 1.25rem 1rem 2.5rem;
    overflow: hidden;
}

.duo-path__board::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(227, 160, 8, 0.12), transparent 28%),
        radial-gradient(circle at 80% 60%, rgba(9, 115, 161, 0.1), transparent 30%);
}

.duo-path--islands .duo-path__board {
    background:
        radial-gradient(ellipse 70% 28% at 18% 12%, rgba(244, 196, 48, 0.16), transparent 46%),
        radial-gradient(ellipse 50% 22% at 86% 78%, rgba(28, 176, 246, 0.14), transparent 48%),
        linear-gradient(180deg, rgba(14, 148, 168, 0.16), rgba(17, 128, 43, 0.08) 42%, rgba(244, 226, 176, 0.12)),
        var(--duo-surface);
    border-color: rgba(14, 116, 144, 0.22);
}

.duo-path--islands .duo-path__board::before {
    opacity: 0.42;
    background-image:
        radial-gradient(circle at 12% 22%, rgba(255, 255, 255, 0.18), transparent 18%),
        radial-gradient(circle at 78% 38%, rgba(88, 204, 2, 0.12), transparent 22%),
        repeating-linear-gradient(115deg, transparent 0 18px, rgba(227, 160, 8, 0.05) 18px 20px);
}

.duo-waves {
    display: none;
}

.duo-path--islands .duo-waves {
    display: block;
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: -6px;
    height: 54px;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 40% 18px at 18% 60%, rgba(255, 255, 255, 0.28), transparent 70%),
        radial-gradient(ellipse 46% 20px at 52% 40%, rgba(255, 255, 255, 0.2), transparent 70%),
        radial-gradient(ellipse 38% 16px at 84% 70%, rgba(255, 255, 255, 0.24), transparent 70%);
    opacity: 0.7;
    animation: duoWaves 4.8s ease-in-out infinite;
}

@keyframes duoWaves {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(18px); }
}

.duo-progress-pill {
    position: sticky;
    top: 0.5rem;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto 1.25rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(17, 128, 43, 0.2);
    box-shadow: 0 6px 18px rgba(61, 31, 10, 0.08);
    font-weight: 800;
    color: var(--duo-ink);
    width: fit-content;
}

.duo-progress-pill i {
    color: var(--duo-gold);
}

.duo-path--islands .duo-progress-pill i {
    color: var(--duo-water);
    animation: duoWaves 2.8s ease-in-out infinite;
}

.duo-track {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.35rem;
    max-width: 480px;
    margin: 0 auto;
    padding: 0.5rem 0 1rem;
    z-index: 1;
}

.duo-track::before {
    content: "";
    position: absolute;
    top: 36px;
    bottom: 36px;
    left: 50%;
    width: 18px;
    transform: translateX(-50%);
    border-radius: 999px;
    background:
        repeating-linear-gradient(
            180deg,
            var(--duo-track) 0 14px,
            transparent 14px 22px
        );
    opacity: 0.95;
    z-index: 0;
    animation: duoTrackFlow 1.8s linear infinite;
    mask-image: linear-gradient(180deg, transparent, #000 8%, #000 92%, transparent);
}

.duo-path--islands .duo-track::before {
    display: none;
}

.duo-river {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.duo-river__glow {
    fill: none;
    stroke: rgba(255, 236, 170, 0.55);
    stroke-width: 22;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: blur(2px);
}

.duo-river__water {
    fill: none;
    stroke: var(--duo-water);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.88;
}

.duo-river__dash {
    fill: none;
    stroke: #f7fbff;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-dasharray: 10 16;
    animation: duoRiverDash 1.6s linear infinite;
}

.duo-river__progress {
    fill: none;
    stroke: #e3a008;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.95;
    filter: drop-shadow(0 0 6px rgba(227, 160, 8, 0.45));
}

.duo-peek {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(8px);
    min-width: 150px;
    padding: 0.55rem 0.7rem;
    border-radius: 14px;
    background: rgba(255, 254, 249, 0.96);
    border: 1px solid rgba(14, 116, 144, 0.22);
    box-shadow: 0 10px 22px rgba(61, 31, 10, 0.16);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 8;
}

.duo-peek strong {
    display: block;
    font-size: 0.82rem;
    color: var(--duo-ink);
}

.duo-peek span,
.duo-peek em {
    display: block;
    font-size: 0.68rem;
    font-style: normal;
    color: var(--duo-muted);
}

.duo-node-wrap:hover .duo-peek,
.duo-node:focus-visible ~ .duo-peek {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.duo-node-wrap:hover .duo-node:not(.duo-node--locked) {
    transform: translateY(-4px) scale(1.08);
}

.duo-ripple {
    position: absolute;
    inset: 8px;
    border-radius: inherit;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.35);
    opacity: 0;
}

.duo-node.is-ripple .duo-ripple {
    animation: duoRipple 0.45s ease-out;
}

@keyframes duoRipple {
    0% { transform: scale(0.4); opacity: 0.7; }
    100% { transform: scale(1.35); opacity: 0; }
}

@keyframes duoRiverDash {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -26; }
}

@keyframes duoTrackFlow {
    from { background-position: 0 0; }
    to { background-position: 0 22px; }
}

.duo-module {
    width: min(100%, 360px);
    margin: 0.75rem 0 0.25rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    text-align: center;
    background: linear-gradient(135deg, rgba(17, 128, 43, 0.1), rgba(227, 160, 8, 0.12));
    border: 1px solid rgba(17, 128, 43, 0.2);
    color: var(--duo-ink);
    z-index: 2;
}

.duo-path--islands .duo-module {
    background: linear-gradient(135deg, rgba(14, 148, 168, 0.16), rgba(227, 160, 8, 0.14));
    border-color: rgba(14, 116, 144, 0.28);
    animation: duoIslandIn 0.6s ease both;
}

.duo-module h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.duo-step {
    position: relative;
    width: 100%;
    min-height: 108px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    transform: translateX(var(--duo-x, 0));
    transition: transform 0.35s ease;
}

.duo-node-wrap {
    position: relative;
    width: 88px;
    height: 88px;
    display: grid;
    place-items: center;
    animation: duoIslandIn 0.55s ease both;
    animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes duoIslandIn {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.82);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.duo-island {
    display: none;
}

.duo-path--islands .duo-island {
    display: block;
    position: absolute;
    width: 104px;
    height: 46px;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 32%, var(--duo-sand) 0 38%, #d4b06a 52%, #2a9d8f 78%, #14707c 100%);
    box-shadow:
        0 10px 16px rgba(13, 80, 90, 0.22),
        inset 0 4px 0 rgba(255, 255, 255, 0.28);
    z-index: 0;
    pointer-events: none;
    animation: duoIslandFloat 3.4s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 90ms);
}

.duo-step.is-current .duo-island {
    box-shadow:
        0 0 0 6px rgba(28, 176, 246, 0.18),
        0 12px 20px rgba(14, 143, 201, 0.28);
}

.duo-step.is-locked .duo-island {
    filter: grayscale(0.45) brightness(0.92);
    animation: none;
}

@keyframes duoIslandFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-4px); }
}

.duo-node {
    width: 78px;
    height: 70px;
    border: none;
    border-radius: 50% / 46%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1.55rem;
    font-weight: 900;
    color: #fff;
    position: relative;
    z-index: 2;
    box-shadow:
        0 8px 0 rgba(0, 0, 0, 0.12),
        0 10px 20px rgba(61, 31, 10, 0.12);
    transition: transform 0.18s ease, filter 0.18s ease;
}

.duo-node__num {
    position: relative;
    z-index: 1;
    line-height: 1;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    pointer-events: none;
}

.duo-node__badge {
    position: absolute;
    top: -4px;
    right: -2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.62rem;
    background: #fff;
    color: var(--duo-green-deep);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 3;
}

.duo-node--locked .duo-node__badge {
    color: #7a7a7a;
}

.duo-node__badge--crown {
    color: #c47f00;
}

.duo-node.is-shake {
    animation: duoShake 0.45s ease;
}

.duo-node.is-hop {
    animation: duoHop 0.28s ease;
}

@keyframes duoShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px) rotate(-5deg); }
    40% { transform: translateX(7px) rotate(5deg); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes duoHop {
    0% { transform: scale(1) translateY(0); }
    45% { transform: scale(0.92) translateY(5px); }
    100% { transform: scale(1.08) translateY(-8px); }
}

.duo-node:hover:not(.duo-node--locked) {
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.duo-node:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}

.duo-node:focus-visible {
    outline: 3px solid var(--duo-blue);
    outline-offset: 3px;
}

.duo-node--completed {
    background: linear-gradient(180deg, #89e219 0%, var(--duo-green) 55%, var(--duo-green-deep) 100%);
}

.duo-node--current {
    background: linear-gradient(180deg, #7ed6ff 0%, var(--duo-blue) 55%, #0e8fc9 100%);
    animation: duoNodePulse 1.8s ease-in-out infinite;
}

.duo-node--locked {
    background: linear-gradient(180deg, #f2f2f2 0%, var(--duo-locked) 100%);
    color: var(--duo-locked-ink);
    cursor: pointer;
    box-shadow: 0 6px 0 #cfcfcf;
}

.duo-node--boss:not(.duo-node--locked) {
    background: linear-gradient(180deg, #f6d365 0%, var(--duo-gold) 45%, #c47f00 100%);
    color: #3d1f0a;
}

.duo-node--boss.duo-node--current {
    background: linear-gradient(180deg, #e8b0ff 0%, var(--duo-purple) 55%, #9b4dca 100%);
    color: #fff;
}

.duo-node.selected {
    filter: brightness(1.05);
    transform: scale(1.06);
}

@keyframes duoNodePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.duo-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid rgba(28, 176, 246, 0.35);
    animation: duoRing 1.8s ease-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes duoRing {
    0% { transform: scale(0.92); opacity: 0.9; }
    100% { transform: scale(1.25); opacity: 0; }
}

.duo-step .duo-mascot {
    position: absolute;
    top: -18px;
    right: -92px;
    width: 86px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    z-index: 4;
    animation: duoMascotBob 2.4s ease-in-out infinite;
    pointer-events: none;
}

.duo-step[style*="--duo-x: 72"],
.duo-step[style*="--duo-x: 120"] .duo-mascot,
.duo-step[style*="120px"] .duo-mascot {
    right: auto;
    left: -92px;
}

.duo-step.is-right .duo-mascot {
    right: auto;
    left: -92px;
}

.duo-step .duo-mascot img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(61, 31, 10, 0.22));
    transform-origin: 50% 80%;
}

.duo-speech {
    background: #fff;
    color: var(--duo-ink);
    border: 2px solid #e5e5e5;
    border-radius: 14px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(61, 31, 10, 0.1);
    animation: duoSpeechPop 2.4s ease-in-out infinite;
}

.duo-speech::after {
    content: "";
    position: absolute;
    /* kept simple without triangle for stability */
}

@keyframes duoMascotBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes duoSpeechPop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.duo-chest {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 42px;
    height: 36px;
    z-index: 3;
    filter: drop-shadow(0 4px 8px rgba(61, 31, 10, 0.18));
    animation: duoChestShine 2.8s ease-in-out infinite;
}

.duo-chest i {
    font-size: 1.7rem;
    color: #c47f00;
    background: linear-gradient(180deg, #f6d365, #c47f00);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 2px 0 #8a5a00);
}

.duo-chest--locked i {
    filter: grayscale(1) brightness(1.1);
    opacity: 0.7;
}

@keyframes duoChestShine {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.08); }
}

.duo-label {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    max-width: 140px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--duo-muted);
    line-height: 1.2;
    pointer-events: none;
}

.duo-path--islands .duo-label {
    top: calc(100% + 12px);
}

.duo-node-wrap:has(.duo-chest) .duo-label {
    top: calc(100% + 22px);
}

.duo-step:has(.duo-chest) {
    min-height: 128px;
    margin-bottom: 0.35rem;
}

.duo-step.is-current .duo-label {
    color: var(--duo-blue);
}

.duo-detail {
    position: sticky;
    top: 1rem;
    border-radius: 24px;
    background: rgba(255, 254, 249, 0.96);
    border: 1px solid rgba(17, 128, 43, 0.18);
    box-shadow: 0 16px 36px rgba(61, 31, 10, 0.1);
    padding: 1.35rem 1.25rem 1.4rem;
    color: var(--duo-ink);
}

.duo-detail__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    background: rgba(28, 176, 246, 0.12);
    color: #0e8fc9;
    margin-bottom: 0.75rem;
}

.duo-detail__badge.is-completed {
    background: rgba(88, 204, 2, 0.14);
    color: var(--duo-green-deep);
}

.duo-detail__badge.is-locked {
    background: rgba(0, 0, 0, 0.06);
    color: #888;
}

.duo-detail h3 {
    margin: 0 0 0.45rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--duo-ink);
}

.duo-detail p {
    margin: 0 0 1rem;
    color: var(--duo-muted);
    line-height: 1.55;
    font-size: 0.95rem;
}

.duo-detail__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1.15rem;
}

.duo-detail__stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(17, 128, 43, 0.08);
    color: #1a5c2e;
}

.duo-detail__cta {
    width: 100%;
    border: none;
    border-radius: 16px;
    padding: 0.95rem 1rem;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(180deg, #89e219, var(--duo-green));
    box-shadow: 0 5px 0 var(--duo-green-deep);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.duo-detail__cta:hover:not(:disabled) {
    filter: brightness(1.04);
}

.duo-detail__cta:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 2px 0 var(--duo-green-deep);
}

.duo-detail__cta:disabled {
    background: #cfcfcf;
    box-shadow: 0 5px 0 #b0b0b0;
    cursor: not-allowed;
}

.duo-detail__cta--review {
    background: linear-gradient(180deg, #7ed6ff, var(--duo-blue));
    box-shadow: 0 5px 0 #0e8fc9;
}

.duo-detail__empty {
    text-align: center;
    color: var(--duo-muted);
    padding: 1rem 0.5rem;
}

.duo-detail__mascot {
    width: 88px;
    height: 88px;
    margin: 0 auto 0.75rem;
    display: block;
    object-fit: contain;
    animation: duoMascotBob 2.4s ease-in-out infinite;
}

/* Hide legacy card layout when duo path is active */
.learning-section--guna .learning-path.learning-path--duo .path-container {
    display: none;
}

.learning-section--guna .learning-path.learning-path--duo {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    overflow: visible;
}

.learning-section--guna .learning-path.learning-path--duo::before,
.learning-section--guna .learning-path.learning-path--duo::after {
    display: none;
}

.learning-section--guna .learning-path.learning-path--duo .progress-indicator {
    display: none;
}

/* Dark mode */
body.dark-mode .duo-path,
html[data-theme="dark"] .duo-path {
    --duo-ink: #F3FBF5;
    --duo-muted: #B7D0C0;
    --duo-surface: rgba(18, 38, 26, 0.92);
    --duo-track: #2a4a34;
    --duo-locked: #24362b;
    --duo-locked-ink: #7fa892;
    --duo-water: #3ec6e0;
    --duo-sand: #c9a24a;
}

body.dark-mode .duo-path--islands .duo-path__board,
html[data-theme="dark"] .duo-path--islands .duo-path__board {
    background:
        radial-gradient(ellipse 70% 28% at 18% 12%, rgba(62, 198, 224, 0.16), transparent 46%),
        linear-gradient(180deg, rgba(10, 32, 40, 0.9), rgba(18, 38, 26, 0.96));
    border-color: #163222;
}

body.dark-mode .duo-river__water,
html[data-theme="dark"] .duo-river__water {
    stroke: #2aa8c4;
}

body.dark-mode .duo-river__dash,
html[data-theme="dark"] .duo-river__dash {
    stroke: rgba(243, 251, 245, 0.7);
}

body.dark-mode .duo-node__badge,
html[data-theme="dark"] .duo-node__badge {
    background: #163222;
    color: #b7f06a;
}

body.dark-mode .duo-path__board,
body.dark-mode .duo-detail,
body.dark-mode .duo-progress-pill,
body.dark-mode .duo-module,
body.dark-mode .duo-speech,
html[data-theme="dark"] .duo-path__board,
html[data-theme="dark"] .duo-detail,
html[data-theme="dark"] .duo-progress-pill,
html[data-theme="dark"] .duo-module,
html[data-theme="dark"] .duo-speech {
    background: rgba(18, 38, 26, 0.94);
    border-color: #163222;
    color: #F3FBF5;
}

body.dark-mode .duo-peek,
html[data-theme="dark"] .duo-peek {
    background: rgba(18, 38, 26, 0.96);
    border-color: #163222;
    color: #F3FBF5;
}

body.dark-mode .duo-peek strong,
html[data-theme="dark"] .duo-peek strong {
    color: #F3FBF5;
}

body.dark-mode .duo-detail__stats span,
html[data-theme="dark"] .duo-detail__stats span {
    background: rgba(88, 204, 2, 0.12);
    color: #b7f06a;
}

@media (max-width: 960px) {
    .duo-path {
        grid-template-columns: 1fr;
    }

    .duo-detail {
        position: relative;
        top: 0;
        order: -1;
    }

    .duo-step {
        transform: translateX(calc(var(--duo-x, 0) * 0.72));
    }

    .duo-step .duo-mascot {
        width: 70px;
        right: -74px;
    }

    .duo-step .duo-mascot img {
        width: 58px;
        height: 58px;
    }

    .duo-step.is-right .duo-mascot {
        left: -74px;
    }
}

@media (max-width: 520px) {
    .duo-node {
        width: 68px;
        height: 62px;
        font-size: 1.3rem;
    }

    .duo-node-wrap {
        width: 76px;
        height: 76px;
    }

    .duo-step {
        transform: translateX(calc(var(--duo-x, 0) * 0.5));
        min-height: 96px;
    }

    .duo-label {
        max-width: 110px;
        font-size: 0.68rem;
    }

    .duo-step .duo-mascot {
        display: none;
    }
}
