/* Base styles for all devices */
body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 16px; /* Base font for readability */
}
.step-container { /* Assuming your steps are in a container class */
    max-width: 100%;
    padding: 10px;
    box-sizing: border-box;
}
button {
    width: 100%; /* Full-width buttons on mobile */
    padding: 15px;
    font-size: 18px; /* Touch-friendly size (min 44px height recommended) */
    margin: 10px 0;
}

/* Media query for Android phones (up to 480px wide) */
@media screen and (max-width: 480px) {
    .step-container {
        font-size: 14px; /* Smaller text on mobile */
    }
    button {
        min-height: 44px; /* Ensures easy tapping */
    }
    /* Stack elements vertically if needed */
    .firmware-list { /* If you have a dropdown/list */
        width: 100%;
    }
}


*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --select-border: #777;
  --select-focus: blue;
  --select-arrow: var(--select-border);
}

.terminal-toggle-btn {
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.terminal-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-family: "Futura", "Century Gothic", sans-serif;
    background: linear-gradient(135deg, #373738 0%, #030303 100%);
    min-height: 100vh;
    padding: 20px;
}


.container {
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
    font-weight: 700;
}

.section {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section h2 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.chip-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.chip-detail {
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chip-detail strong {
    color: #333;
    display: block;
    margin-bottom: 5px;
}

.chip-detail span {
    color: #666;
    font-size: 0.9em;
}

.file-list {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    padding: 20px;
    margin-top: 15px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.file-offset {
    font-size: 0.8em;
    color: #666;
    font-family: monospace;
}

.file-size {
    font-size: 0.8em;
    color: #888;
    font-weight: 500;
}

.connect-btn, .monitor-btn, .flash-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.connect-btn, .monitor-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.connect-btn:hover, .monitor-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.connect-btn:disabled, .monitor-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.flash-btn {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    color: white;
}

.flash-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(245, 87, 108, 0.3);
}

.flash-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.status {
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-weight: 500;
    text-align: center;
}

.status.info {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
}

.log-container {
    background: #1e1e1e;
    color: #f0f0f0;
    padding: 15px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin-top: 15px;
}

.hidden {
    display: none;
}

.center {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 50%;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.step {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.6);
    margin: 0 5px;
    transition: all 0.3s ease;
}

.step.active {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.step.completed {
    background: #2ed573;
    color: white;
}

.step-number {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 5px;
}

.step-text {
    font-size: 0.9em;
}

#instructions {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #fff;
}

#dropzone {
    width: 100%;
    min-height: 100px;
    padding: 20px;
    margin: 20px auto;
    border: 1px dashed white;
    border-radius: 7px;
    cursor: pointer;
    background-color: #3a3a3a;
    text-align: center;
    background-color: #222;
    color: #fff;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='white'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;
    background-size: 20px;
    background-position: 98% 20px;
    padding-left: 12px !important;
    background-repeat: no-repeat;
    outline: none;
}

select:-moz-focusring {
    transition-duration: 0s;
    color: transparent;
    text-shadow: 0 0 0 #fff;
}

option {
    background-color: var(--c-3);
    color: var(--c-f);
}

.btn {
    outline: none;
    cursor: pointer;
    padding: 8px;
    margin: 10px 0;
    width: 100%;
    font-family: "Futura", "Century Gothic", sans-serif;
    font-size: 24px;
    background-color: #333;
    color: white;
    border: 0px solid white;
    border-radius: 25px;
}

.btn-select {
    outline: none;
    cursor: pointer;
    width: 110px;
    margin: 8px 0;
    font-family: "Futura", "Century Gothic", sans-serif;
    font-size: 20px;
    background-color: #333;
    color: white;
    border: 0px solid white;
    border-radius: 8px;
    background-size: 10px;
    background-position: 93% 11px;
    padding-left: 12px !important;
}

img {
    width: 640px;
    max-width: 80%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    margin: 3vh 0 5px 0;
    animation: fi 1s;
}

.disabled__label {
    display: none;
}


.radio {
    display: inline-flex;
    overflow: hidden;
    border-radius: 25px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0);

}

.radio__input {
    display: none;
}

.radio__label {
    padding: 8px 14px;
    font-size: 14px;
    font-family: "Futura", "Century Gothic", sans-serif;
    color: #ffffff;
    background: #09f;
    cursor: pointer;
    transition: background 0.1s;
}

.radio__label:not(:last-of-type) {
    border-right: 1px solid #006b50;
}

.radio__input:checked+.radio__label {
    background: rgb(0, 95, 158);
}

@keyframes fi {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.main {
    animation: fi 1.5s .7s both;
}

a {
    color: #fff;
    cursor: pointer;
    text-decoration: underline;
}

ol {
    margin: auto;
    text-align: left;
    display: inline-block;
}

li::marker {
    text-decoration: bold;
    color: #09f;
}

li {
    margin: 5px;
}

.container {
    width: 70%;
    margin: auto;
    border-radius: 5px;
    box-sizing: border-box;
    background-color: #222;
    overflow: hidden;
}

.inst-button {
    padding: 0;
}

@media (prefers-color-scheme: dark) {
    ewt-install-dialog {
        /*--mdc-theme-primary: #ffa000; /*buttons*/
        --mdc-theme-surface: #333;
        --mdc-dialog-heading-ink-color: #fff;
        --mdc-dialog-content-ink-color: #ddd;
        --mdc-text-field-fill-color: #ddd;
    }
}


pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
.string { color: green; }
.number { color: darkorange; }
.boolean { color: blue; }
.null { color: magenta; }
.key { color: red; }



#trash {
    width: 20px;
    float: right;
    filter: invert(17%) sepia(98%) saturate(7496%) hue-rotate(360deg) brightness(109%) contrast(108%);
}

#packagex {
    display: flex;
    flex-direction: column;
    width: 100%;
    font-family: "Futura", "Century Gothic", sans-serif;
    font-weight: bold;
    font-size: 16pt;
    text-align: left;

}

