@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

i {
    font-style: normal;
}

body {
    font-family: 'Press Start 2P', monospace;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: #f0f0f0;
    overscroll-behavior: none;
}

header {
    height: 60px;
    background: #ddd;
    border-bottom: 1px solid #999;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

header h1 {
    font-size: 16px;
    font-weight: normal;
}

.toolbar {
    display: flex;
    gap: 10px;
}

button {
    padding: 8px 12px;
    border: none;
    background: #c0c0c0;
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
    box-shadow: inset 1px 1px 0px #dfdfdf, inset -1px -1px 0px #404040;
}

button:hover {
    background: #d4d0c8;
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
}

button:active {
    background: #a0a0a0;
    border-top: 2px solid #808080;
    border-left: 2px solid #808080;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    box-shadow: inset 1px 1px 0px #404040, inset -1px -1px 0px #dfdfdf;
}

main {
    flex: 1;
    display: flex;
    min-height: 0;
}

#glyphbrowser {
    width: 300px;
    background: #fff;
    border-right: 1px solid #999;
    overflow: auto;
    padding: 10px;
    touch-action: none;
}

#glyphbrowser.active {
    border: 2px solid #0066cc;
    border-right: 2px solid #0066cc;
}

#splitter {
    width: 5px;
    background: #ccc;
    cursor: col-resize;
}

#splitter:hover {
    background: #aaa;
}

#glypheditor {
    flex: 1;
    background: #fff;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

#glypheditor.active {
    border: 2px solid #0066cc;
}

footer {
    height: 30px;
    background: #ddd;
    border-top: 1px solid #999;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 8px;
    gap: 10px;
}

footer span {
    flex: 1;
}

footer a {
    color: #333;
    text-decoration: none;
}

.glyph-grid {
    display: grid;
    gap: 2px;
    grid-template-columns: repeat(auto-fill, 20px);
    justify-content: start;
}

.glyph {
    width: 20px;
    height: 40px;
    border: 1px solid #ddd;
    cursor: pointer;
    background: #f9f9f9;
}

.glyph.selected {
    border: 2px solid #000;
}

.pixel-grid {
    display: grid;
    gap: 1px;
    border: 1px solid #999;
}

.pixel {
    width: 20px;
    height: 20px;
    border: 1px solid #eee;
    cursor: pointer;
    background: #fff;
}

.pixel.on {
    background: #000;
}

.pixel.selected {
    border: 2px solid #f00;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    padding: 0;
    min-width: 250px;
    font-size: 8px;
    line-height: 1.4;
}

.modal-content h3 {
    background: linear-gradient(90deg, #0a246a 0%, #a6caf0 50%, #0a246a 100%);
    color: white;
    padding: 4px 8px;
    margin: 0;
    font-size: 8px;
    text-shadow: 1px 1px 0px #000040;
}

.modal-body {
    padding: 20px;
    background: #c0c0c0;
}

.modal-content label {
    display: block;
    margin-bottom: 10px;
}

.modal-content input {
    margin-left: 10px;
    padding: 4px;
    border: 1px solid #999;
    width: 60px;
}

.modal-buttons {
    margin-top: 15px;
    text-align: right;
    gap: 10px;
    display: flex;
    justify-content: flex-end;
}

/* Portrait orientation support for mobile devices */
@media (orientation: portrait) and (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    #glyphbrowser {
        width: auto;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #999;
    }
    
    #glyphbrowser.active {
        border-right: none;
        border-bottom: 2px solid #0066cc;
    }
    
    #splitter {
        width: auto;
        height: 5px;
        cursor: row-resize;
    }
    
    #glypheditor {
        height: auto;
        min-height: 300px;
    }
}

/* Small screen toolbar optimization */
@media (max-width: 600px) {
    .toolbar button small {
        display: none;
    }
    
    .toolbar button {
        padding: 6px;
        min-width: 28px;
    }
}