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

:root {
    --stone-dark: #292929;
    --stone-medium: #3d3d3d;
    --stone-light: #525252;
    --stone-700: #44403c;
    --stone-800: #292524;
    --stone-900: #1c1917;
    --cyan-500: #06b6d4;
    --cyan-600: #0891b2;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --gray-100: #f3f4f6;
    --gray-800: #1f2937;
}

* {
    box-sizing: border-box;
}

body {
    background-color: #1a1a1a;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(0,0,0,.3) 15px, rgba(0,0,0,.3) 16px),
        repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(0,0,0,.3) 15px, rgba(0,0,0,.3) 16px);
    color: white;
    width: 100%;
    max-width: 100vw;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

#container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    width: 100%;
    max-width: 100vw;
    gap: 0;
}

.minecraft-font {
    font-family: 'Press Start 2P', cursive;
}

.minecraft-border {
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
}

.minecraft-shadow {
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
}

input, button, input::file-selector-button {
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    background-color: var(--green-600);
    outline: none;
    padding: 6px 10px;
    margin: 4px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
}

button {
    background-color: var(--green-600);
}

button:hover {
    background-color: var(--green-500);
    transform: translateY(-1px);
}

input:hover, input::file-selector-button:hover {
    background-color: var(--green-500);
    transform: translateY(-1px);
}

input:active, button:active, input::file-selector-button:active {
    transform: translateY(1px);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
}

input[type="file"] {
    background-color: transparent;
    border: none;
    box-shadow: none;
    color: white;
    margin: 0;
    padding: 0;
}

.file-label {
    display: inline-block;
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    background-color: var(--green-600);
    padding: 6px 10px;
    margin: 0;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
}

.file-label:hover {
    background-color: var(--green-500);
    transform: translateY(-1px);
}

.file-label:active {
    transform: translateY(1px);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.3);
}

input[type="text"] {
    background-color: var(--stone-900);
    color: white;
    border: 2px solid #57534e;
    box-shadow: none;
}

input[type="text"]:focus {
    border-color: var(--green-500);
    outline: none;
}

input[type="color"] {
    width: 50px;
    height: 36px;
    cursor: pointer;
    padding: 4px;
}

input[type="range"] {
    background-color: var(--stone-medium);
    height: 8px;
    cursor: pointer;
}

label {
    margin: 5px;
}

.multioption-hidden {
    display: none;
}

#top {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    padding: 12px;
    background-color: rgba(0, 0, 0, 0.2);
    gap: 12px;
    overflow: hidden;
    flex-wrap: nowrap;
    align-items: stretch;
    min-height: 0;
}

#left {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

#preview-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

#preview-header {
    margin-bottom: 16px;
}

.section-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: var(--green-500);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    margin: 0;
    padding: 16px;
    background-color: var(--stone-800);
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#preview {
    width: 100%;
    height: 480px;
    border: 4px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 0 20px black, 4px 4px 0px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    background-image: url("/skin-editor/2025-11-19_15.41.49.png");
    background-size: cover;
    background-position: center;
    background-color: var(--stone-900);
    position: relative;
    flex-shrink: 0;
}

#preview > canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    filter: drop-shadow(0 10px 10px black);
    pointer-events: auto;
}

#middle {
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

#editor-header {
    margin-bottom: 16px;
}

#editor-canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--stone-900);
    min-height: 0;
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    padding: 20px;
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background-image: url("/skin-editor/transparency-checker.svg");
    background-size: 10%;
    border: 4px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
}

#top::-webkit-scrollbar {
    height: 10px;
}

#top::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

#top::-webkit-scrollbar-thumb {
    background: var(--stone-medium);
    border: 2px solid;
    border-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.2);
}

#top::-webkit-scrollbar-thumb:hover {
    background: var(--stone-light);
}

#tag-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background-color: var(--stone-800);
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    min-width: fit-content;
}

#tag-row h1 {
    font-family: 'Press Start 2P', cursive;
    color: var(--green-500);
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
    font-size: 20px;
    margin: 0;
}

