html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

#map {
    width: 100%;
    height: 100vh;
}

/* ===========================
   Legend
   =========================== */

#legend {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;

    font-family: sans-serif;

    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Header behaves like a button */

#legendHeader {
    display: inline-flex;
    align-items: center;

    background: rgba(255,255,255,.96);

    padding: 8px 12px;

    border: 1px solid #999;
    border-radius: 6px;

    box-shadow: 0 1px 5px rgba(0,0,0,.18);

    font-size: 18px;
    font-weight: bold;

    cursor: pointer;
    user-select: none;
}

/* Little hover feedback */

#legendHeader:hover {
    background: white;
}

/* Dropdown panel */

#legendPanel {

    width: 300px;

    margin-top: 0;

    align-self: flex-end;

    background: rgba(255,255,255,.96);

    border: 1px solid #999;

    border-top-left-radius: 0;
    border-top-right-radius: 0;

    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;

    box-shadow: 0 1px 5px rgba(0,0,0,.18);

    padding: 10px;

    max-height: 70vh;

    overflow-y: auto;
}

/* Hidden */

#legendPanel.collapsed {
    display: none;
}

/* SVG */

#legendBody img {

    display: block;

    width: 90%;
    height: auto;
}

#legendHeader.expanded {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

#legendPanel {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#legendHeader.expanded {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;

    border-bottom: none;
}