* {
    box-sizing: border-box;
}

body {
    /* Layout */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 100vh;

    /* Box Model */
    margin: 0;
    padding: 20px;

    /* Visual */
    background-color: #222;
}

#main-wrapper {
    /* Layout */
    display: flex;
    flex-direction: column;
    gap: 10px;

    /* Box Model */
    padding: 20px;
    width: 100%;
}

#toolbar-row {
    /* Layout */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 20px;

    /* Box Model */
    width: 100%;
}

#play-area {
    /* Layout */
    position: relative;

    /* Box Model */
    width: 640px;
    max-width: 100%;
    aspect-ratio: 640 / 480;
    height: auto;
}

#game-column {
    /* Layout */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#toolbar {
    /* Layout */
    display: flex;
    justify-content: flex-end;
}

/* Toolbar Group */
.toolbar-group {
    /* Layout */
    display: inline-flex;
    align-items: center;
    gap: 6px;

    /* Box Model */
    margin-right: 6px;
}

.toolbar-label {
    /* Typography */
    font-family: 'KoddiUDOnGothic-Bold', sans-serif;
    font-size: 18px;
    color: white;
}

.toolbar-btn {
    /* Box Model */
    width: 80px;
    height: 56px;
    border: none;

    /* Visual */
    background-color: transparent;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
}

.toggle-on {
    background-image: url('assets/ui/on.png');
}

.toggle-off {
    background-image: url('assets/ui/off.png');
}

.toolbar-btn:hover {
    filter: brightness(1.2);
}

#game-container {
    /* Layout */
    flex-shrink: 0;

    /* Visual */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

canvas {
    /* Layout */
    display: block;

    /* Visual */
    background-color: #000;
    image-rendering: pixelated;

    width: 100%;
    height: 100%;
}

#yaku-container {
    /* Layout */
    display: flex;
    flex-direction: column;
    position: absolute;
    z-index: 10;
    top: 0;
    left: 640px;

    /* Box Model */
    width: 380px;
    height: 480px;
    border: 1px solid #444;

    /* Visual */
    background: #f0f0f0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#yaku-container.hidden {
    display: none;
}

#yaku-frame {
    /* Layout */
    flex: 1;

    /* Box Model */
    width: 100%;
    border: none;

    /* Visual */
    background: white;
}

#game-container:fullscreen {
    /* Layout */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Box Model */
    width: 100vw;
    height: 100vh;

    /* Visual */
    background-color: #000;
}

#game-container:fullscreen canvas {
    /* Layout */
    display: block;

    /* Box Model */
    width: min(100vw, 133.34vh);
    height: min(100vh, 75vw);
}

.pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    background: black;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.pseudo-fullscreen canvas {
    width: min(100vw, 133.34vh) !important;
    height: min(100vh, 75vw) !important;
}

hr {
    /* Box Model */
    width: 100%;
    margin: 20px 0 10px 0;
    border: none;
    border-top: 1px solid #444;
}


@font-face {
    font-family: 'KoddiUDOnGothic-Regular';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2105_2@1.0/KoddiUDOnGothic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'KoddiUDOnGothic-Bold';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2105_2@1.0/KoddiUDOnGothic-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    #main-wrapper {
        padding: 5px;
        gap: 10px;
    }

    #toolbar-row {
        gap: 10px;
    }

    /* Shrink Toolbar */
    .toolbar-label {
        font-size: 16px;
    }

    .toolbar-btn {
        width: 50px;
        height: 35px;
        background-size: contain;
    }

    .toolbar-group {
        margin-right: 0px;
        margin-bottom: 5px;
        gap: 4px;
    }

    /* Shrink/Hide Footer details if needed */
    #footer {
        margin-top: 5px;
        font-size: 10px;
    }

    hr {
        margin: 10px 0;
    }
}