/* Package Styles */
#packagex img {
    text-align: center;
}
.archive img {
    margin: 0;
    width: 120px;
}
img.part {
    width: 40px;
}
.part-size {
    font-size: 10pt;
}
.column {
    flex-grow: 1;
    text-align: center;
}
.row {
    display: flex;
    justify-content: first baseline;
    margin: 0 0 20px 0;
    flex-wrap: wrap;
    gap: 10px;
}
#package_note img {
    width: 64px;
    margin: 0 50%;
    padding: 10px;
}

/* Step Styles */
.steps { display: flex; flex-direction: column; }

.step {
    display: grid;
}
.top {
    font-size: 18pt;
}
.step-box {
    min-height: 100px;
    line-height: 50px;
    margin: auto 0;
    font-size: 24pt;
    border: 1px dashed white;
    border-radius: 7px;
    cursor: pointer;
    background-color: #3a3a3a;
}


/* Checkbox Styles */
.checkbox-wrapper-10 {
    margin: auto;
    width: min-content;
    transform: scale(.7);
}
.checkbox-wrapper-10 .tgl {
    display: none;
}

.checkbox-wrapper-10 .tgl,
.checkbox-wrapper-10 .tgl:after,
.checkbox-wrapper-10 .tgl:before,
.checkbox-wrapper-10 .tgl *,
.checkbox-wrapper-10 .tgl *:after,
.checkbox-wrapper-10 .tgl *:before,
.checkbox-wrapper-10 .tgl+.tgl-btn {
    box-sizing: border-box;
}

.checkbox-wrapper-10 .tgl::-moz-selection,
.checkbox-wrapper-10 .tgl:after::-moz-selection,
.checkbox-wrapper-10 .tgl:before::-moz-selection,
.checkbox-wrapper-10 .tgl *::-moz-selection,
.checkbox-wrapper-10 .tgl *:after::-moz-selection,
.checkbox-wrapper-10 .tgl *:before::-moz-selection,
.checkbox-wrapper-10 .tgl+.tgl-btn::-moz-selection,
.checkbox-wrapper-10 .tgl::selection,
.checkbox-wrapper-10 .tgl:after::selection,
.checkbox-wrapper-10 .tgl:before::selection,
.checkbox-wrapper-10 .tgl *::selection,
.checkbox-wrapper-10 .tgl *:after::selection,
.checkbox-wrapper-10 .tgl *:before::selection,
.checkbox-wrapper-10 .tgl+.tgl-btn::selection {
    background: none;
}