#tag-row h2 {
    font-size: 11px;
    color: #a8a29e;
    line-height: 1.5;
    margin: 0;
    font-weight: 600;
}

h1, h2, h3 {
    margin: 0;
}

.options-section {
    background-color: var(--stone-800);
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.options-section-title {
    font-size: 11px;
    font-weight: bold;
    color: var(--green-500);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    width: 100%;
}

#canvas-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

#brush-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

#file-operations {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

#options-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

#message-box {
    position: absolute;
    background-color: var(--stone-800);
    border: 4px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.5);
    z-index: 5;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.1);
    width: fit-content;
    max-width: 600px;
    height: fit-content;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
}

#message-box.visible {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

#message-box-content {
    flex-grow: 1;
    text-align: left;
    padding: 30px;
    line-height: 1.6;
}

#message-box-content h1 {
    font-family: 'Press Start 2P', cursive;
    color: var(--green-500);
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
    font-size: 20px;
}

#message-box-content h3 {
    color: var(--green-500);
    margin-top: 15px;
    margin-bottom: 8px;
    font-weight: bold;
}

#message-box-acknowledge {
    margin: 0;
    width: 100%;
    border-radius: 0;
    border-top: 3px solid rgba(0, 0, 0, 0.3);
}

.options-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.file-options {
    justify-content: space-between;
}

.option {
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 6px 10px;
    border: 3px solid;
    border-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.3) rgba(255, 255, 255, 0.3);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
}

.multioption {
    display: flex;
    flex-direction: row;
    align-items: center;
    user-select: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
}

.multioption p {
    margin: 0;
    padding: 0;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
    color: white;
    font-size: 10px;
    width: auto;
    margin-bottom: 0;
}

.multioption-pill {
    padding: 6px 10px;
    display: flex;
    background-color: var(--stone-900);
    border: 2px solid #57534e;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 11px;
    user-select: none;
}

.multioption-pill:hover {
    background-color: var(--stone-700);
    border-color: #78716c;
}

.multioption-pill label {
    margin: 0;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #e7e5e4;
}

.multioption-pill input[type="radio"] {
    display: none;
}

.multioption-pill:has(input:checked) {
    background-color: var(--green-600);
    color: white;
    border-color: var(--green-500);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.multioption-pill:has(input:checked) label {
    color: white;
}

.multioption:has(.multioption-pill #brush-draw[type="radio"]:checked) ~ .options-row .brush-option {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.brush-option {
    align-items: center;
    background-color: var(--stone-900);
    padding: 8px;
    border: 2px solid #57534e;
}

.brush-option label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 4px;
}

.account-load {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 12px;
}

.account-load label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 8px;
}

.account-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.account-input-group input {
    flex: 1;
    margin: 0;
}

.account-input-group button {
    margin: 0;
}

ion-icon {
    font-size: 14px;
    vertical-align: middle;
}

