:root {
    --accent: #28a956;
    --accent-dark: #208a3d;
    --accent-fade: #111316;
    --bg: #181d22;
    --shadow: 0 2px 24px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", sans-serif;
    background: #181b20;
    color: #e0e6ed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.section-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.trace-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #22262c;
    padding: 12px 48px;
    border-bottom: 1.5px solid #232a33;
    flex-shrink: 0;
}

.trace-bar .brand {
    display: flex;
    align-items: center;
    gap: 4px;
}

.trace-bar .brand h1 a {
    text-decoration: none;
    color: #e0e6ed;
}

.trace-bar .brand svg {
    height: 42px;
    width: 42px;
}

.trace-bar .section-title {
    color: #78f5c6;
}

/* Main container */
.main-flex {
    flex: 1;
    display: flex;
    background-color: #0d1117;
    box-shadow: 0 2px 40px rgba(20, 32, 44, 0.15);
    overflow: auto;
    min-height: 0;
    /* fix flexbox scroll issues */
}

/* Upload area */
.upload-side {
    flex: 0 0 320px;
    max-width: 360px;
    background: #191e24;
    border-right: 1.5px solid #21252d;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.upload-side h2 {
    color: #78f5c6;
    margin-bottom: 20px;
}

.img-slot {
    width: 100%;
    max-width: 240px;
    aspect-ratio: 1 / 1;
    background: #0d1117;
    border: 2px dashed #79e3b7;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 18px;
    overflow: hidden;
}

.img-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
}

.slot-placeholder {
    color: #7a8ca2;
    text-align: center;
}

.upload-label {
    background: linear-gradient(100deg, #29a459 60%, #63d8a7 100%);
    color: #14312c;
    padding: 12px 25px;
    margin-bottom: 8px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(24, 97, 76, 0.18);
    cursor: pointer;
}

.upload-label:active,
.upload-label:focus {
    background: #146b39;
    color: #cafff0;
}

input[type="file"] {
    display: none;
}

.info {
    color: #67eeb5;
}


/* right panel */
.right-side {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: center;
    overflow-y: scroll;
}

/* Shimmer effect */
.shimmer-loader {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    background: rgba(20, 26, 32, 0.84);
    border-radius: 22px;
}

.shimmer-content {
    width: 180px;
    height: 36px;
    border-radius: 6px;
    background: linear-gradient(90deg, #23262e 25%, #32383e 50%, #23262e 75%);
    background-size: 300% 100%;
    animation: shimmer 1.2s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* Anim panel */
.anim-panel {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: auto;
}

.anim-panel h2 {
    color: #78f5c6;
    margin-bottom: 20px;
}

.anim-area {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 11 / 10;
    border-radius: 22px;
    box-shadow: 0 4px 28px rgba(8, 16, 28, 0.14);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.anim-placeholder {
    color: #4e6074;
    text-align: center;
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
    font-size: 1.1rem;
}

#animationCanvas {
    width: 100%;
    height: 100%;
    background: #23262e;
    border-radius: 22px;
    box-shadow: 0 4px 28px rgba(8, 16, 28, 0.14);
}

.actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.actions button {
    background: linear-gradient(100deg, #22693e 60%, #2eb495 100%);
    color: #e2f6eb;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
}

.actions button:disabled {
    background: #20272b;
    color: #48655a;
    cursor: not-allowed;
}

/* Extension styles for narration panel matching existing palette */
#descriptionSection {
    display: none;
    width: 70%;
    max-width: 1200px;
    margin: 40px auto;
    margin-bottom: 80px;
    background: #191e24;
    border: 1px solid #2d333b;
    border-radius: 28px;
    padding: 28px 34px 34px;
    box-shadow: 0 2px 34px rgba(12, 18, 22, 0.4);
}

#descriptionSection.show {
    display: block;
    margin-bottom: 80px !important;
    animation: fadeIn 0.25s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#kolamDescription {
    margin: 0;
    padding: 18px 20px;
    background: #191e24;
    border: 1px solid #2a3036;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    color: #d5dde4;
    box-shadow: inset 0 0 0 1px #1f2429;
}

.desc-header {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    align-items: flex-start;
}

.desc-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #78f5c6;
}

.narration-mode {
    background: #191e24;
    border: 1px solid #30363d;
    padding: 12px 16px 10px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.narration-mode fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.narration-mode legend {
    font-size: 12px;
    letter-spacing: 1px;
    color: #9fb4c3;
    margin-bottom: 6px;
}

.narration-mode label {
    display: block;
    font-size: 12.5px;
    margin: 4px 0;
    color: #c9d1d9;
}

.narration-mode input {
    margin-right: 6px;
}

.source-tag {
    display: inline-block;
    background: #30363d;
    color: #9fb4c3;
    font-size: 11px;
    letter-spacing: 0.8px;
    padding: 5px 10px;
    border-radius: 20px;
}

.loading-description {
    background: #1c2128;
    border: 1px solid #30363d;
    padding: 14px 18px;
    border-radius: 12px;
    font-style: italic;
    color: #8b949e;
}

@media (max-width: 1000px) {}

.hidden {
    display: none;
}

.flex-grow {
    flex: 1;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
}

/* Extension styles for narration panel matching existing palette */
#descriptionSection {
    display: none;
    width: 70%;
    max-width: 1200px;
    margin: 40px auto;
    margin-bottom: 80px;
    background: #191e24;
    border: 1px solid #2d333b;
    border-radius: 28px;
    padding: 28px 34px 34px;
    box-shadow: 0 2px 34px rgba(12, 18, 22, 0.4);
}

#descriptionSection.show {
    display: block;
    margin-bottom: 80px !important;
    animation: fadeIn 0.25s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#kolamDescription {
    margin: 0;
    padding: 18px 20px;
    background: #191e24;
    border: 1px solid #2a3036;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    max-height: 320px;
    overflow: auto;
    white-space: pre-wrap;
    color: #d5dde4;
    box-shadow: inset 0 0 0 1px #1f2429;
}