.checkbox-wrapper-10 .tgl+.tgl-btn {
    outline: 0;
    display: block;
    width: 4em;
    height: 2em;
    position: relative;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.checkbox-wrapper-10 .tgl+.tgl-btn:after,
.checkbox-wrapper-10 .tgl+.tgl-btn:before {
    position: relative;
    display: block;
    content: "";
    width: 50%;
    height: 100%;
}

.checkbox-wrapper-10 .tgl+.tgl-btn:after {
    left: 0;
}

.checkbox-wrapper-10 .tgl+.tgl-btn:before {
    display: none;
}

.checkbox-wrapper-10 .tgl:checked+.tgl-btn:after {
    left: 50%;
}

.checkbox-wrapper-10 .tgl-flip+.tgl-btn {
    padding: 2px;
    transition: all 0.2s ease;
    font-family: "Futura", "Century Gothic", sans-serif;
    perspective: 100px;
}

.checkbox-wrapper-10 .tgl-flip+.tgl-btn:after,
.checkbox-wrapper-10 .tgl-flip+.tgl-btn:before {
    display: inline-block;
    transition: all 0.4s ease;
    width: 100%;
    text-align: center;
    position: absolute;
    line-height: 2em;
    font-weight: bold;
    color: #fff;
    position: absolute;
    top: 0;
    left: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 4px;
}

.checkbox-wrapper-10 .tgl-flip+.tgl-btn:after {
    content: attr(data-tg-on);
    background: #027e0e;
    transform: rotateY(-180deg);
}

.checkbox-wrapper-10 .tgl-flip+.tgl-btn:before {
    background: #FF3A19;
    content: attr(data-tg-off);
}

.checkbox-wrapper-10 .tgl-flip+.tgl-btn:active:before {
    transform: rotateY(-20deg);
}

.checkbox-wrapper-10 .tgl-flip:checked+.tgl-btn:before {
    transform: rotateY(180deg);
}

.checkbox-wrapper-10 .tgl-flip:checked+.tgl-btn:after {
    transform: rotateY(0);
    left: 0;
    background: #14a162;
}

.checkbox-wrapper-10 .tgl-flip:checked+.tgl-btn:active:after {
    transform: rotateY(20deg);
}

.hexviewer, .download {
    float: right;
    margin: -20px 3px 0 0;
    background-image: url('/media/hexviewer.svg');
    background-size: contain;
    background-repeat: no-repeat;
    width: 24px;
    height: 24px;
    cursor: pointer;
}
.download {
    background-image: url('/media/download.svg');
}

#showMore {
    width: 90px;
    padding-bottom: 15px;
    margin: auto;
    margin: auto;
    cursor: pointer;
    font-size: large;
    text-align: center;
}

#partition-list {
    display: none;
}


#package_select {
    display: flex;
    align-items: center;
    gap: 10px;
}


#refresh {
    width: 44px;
    height: 44px;
    cursor: pointer;
    vertical-align: middle;
    margin: auto;
}

.spin {
    animation: spin 1s linear 1;
    -webkit-animation: spin 1s linear 1; /* Chrome, Safari */
    -moz-animation: spin 1s linear 1;   /* Firefox */
    -ms-animation: spin 1s linear 1;    /* Internet Explorer 10+ */
}

@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

@-moz-keyframes spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}

@-ms-keyframes spin {
    from { -ms-transform: rotate(0deg); }
    to { -ms-transform: rotate(360deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 15px;
    }
    #instructions {
        width: 100%;
        padding: 15px;
        font-size: 12pt;
    }
    .archive {
        width: 100%;
    }
    .archive img {
        width: 40%;
        margin: 0 30%;
    }

    .section {
        margin-bottom: 20px;
        padding: 15px;
    }

    #packagex {
        font-size: 14pt;
    }

    img.part {
        width: 30px;
    }

    .part-size {
        font-size: 9pt;
    }

    .row {
        gap: 8px;
        margin: 0 0 15px 0;
    }

    #package_select {
        flex-direction: column;
        gap: 8px;
    }

    #selectFiles {
        width: 100%;
    }

    #refresh {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .section {
        margin-bottom: 15px;
        padding: 10px;
    }

    .section h2 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    #packagex {
        font-size: 12pt;
    }

    img.part {
        width: 25px;
    }

    .part-size {
        font-size: 8pt;
    }


    .row {
        gap: 6px;
        margin: 0 0 10px 0;
        justify-content: center;
    }

    #dropzone {
        margin: 15px auto;
    }

    .checkbox-wrapper-10 {
        transform: scale(0.6);
    }

    #trash {
        width: 16px;
    }
}

#monitor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    backdrop-filter: blur(10px);
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 5px 10px 10px 10px;
    overflow: hidden;
}

#monitor-controls, .terminal-btn {
    display: flex;
    position: absolute;
    top: 10px;
    right: 15px;
    gap: 4px;
}

#selectBaudrate {
    margin-top: 20px;
}

.connectx-btn, .disconnect-btn, .copy-btn, .reset-btn, .close-btn, .terminal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    width: 48px;
    height: 48px;
}


.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.xterm-viewport {
    overflow: hidden !important;
}
.terminal {
    width: 100%;
    height: 100%;
    opacity: 0.7 !important;
}

.terminal-btn {
    background-image: url("/media/terminal.svg");
    background-size: 38px 38px;
    background-repeat: no-repeat;
    background-position: center;
}

.xterminal {
    width: 100%;
    height: 100%;
    color: #fff;
    background: #1e1e1e;
    padding: 8px;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0.95;
    transition: opacity 0.3s ease-in-out;
    font-family: 'Fira Code', 'Cascadia Code', 'Source Code Pro', monospace;
}

.credits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    color: #fff;
    font-size: 20px;
}