.background-thumbnails {
    position: absolute;
    top: 50%;
    transform: translateY(calc(-50% - 10px));
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    z-index: 10;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.background-thumb {
    width: 64px;
    height: 64px;
    border: 3px solid rgba(87, 83, 78, 0.8);
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    background-color: rgba(28, 25, 23, 0.9);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.background-thumb:hover {
    border-color: var(--green-500);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.background-thumb.active {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4);
}

.background-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

@media (max-width: 1200px) {
    #container {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .section-title {
        font-size: 11px;
        padding: 12px;
    }

    .multioption p, .multioption-pill label, .brush-option label, .account-load label {
        font-size: 11px;
    }

    .options-section-title {
        font-size: 12px;
    }
}

@media (max-width: 900px) {
    #container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        height: auto;
        min-height: 100vh;
    }

    #top, #left, #middle {
        width: 100%;
        height: auto;
    }

    #top {
        grid-column: 1;
        grid-row: 3;
        overflow-x: visible;
        overflow-y: visible;
        padding: 8px;
        gap: 8px;
        max-height: none;
    }

    #left {
        grid-row: 1;
        min-height: 400px;
        max-height: 500px;
        padding: 12px;
    }

    #middle {
        grid-row: 2;
        min-height: 500px;
        padding: 12px;
    }

    #tag-row {
        flex-direction: column;
        text-align: center;
        padding: 12px;
        gap: 8px;
    }

    #tag-row h1 {
        font-size: 14px;
    }

    #tag-row h2 {
        font-size: 9px;
    }

    #canvas-options, #options-menu {
        gap: 8px;
    }

    .options-section {
        padding: 12px;
        min-width: auto;
        width: 100%;
    }

    .multioption {
        gap: 6px;
    }

    .multioption-pill {
        padding: 4px 8px;
    }

    input, button {
        padding: 5px 8px;
        font-size: 10px;
        margin: 2px;
    }

    .file-label {
        padding: 5px 8px;
        font-size: 10px;
    }

    .option {
        padding: 6px 10px;
    }

    input[type="color"] {
        width: 40px;
        height: 30px;
    }

    #preview {
        min-height: 200px;
    }

    .background-thumb {
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 12px;
    }

    #container {
        width: 100%;
        max-width: 100%;
    }

    #top {
        flex-wrap: wrap;
        overflow-x: visible;
        overflow-y: visible;
        padding: 6px;
        gap: 6px;
        max-height: none;
        width: 100%;
        box-sizing: border-box;
    }

    #left, #middle {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #left {
        min-height: auto;
        max-height: none;
        height: auto;
    }

    #middle {
        min-height: 550px;
    }

    #preview-options {
        min-height: fit-content;
        height: auto;
    }

    #editor-options {
        min-height: fit-content;
        height: auto;
    }

    #canvas-options {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    #options-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .options-section {
        padding: 10px;
        flex: 1 1 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .options-section-title {
        font-size: 10px;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }

    #tag-row h1 {
        font-size: 12px;
    }

    #tag-row h2 {
        font-size: 8px;
    }

    .multioption {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
    }

    .multioption p {
        margin-bottom: 4px;
        width: 100%;
        flex: 1 1 100%;
    }

    .multioption-pill {
        flex: 1 1 auto;
        min-width: 65px;
        max-width: calc(50% - 4px);
        justify-content: center;
        padding: 6px 4px;
        font-size: 9px;
    }

    .multioption-pill label {
        font-size: 9px;
    }

    .brush-option {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .brush-option label {
        margin-bottom: 0;
        white-space: nowrap;
        flex-shrink: 0;
    }

    input[type="range"] {
        flex: 1 1 100px;
        min-width: 100px;
    }

    .options-row {
        flex-direction: column;
        gap: 6px;
    }

    .file-options {
        width: 100%;
    }

    .option {
        width: 100%;
        justify-content: center;
    }

    .account-load {
        flex-direction: column;
    }

    .account-input-group {
        width: 100%;
    }

    .account-input-group input {
        flex: 1;
        min-width: 0;
    }

    input, button {
        font-size: 9px;
        padding: 4px 6px;
    }

    .file-label {
        font-size: 9px;
    }

    #left, #middle {
        padding: 8px;
    }

    #preview {
        min-height: 300px;
        width: 100%;
    }

    .background-thumbnails {
        top: 50%;
        transform: translateY(calc(-50% - 10px));
        left: 8px;
        gap: 1px;
    }

    .background-thumb {
        width: 48px;
        height: 48px;
        border-width: 2px;
    }

    .section-title {
        font-size: 10px;
        padding: 8px;
        box-sizing: border-box;
        width: 100%;
    }

    #editor-canvas-container {
        overflow: auto;
        touch-action: pan-x pan-y;
        min-height: 400px;
        width: 100%;
        box-sizing: border-box;
    }

    #editor-canvas {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 350px;
    }

    #editor-canvas-container canvas {
        max-width: 100%;
        height: auto;
        touch-action: none;
    }

    .options-row {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
}