.desc-header {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    align-items: flex-start;
}

.desc-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #78f5c6;
}

.narration-mode {
    background: #191e24;
    border: 1px solid #30363d;
    padding: 12px 16px 10px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.narration-mode fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

.narration-mode legend {
    font-size: 12px;
    letter-spacing: 1px;
    color: #9fb4c3;
    margin-bottom: 6px;
}

.narration-mode label {
    display: block;
    font-size: 12.5px;
    margin: 4px 0;
    color: #c9d1d9;
}

.narration-mode input {
    margin-right: 6px;
}

.source-tag {
    display: inline-block;
    background: #30363d;
    color: #9fb4c3;
    font-size: 11px;
    letter-spacing: 0.8px;
    padding: 5px 10px;
    border-radius: 20px;
}

.loading-description {
    background: #1c2128;
    border: 1px solid #30363d;
    padding: 14px 18px;
    border-radius: 12px;
    font-style: italic;
    color: #8b949e;
}

@media (max-width: 1000px) {}

.hidden {
    display: none;
}

.flex-grow {
    flex: 1;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
}

/* Responsive */
@media (max-width: 1000px) {
    .main-flex {
        flex-direction: column;
    }

    .upload-side {
        width: 100%;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid #23262e;
    }

    .anim-panel {
        padding: 20px;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .trace-bar {
        padding: 12px 16px;
    }

    .section-title {
        display: none;
    }

    .anim-area {
        max-width: 100%;
        aspect-ratio: 1 / 1;
    }

    .upload-side,
    .anim-panel {
        padding: 12px 16px;
    }

    .upload-side h2,
    .anim-panel h2 {
        font-size: 1.1rem;
    }
}

#downloadPoints,
#downloadJSON {
    color: #ffbf009c;
    /* Amber */
    text-decoration: none;
    /* Optional: remove underline */
    font-weight: bold;
    /* Optional: make it stand out */
}

#downloadPoints:hover,
#downloadJSON:hover {
    color: #FFB300;
    /* Slightly darker amber on hover */
}