@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap');

#roadmap {
    --wood-bg: linear-gradient(to bottom, #92400e, #78350f);
    --wood-border: #a16207;
    --wood-text: #fef3c7;
    --wood-dark: #af7858;
    --nail-color: #4b5563;
    --info-btn: #2196F3;
    --info-shadow: #0960A5;
    --zoom-btn: #FFC107;
    --zoom-shadow: #B78C00;
    --success: #10b981;
    --tooltip-bg: #333;
    --tooltip-overlay: rgba(0, 0, 0, 0.7);
    --black-overlay: rgba(0, 0, 0, 0.5);
    --rating-star: #fbbf24;
    --cta-hover: #f59e0b;
    --arrow-color: #f6f0ff;
    --white: #fff;

    background: url(../../images/roadmap/sea.png) center center;
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    font-family: "Pixelify Sans", sans-serif;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#roadmap-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Tooltips */
.tooltip-group {
    position: absolute;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.tooltip-group.hover {
    opacity: 1;
    visibility: visible;
}

.tx-tooltip {
    background: var(--tooltip-bg);
    color: var(--white);
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: relative;
    z-index: 100;
    user-select: none;
    pointer-events: none;
}

.tx-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid var(--tooltip-bg);
    border-color: var(--tooltip-bg) transparent transparent transparent;
}

.tooltip-group img {
    image-rendering: pixelated;
    filter: drop-shadow(0px 0px 21px #000000);
}

/* Dialog */
.course-dialog {
    position: absolute;
    inset: 0;
}

.course-dialog-title {
    color: var(--white);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-family: inherit;
}

.course-meta {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

.course-rating {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

.rating-star {
    color: var(--rating-star);
    margin-right: 0.25rem;
}

/* Prerequisites */
.prerequisites-container {
    margin: 1rem 0;
}

.prerequisites-title {
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--wood-text);
    font-family: inherit;
    margin-bottom: 0.5rem;
}

.prerequisites-icon {
    margin-right: 0.5rem;
}

.prerequisites-list {
    list-style: none;
    background-color: var(--wood-dark);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.prerequisite-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--wood-text);
    padding: 0.25rem 0;
}

.check-icon {
    color: var(--success);
    margin-right: 0.5rem;
}

/* Controls */
.controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.tooltip-btn {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
}

.info-btn {
    background-color: var(--info-btn);
    box-shadow: 0 3px 0 var(--info-shadow);
}

.info-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--info-shadow);
}

.info-btn.disabled {
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(100%);
    opacity: 0.5;
}

.fit-map-btn {
    background-color: var(--zoom-btn);
    box-shadow: 0 3px 0 var(--zoom-shadow);
}

.fit-map-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--zoom-shadow);
}

.fit-map-btn::before {
    content: '';
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

.fit-map-btn.zoom-in::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v3a2 2 0 0 1-2 2H3'/%3E%3Cpath d='M21 8h-3a2 2 0 0 1-2-2V3'/%3E%3Cpath d='M3 16h3a2 2 0 0 1 2 2v3'/%3E%3Cpath d='M16 21v-3a2 2 0 0 1 2-2h3'/%3E%3C/svg%3E");
}

.fit-map-btn.zoom-out::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3H5a2 2 0 0 0-2 2v3'/%3E%3Cpath d='M21 8V5a2 2 0 0 0-2-2h-3'/%3E%3Cpath d='M3 16v3a2 2 0 0 0 2 2h3'/%3E%3Cpath d='M16 21h3a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E");
}

.btn-tx-tooltip {
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    transform: translateY(-50%);
    background-color: var(--tooltip-overlay);
    color: var(--white);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s;
    opacity: 0;
    visibility: hidden;
}

/* Signboards - Base */
.signboard {
    background: var(--wood-bg);
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 4px solid var(--wood-border);
    padding: 8px 24px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50px) rotateX(-15deg);
    transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.signboard.tx-show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.signboard.swing-animation {
    animation: swingIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Signboard Types */
.signboard-head {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    max-width: 340px;
}

.signboard-stats {
    display: flex;
    gap: 16px;
    position: absolute;
    top: 10px;
    right: 10px;
}

.signboard-description {
    position: absolute;
    left: 10px;
    bottom: 10px;
    max-width: 340px;
    color: var(--wood-text);
}

.signboard-description .stat-content {
    max-height: 110px;
    overflow-y: auto;
    display: block;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* Signboard Content */
.sign-content {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--wood-text);
}

.sign-content .course-dialog-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--wood-text);
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.sign-image {
    width: 50px;
    height: 100%;
    object-fit: contain;
}

.stat-content {
    padding: 2px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-content .stat-text {
    color: var(--wood-text);
    font-size: 14px;
    font-weight: 500;
}

/* Nails */
.nail {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--nail-color);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nail-top-left {
    top: 8px;
    left: 8px;
}

.nail-top-right {
    top: 8px;
    right: 8px;
}

.nail-bottom-left {
    bottom: 8px;
    left: 8px;
}

.nail-bottom-right {
    bottom: 8px;
    right: 8px;
}

/* CTA Elements */
.signboard-stats .signboard-cta {
    position: absolute;
    top: calc(100% + 10px);
    width: 100%;
}

.signboard-cta .cta-text {
    color: var(--wood-text);
    transition: .2s color ease;
}

.signboard-cta .cta-link {
    position: absolute;
    inset: 0;
}

.sb-bottom.signboard-cta {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: none;
    justify-content: center;
    align-items: center;
    background-color: var(--black-overlay);
    border-radius: 8px;
    padding: 8px;
    width: calc(100% - 80px);
}

/* Scroll Arrow */
.scroll-arrow {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--arrow-color);
    animation: bounce 1.5s infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.scroll-arrow.visible {
    opacity: 1;
}

/* Mobile Instructions */
.mobile-instructions {
    display: none;
    margin-top: 20px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.instruction-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.instruction-text {
    font-size: small;
}

/* Animations */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-4px);
    }

    60% {
        transform: translateY(-2px);
    }
}

@keyframes swingIn {
    0% {
        transform: rotateX(-90deg) translateY(-50px);
        opacity: 0;
    }

    50% {
        transform: rotateX(10deg) translateY(-10px);
        opacity: 0.8;
    }

    100% {
        transform: rotateX(0deg) translateY(0);
        opacity: 1;
    }
}

/* Media Queries */
@media (max-width: 990px) {
    .mobile-instructions {
        display: block;
    }

    #roadmap {
        aspect-ratio: unset;
        height: 96dvh;
    }

    .signboard-stats {
        display: none;
    }

    .signboard.signboard-description {
        bottom: 70px;
        max-width: unset;
        width: calc(100% - 80px);
    }

    .signboard.signboard-head {
        width: calc(100% - 20px);
        max-width: unset;
    }

    .sb-bottom.signboard-cta {
        display: block;
    }
}

@media (hover: hover) and (pointer: fine) {
    .info-btn:hover {
        filter: brightness(1.1);
    }

    .info-btn:hover .btn-tx-tooltip {
        visibility: visible;
        opacity: 1;
    }

    .fit-map-btn:hover {
        filter: brightness(1.1);
    }

    .fit-map-btn:hover .btn-tx-tooltip {
        visibility: visible;
        opacity: 1;
    }

    .signboard-cta:hover .cta-text {
        color: var(--cta-hover);
    }
}