﻿:root {
    --deg: 0;
    --needle-north: #FFC107;
    --needle-south: #ccc;
}

.compass {
    position: relative;
    /*width: 200px;*/
    height: 60%;
    aspect-ratio: 1 / 1;
    border: 4px solid #ccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.labels span {
    position: absolute;
    font-weight: bold;
    font-size: 18px;
}

.labels .n {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.labels .s {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.labels .e {
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.labels .w {
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.needle-wrap {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(calc(var(--deg) * 1deg));
    transition: transform 0.3s ease;
}

.needle {
    position: relative;
    width: 0;
    height: 0;
}

.needle {
    position: relative;
    width: 100%;
    height: 100%;
}

/* north half */
.needle-north {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 8%; /* relative thickness */
    height: 40%; /* relative length */
    background: var(--needle-north);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* south half */
.needle-south {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 8%;
    height: 35%;
    background: var(--needle-south);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.cap {
    position: absolute;
    width: 6%;
    height: 6%;
    background: #333;
    border-radius: 50%;
    z-index: 2;
}

.readout {
    margin-top: 16px;
    font-size: 20px;
    font-weight: bold;
}
