:root {
    --outer-bg: #000000;
    --frame-color: #334155;
    --l-sys-bg: #FDFCF4;
    --l-sys-on-bg: #1B1C17;
    --l-sys-surface: #E3E4D3;
    --l-sys-primary: #4C662B;
    --l-sys-on-primary: #FFFFFF;
    --l-sys-sec-cont: #D7E8B7;
    --l-sys-on-sec-cont: #121F00;
}


.dark {
    --sys-bg: #1B1C17;
    --sys-on-bg: #E3E4D3;
    --sys-surface: #2F3126;
    --sys-primary: #B1D18A;
    --sys-on-primary: #1F3701;
    --sys-sec-cont: #3E4A2B;
    --sys-on-sec-cont: #D7E8B7;
}


.light {
    --sys-bg: var(--l-sys-bg);
    --sys-on-bg: var(--l-sys-on-bg);
    --sys-surface: var(--l-sys-surface);
    --sys-primary: var(--l-sys-primary);
    --sys-on-primary: var(--l-sys-on-primary);
    --sys-sec-cont: var(--l-sys-sec-cont);
    --sys-on-sec-cont: var(--l-sys-on-sec-cont);
}


body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Kiwi Maru', sans-serif;
    background: var(--outer-bg);
    overscroll-behavior-y: auto;
}


.phone-case {
    width: 92%;
    max-width: 380px;
    height: 82vh;
    background: #222;
    border: 12px solid var(--frame-color);
    border-radius: 54px;
    position: relative;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}


.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--sys-bg);
    color: var(--sys-on-bg);
    transition: 0.4s;
    padding: 0 16px;
}


.status-bar {
    height: 40px;
    padding: 0 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}


.display-container {
    width: 100%;
    flex: 1;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    background: var(--sys-surface);
    border-radius: 28px;
    color: var(--sys-on-bg);
    overflow-y: auto;
    overscroll-behavior-y: contain;
    min-height: 0;
}


.nav-bar {
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
}


.nav-line {
    width: 72px;
    height: 5px;
    background: var(--sys-on-bg);
    opacity: 0.2;
    border-radius: 10px;
    cursor: pointer;
}


#titleContainer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
    font-family: "MS UI Gothic", "MS Gothic", sans-serif;
}


#titleInput {
    flex: 1;
    min-width: 0;
    padding: 4px;
    background: #fff;
    border: 2px inset buttonface;
    font-size: 16px;
    outline: none;
    font-family: "MS UI Gothic", "MS Gothic", sans-serif;
}


#app-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 4px;
}


.palette-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    font-family: "MS UI Gothic", "MS Gothic", sans-serif;
}


#palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 4px;
    background: #c0c0c0;
    border: 2px inset buttonface;
}


.palette-controls {
    display: flex;
    flex-direction: row;
    gap: 4px;
}


.palette-controls button {
    width: 100%;
    padding: 4px;
    margin-bottom: 2px;
    font-size: 11px;
    font-family: inherit;
    background: #c0c0c0;
    border: 2px outset buttonface;
}


.palette-controls button:active {
    border-style: inset;
}


.color-btn {
    aspect-ratio: 1 / 1;
    width: 100%;
    cursor: pointer;
    border: 2px outset buttonface;
    box-sizing: border-box;
}


.color-btn.selected {
    border-style: inset;
    outline: 1px dotted #000;
    outline-offset: -4px;
}


.color-btn.transparent {
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
}


#canvas {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-gap: 1px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    padding: 2px;
    background-color: #808080;
    border: 2px outset buttonface;
    touch-action: none;
    box-sizing: border-box;
}


.pixel {
    width: 100%;
    height: 100%;
    background-color: transparent;
    border: 1px inset buttonface;
    box-sizing: border-box;
}


#controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 10px;
    background: #c0c0c0;
    border-top: 1px solid #808080;
    flex-shrink: 0;
    font-family: "MS UI Gothic", "MS Gothic", sans-serif;
}


#controls button {
    flex: 1 1 45%;
    max-width: none;
    padding: 6px 10px;
    background: #c0c0c0;
    border: 2px outset buttonface;
    font-size: 12px;
    font-family: inherit;
}


#controls button:active {
    border-style: inset;
}

footer a,
footer a:visited,
footer a:hover,
footer a:active {
    color: inherit;
    text-decoration: none;
}


footer {
    padding: 4px;
    text-align: center;
    font-size: 11px;
    flex-shrink: 0;

}
