#notes {
    grid-area: notes;
    position: sticky;
    margin: 1rem;
    box-sizing: border-box;
    background: #99866e;
    border: 0.5rem solid #664c2e;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    z-index: 1;
    overflow: scroll;
}
#notes header {
    padding: 0.5rem;

    background: #664c2e;
    color: #f5ead7;

    font-weight: bold;
    text-align: center;

    touch-action: manipulation;
    pointer-events: auto;
    user-select: none;
    
}
#notes header:hover {
    background: #7a5d3d;
    cursor: pointer;
    font-size: 1.1rem;
    color: #fcf8f1;
    padding-top: 0.45rem;
}
#notes header:active {
    background: #473624;
    font-size: 1rem;
    cursor:grabbing;
    color: #948469;
    padding-top: 0.45rem;
}

#notes main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
}
#notes main.hidden {
    display: none !important;
}
.last{
    flex: 1;
}

.noteControls {
    display: flex;
    gap: 0.5rem;
}

#notes button {
    flex: 1;
    padding: 0.4rem;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: #c7ad8a;
    color: #332416;
    cursor: pointer;
}

#notes button:hover {
    background: #dbc09a;
}

#notes button:active {
    background: #a88c6a;
    cursor: grabbing;
}

#close-note-keyboard {
    display: none;
}

#noteInput {
    width: 100%;
    flex: 1;
    min-height: 8rem;
    padding: 0.6rem;
    box-sizing: border-box;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: #f3e6cf;
    color: #332416;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.4;
}

#noteInput:focus {
    outline: none;
    border-color: #3d6b3d;
}

fieldset.plain {
    padding: 0.5rem 0;
    margin: 0;
    border: none;
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: scroll;
    overflow-y: hidden;
    flex-wrap: nowrap;
    box-sizing: border-box;
    flex: 0 0 auto;
}
hr {
    border: none;
    border-top: 0.1rem solid #664c2e;
    margin: 0.5rem 0 0 0;
}
.color {
    position: relative;
    z-index: 3;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    max-width: 2rem;
    flex: 0 0 2rem;
    border: 0.1rem solid #664c2e;
    border-radius: 0.25rem;
    background: #f3e6cf;
    cursor: pointer;
}
.note-tag {
    flex: 0 0 auto !important;
    min-width: 3.5rem;
    white-space: nowrap;
}
#note-tag-controls {
    max-height: 5.5rem;
    overflow-x: hidden;
    overflow-y: auto;
    flex-wrap: wrap;
    align-content: flex-start;
}
section.area {
    display: flex;
    flex-direction: column;
}
/* Note display */
#noteDisplay {
    width: 100%;
    flex: 1;
    min-height: 8rem;
    padding: 0.6rem;
    box-sizing: border-box;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: #f3e6cf;
    color: #332416;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    line-height: 1.4;
}

#noteDisplay fieldset {
    margin: 0.35rem 0;
    padding: 0.4rem 0.5rem;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: transparent;
    color: #332416;
}

#noteDisplay legend {
    padding: 0 0.25rem;
    color: #332416;
    font-weight: bold;
}

#notes #noteDisplay details {
    margin: 0.35rem 0;
    padding: 0.25rem 0.4rem;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    outline: none;
    background: transparent;
    color: #332416;
}

#notes #noteDisplay details summary {
    padding: 0.1rem 0.25rem;
    background: transparent;
    color: #332416;
    cursor: pointer;
}

#notes #noteDisplay details summary:hover {
    color: #685442;
}

/** Note browser */
.selected {
    border: 0.2rem solid #0f0;
    box-shadow: 0 0 1rem #0f0;
    z-index: 30;
}
nav {
    display: flex;
    flex-direction: column;
    margin-top: 0.5rem;
}
#notes details {
    padding: 0.5rem;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: #c7ad8a;
    color: #332416;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}
#notes details fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
} 
#notes details summary {
    cursor: pointer;
    background: #c7ad8a;
    border: none;
    outline: none;
}
#notes details summary:hover {
    color: #685442;
}
#notes details summary:active {
    color: #332416;
    cursor: grabbing;
}
#noteBrowserInput {
    width: 100%;
    padding: 0.4rem;
    box-sizing: border-box;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: #f3e6cf;
    color: #332416;
    font-size: 1rem;
    font-family: inherit;
    height: 2.5rem;
    resize: none;
}
.nav-add {
    background: #cba778 !important;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    color: #332416;
    cursor: pointer;
    padding: 0.4rem;
    width: 100%;
    margin: 0rem 0;
}
.nav-note {
    background: #8ac7c4;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    color: #332416;
    cursor: pointer;
    padding: 0.4rem;
    width: 100%;
}
.note-title {
    width: 100%;
    padding: 0.4rem;
    box-sizing: border-box;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    background: #f3e6cf;
    color: #332416;
    font-size: 1rem;
    font-family: inherit;
    height: 2.5rem;
    resize: none;
}
/*keyword feildset layout*/
.keyword-grid {
    display: grid;
    grid-template-columns: 0.25fr 1fr 1fr 1fr 1fr 0.25fr !important;
    gap: 0.5rem;
    padding: 0rem 3rem;
    grid-template-areas: 
        ". copy copy delete delete ."
        ". name name color color ."
        ". tooltip tooltip tooltip tooltip ."
        ". goto-name goto goto goto ."
    ;
}


.one-column {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 0.5rem;
}

.color-slider-wrapper {
	position: relative;
	width: 100%;
}

.color-slider-input {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.25rem 0.4rem;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    font: inherit;
}

.color-slider-input[hidden] {
    display: none;
}

.color-slider-input.invalid {
    border-color: #d00;
    color: #d00;
}

.color-slider {
	display: block;
	width: 100%;
	height: 4rem;
	touch-action: none;
	opacity: 0.7;
	transition: opacity 0.2s;
	border: 0.15rem solid #664c2e;
	border-radius: 0.25rem;
}

.color-slider:hover {
	opacity: 1;
}

.color-slider-handle {
	position: absolute;
	width: 1rem;
	height: 1rem;
	border: 0.15rem solid #664c2e;
	border-radius: 50%;
	background: #c7ad8a;
	transform: translate(-50%, -50%);
	pointer-events: none;
}
.keyword-button-open {
    background: #f3e6cf !important;
    border: 0.15rem solid #664c2e;
    border-radius: 0.25rem;
    color: #332416;
    cursor: pointer;
    padding: 0.4rem;
    width: 100%;
    margin-bottom: 0.5rem;
}
.nameArea {
    height: 2.5rem;
}

@media (max-width: 600px) {
    #close-note-keyboard {
        display: none;
        flex: 0 0 auto;
    }

    html.keyboard-open #close-note-keyboard {
        display: block;
    }

    #notes {
        margin: 0;
        border: none;
        overflow: visible;
    }

    #notes header {
        box-sizing: border-box;
        width: 100%;
        height: 3.5rem;
        margin: 0;
        padding: 0.5rem 1rem;
        border: none;
        background: #664c2e;
        color: #f5ead7;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #notes main:not(.hidden) {
        height: calc(var(--viewport-height, 100dvh) - 8rem);
        box-sizing: border-box;
        min-height: 0;
    }

    #notes header:hover,
    #notes header:active {
        padding: 0.5rem 1rem;
        font-size: 1rem;
        background: #7a5d3d;
        color: #fcf8f1;
    }
}