@font-face {
    font-family: 'IBMBIOS';
    src: url('/static/fonts/ibm-bios.woff') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: dark;
    font-family: 'IBMBIOS', "IBM Plex Mono", "Fira Code", monospace;
    line-height: 1.45;
    font-size: 14px;
    background-color: #050805;
}

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

body {
    margin: 0;
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(48, 255, 152, 0.12), rgba(0, 12, 4, 0.96));
    color: #dafee6;
    text-shadow: 0 0 4px rgba(48, 255, 152, 0.25);
    font-family: inherit;
    overflow-x: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
}

.logs-page {
    font-family: "IBM Plex Mono", "Fira Code", "SFMono-Regular", Consolas, monospace;
    font-size: 15px;
    text-shadow: none;
}

.container {
    width: min(960px, 90vw);
    padding: 2.5rem;
    background: rgba(4, 18, 6, 0.93);
    border-radius: 18px;
    border: 1px solid rgba(48, 255, 152, 0.35);
    box-shadow: 0 0 30px rgba(48, 255, 152, 0.15), inset 0 0 22px rgba(20, 70, 36, 0.35);
    position: relative;
    overflow: hidden;
}

.container--wide {
    width: min(1280px, 96vw);
}

.container::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(48, 255, 152, 0.08), transparent 45%);
    pointer-events: none;
}

.github-link {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(48, 255, 152, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #30ff98;
    background: rgba(5, 12, 7, 0.9);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    padding: 0;
}

.github-link svg {
    width: 22px;
    height: 22px;
}

.github-link:focus-visible,
.github-link:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(48, 255, 152, 0.7);
    box-shadow: 0 16px 26px rgba(48, 255, 152, 0.18);
    outline: none;
}

.github-links-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.github-links-list li {
    position: relative;
    padding-left: 1.25rem;
}

.github-links-list li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #30ff98;
    font-size: 1.2em;
    line-height: 1;
}

.github-links-list a {
    color: #dafee6;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.github-links-list a::after {
    content: "\2197";
    font-size: 0.85em;
    opacity: 0.75;
}

.github-links-list a:hover,
.github-links-list a:focus-visible {
    color: #30ff98;
    border-color: rgba(48, 255, 152, 0.45);
    outline: none;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    margin: 0;
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    color: #30ff98;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

p {
    margin: 0.5rem 0 0;
    color: #9df7c5;
    letter-spacing: 0.03em;
}

.alert {
    padding: 0.85rem 1.2rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.alert.success {
    background-color: rgba(48, 255, 152, 0.12);
    color: #30ff98;
    border-color: rgba(48, 255, 152, 0.35);
}

.alert.error {
    background-color: rgba(255, 80, 80, 0.08);
    color: #ff9393;
    border-color: rgba(255, 80, 80, 0.45);
}

.selection-form,
.lookup-form,
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.lookup-form {
    max-width: 420px;
    margin: 0 auto;
}

.admin-gallery-section,
.admin-table-section,
.queue-section {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

.section-header h2 {
    margin: 0;
    letter-spacing: 0.08em;
    color: #30ff98;
}

.section-header p {
    margin: 0;
}

.admin-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.admin-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.admin-link-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.75rem;
    border-radius: 16px;
    background: rgba(6, 24, 10, 0.92);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
    color: #b9ffd6;
    text-decoration: none;
    border: 1px solid rgba(48, 255, 152, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.admin-link-card h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #30ff98;
}

.admin-link-card p {
    margin: 0;
    color: #8cf5ba;
}

.admin-link-card:hover,
.admin-link-card:focus-visible {
    transform: translateY(-6px);
    box-shadow: 0 24px 60px rgba(48, 255, 152, 0.22);
    border-color: rgba(48, 255, 152, 0.45);
    outline: none;
}

.admin-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-radius: 14px;
    padding: 1rem;
    background-color: rgba(6, 22, 10, 0.92);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(48, 255, 152, 0.18);
}

.admin-card__preview {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    background: rgba(10, 35, 18, 0.88);
    padding: 0.5rem;
    min-height: 160px;
    border: 1px solid rgba(48, 255, 152, 0.16);
}

.admin-card__preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    /* Use nearest-neighbor scaling for pixel-art / crisp previews */
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor; /* IE fallback */
}

.admin-card__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.admin-card__label {
    font-weight: 600;
    color: #8ffcbb;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-card__detail {
    font-size: 0.85rem;
    color: #b6ffda;
}

.admin-card__form {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.admin-card__form .field {
    gap: 0.4rem;
}

.admin-card__form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    grid-column: 1 / -1;
}

.admin-card__delete-form {
    width: 100%;
    margin-top: 0.5rem;
}

.danger {
    padding: 0.6rem 1.25rem;
    border: 1px solid rgba(255, 90, 90, 0.45);
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(90, 0, 0, 0.85), rgba(140, 25, 25, 0.85));
    color: #ff9b9b;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(255, 90, 90, 0.35);
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: #30ff98;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-button:hover,
.link-button:focus-visible {
    color: #8cffbd;
    text-decoration: underline;
}

.secondary,
.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
}

.secondary {
    border: 1px solid rgba(48, 255, 152, 0.35);
    background: linear-gradient(120deg, rgba(10, 40, 20, 0.85), rgba(24, 80, 38, 0.9));
    color: #9efac6;
}

.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(48, 255, 152, 0.25);
    border-color: rgba(48, 255, 152, 0.6);
}

.primary {
    border: 1px solid rgba(48, 255, 152, 0.4);
    background: linear-gradient(120deg, rgba(14, 70, 30, 0.85), rgba(38, 120, 64, 0.9));
    color: #cafee0;
    min-width: 120px;
}

.primary:disabled {
    background: rgba(28, 70, 38, 0.6);
    border-color: rgba(48, 255, 152, 0.18);
    cursor: not-allowed;
    box-shadow: none;
}

.primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(48, 255, 152, 0.28);
    border-color: rgba(48, 255, 152, 0.65);
}

.queue-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.queue-hint {
    margin: 0;
    color: #8cf6be;
    font-size: 0.82rem;
}

.badge-table-wrapper {
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(48, 255, 152, 0.14);
    background: rgba(6, 18, 8, 0.92);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
    overflow-x: auto;
    margin-top: 1.25rem;
}

.badge-table__toolbar {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.badge-table__search {
    width: 100%;
    max-width: 320px;
}

.badge-table__search-message {
    margin-top: 0.85rem;
    text-align: right;
    font-size: 0.85rem;
}

.badge-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 940px;
}

.badge-table__col--identity { width: 24%; }
.badge-table__col--preview { width: 32%; }
.badge-table__col--actions { width: 26%; }
.badge-table__col--firmware { width: 18%; }

.badge-table thead {
    background: rgba(48, 255, 152, 0.08);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.82rem;
    color: rgba(172, 255, 207, 0.95);
}

.badge-table tbody tr {
    border-bottom: 1px solid rgba(48, 255, 152, 0.1);
}

.badge-table th,
.badge-table td {
    padding: 0.85rem 1rem;
    vertical-align: top;
}

.badge-table tbody tr:last-child td {
    border-bottom: none;
}

.badge-table tbody tr:hover {
    background: rgba(48, 255, 152, 0.05);
    box-shadow: inset 0 1px 0 rgba(48, 255, 152, 0.08), inset 0 -1px 0 rgba(48, 255, 152, 0.08);
}

.badge-table__identity {
    width: 22%;
    min-width: 220px;
}

.badge-table__identity-group {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.badge-table__identity-group:last-child {
    margin-bottom: 0;
}

.badge-table__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: rgba(141, 246, 190, 0.75);
    letter-spacing: 0.04em;
    min-width: 42px;
}

.badge-table__identity strong {
    color: #f0fffa;
    font-size: 1rem;
    font-weight: 600;
}

.badge-table__identity .link-button {
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.badge-table__preview-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 260px;
}

.badge-table__preview {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    background: rgba(12, 32, 18, 0.88);
    display: grid;
    place-items: center;
    padding: 0.5rem;
    border: 1px solid rgba(48, 255, 152, 0.14);
    flex-shrink: 0;
    cursor: zoom-in;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.badge-table__preview:hover,
.badge-table__preview:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(48, 255, 152, 0.35);
    box-shadow: 0 16px 28px rgba(48, 255, 152, 0.2);
    outline: none;
}

.badge-table__preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* image-rendering: pixelated ---v */
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.badge-table__meta {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: rgba(230, 255, 246, 0.92);
}

.badge-table__meta li {
    display: flex;
    gap: 0.4rem;
    line-height: 1.35;
}

.badge-table__meta strong {
    color: rgba(141, 246, 190, 0.9);
    font-weight: 600;
    flex-shrink: 0;
    min-width: 70px;
}

.badge-table__firmware {
    display: block;
    width: 100%;
}

.badge-table__firmware-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.badge-table__firmware-inner .link-button {
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.badge-table__hash {
    font-size: 0.84rem;
    color: rgba(141, 246, 190, 0.85);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-table__actions form {
    display: grid;
    gap: 0.7rem;
    grid-template-columns: 1fr;
    align-items: start;
    width: 100%;
    max-width: 320px;
}

.badge-table__form + .badge-table__form {
    margin-top: 0.65rem;
}

.badge-table__actions .field.compact {
    margin: 0;
}

.badge-table__actions .field.compact input[type="text"] {
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
}

.badge-table__actions button {
    justify-self: flex-start;
    padding: 0.5rem 1.15rem;
    border-radius: 10px;
}

.queue-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.queue-meta__line {
    font-size: 0.82rem;
    color: #8ff7c1;
}

.queue-preview {
    width: 110px;
    height: 110px;
    border-radius: 12px;
    background: rgba(12, 32, 18, 0.88);
    display: grid;
    place-items: center;
    padding: 0.5rem;
    border: 1px solid rgba(48, 255, 152, 0.14);
}

.queue-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Nearest-neighbor scaling for previews */
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

.queue-preview img:hover {
    transform: scale(1.05);
    box-shadow: 0 18px 36px rgba(48, 255, 152, 0.25);
}

.queue-preview__empty {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    line-height: 1.2;
}

.muted {
    color: rgba(255, 255, 255, 0.55);
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.lightbox-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    background: rgba(6, 22, 10, 0.95);
    border-radius: 18px;
    padding: 1.25rem 1.5rem 1.75rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(48, 255, 152, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lightbox-content img {
    display: block;
    border-radius: 12px;
    width: auto;
    height: auto;
    /* image-rendering: pixelated ---v */
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

.lightbox-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #c9ffe1;
    font-size: 0.9rem;
}

.lightbox-meta strong {
    color: #30ff98;
    letter-spacing: 0.05em;
}

.lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(48, 255, 152, 0.15);
    border: 1px solid rgba(48, 255, 152, 0.45);
    border-radius: 999px;
    color: #b9ffd6;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(48, 255, 152, 0.35);
    outline: none;
}

.queue-status {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.8rem;
}

.status-pending {
    background: rgba(255, 200, 70, 0.12);
    color: #ffcf6d;
}

.status-processed {
    background: rgba(48, 255, 152, 0.12);
    color: #30ff98;
}

.queue-timestamp {
    font-size: 0.78rem;
    color: #8af4bc;
}

.queue-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.queue-actions form {
    margin: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 600;
    color: #9df7c5;
}

.field input[type="text"],
.field input[type="file"],
.field input[type="number"],
.field input[type="search"] {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(48, 255, 152, 0.28);
    background-color: rgba(8, 24, 12, 0.9);
    font: inherit;
    color: #c9ffe1;
    box-shadow: inset 0 0 12px rgba(15, 60, 25, 0.45);
}

.field select {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(48, 255, 152, 0.28);
    background-color: rgba(8, 24, 12, 0.9);
    font: inherit;
    color: #c9ffe1;
    box-shadow: inset 0 0 12px rgba(15, 60, 25, 0.45);
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, rgba(48, 255, 152, 0.8) 50%), linear-gradient(135deg, rgba(48, 255, 152, 0.8) 50%, transparent 50%);
    background-position: calc(100% - 1.3rem) calc(50% - 0.25rem), calc(100% - 1rem) calc(50% - 0.25rem);
    background-size: 8px 8px, 8px 8px;
    background-repeat: no-repeat;
    padding-right: 2.5rem;
}

.field input[type="text"]:focus,
.field input[type="file"]:focus,
.field input[type="number"]:focus,
.field input[type="search"]:focus {
    outline: 2px solid rgba(48, 255, 152, 0.55);
    border-color: rgba(48, 255, 152, 0.6);
}

.field select:focus {
    outline: 2px solid rgba(48, 255, 152, 0.55);
    border-color: rgba(48, 255, 152, 0.6);
}

.field select option {
    background-color: rgba(8, 24, 12, 0.95);
    color: #c9ffe1;
}

.field__hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #78f3b3;
}

.field--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.field--checkbox input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.font-size-control input[type="range"] {
    flex: 1;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(48, 255, 152, 0.8), rgba(48, 255, 152, 0.25));
    outline: none;
}

.font-size-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #30ff98;
    border: 2px solid rgba(8, 24, 12, 0.9);
    box-shadow: 0 0 12px rgba(48, 255, 152, 0.55);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.font-size-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #30ff98;
    border: 2px solid rgba(8, 24, 12, 0.9);
    box-shadow: 0 0 12px rgba(48, 255, 152, 0.55);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.font-size-control input[type="range"]:focus-visible::-webkit-slider-thumb,
.font-size-control input[type="range"]:hover::-webkit-slider-thumb,
.font-size-control input[type="range"]:focus-visible::-moz-range-thumb,
.font-size-control input[type="range"]:hover::-moz-range-thumb {
    transform: scale(1.1);
    box-shadow: 0 0 18px rgba(48, 255, 152, 0.75);
}

.font-size-output {
    font-weight: 700;
    color: #c9ffe1;
    min-width: 3ch;
    text-align: right;
}

.font-size-unit {
    font-size: 0.85rem;
    color: #8cf6be;
}

.customization-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.customization-controls--two-column {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.control-card {
    background: rgba(6, 22, 10, 0.85);
    border: 1px solid rgba(48, 255, 152, 0.25);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.control-card span {
    font-size: 0.9rem;
    color: #bfffe3;
}

.control-card__hint {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
    color: #8cf6be;
}

.unlock-panel {
    border: 1px dashed rgba(48, 255, 152, 0.35);
    border-radius: 16px;
    padding: 1.25rem;
    background: rgba(6, 32, 12, 0.88);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.unlock-panel h2 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: #30ff98;
    text-transform: uppercase;
}

.unlock-panel p {
    margin: 0;
    color: #8cf6be;
}

.unlock-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    align-items: end;
}

.unlock-form__button {
    align-self: flex-end;
}

.unlock-message {
    grid-column: 1 / -1;
    min-height: 1.2rem;
    margin: 0;
    font-weight: 600;
    color: #8cf6be;
}

.unlock-message--error {
    color: #ff9393;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.gallery--selection {
    margin-top: 2.25rem;
    margin-bottom: 2rem;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-start;
    margin-top: 1rem;
}

.download-button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.popover-link {
    background: none;
    border: none;
    color: #30ff98;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.popover-link--inline {
    margin-left: 0.4rem;
    font-size: 0.9rem;
}

.popover-panel {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 120;
}

.popover-panel.is-visible {
    opacity: 1;
    visibility: visible;
}

.popover-content {
    background: rgba(6, 22, 10, 0.95);
    border: 1px solid rgba(48, 255, 152, 0.35);
    border-radius: 14px;
    padding: 1.5rem;
    width: min(540px, 90vw);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}

.popover-content h3 {
    margin: 0 0 0.8rem;
    color: #30ff98;
}

.popover-content ol {
    margin: 0 0 1rem 1.25rem;
    color: #c9ffe1;
}

.popover-hint {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid #30ff98;
    background: rgba(48, 255, 152, 0.08);
    color: #bfffe3;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: inset 0 0 12px rgba(48, 255, 152, 0.2);
}

.popover-close {
    background: none;
    border: none;
    color: #ff9393;
    font-weight: 700;
    cursor: pointer;
}

.badge-editor {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin: 0 auto 2.5rem;
    width: min(720px, 100%);
}

.badge-editor--inactive .name-overlay {
    opacity: 0;
    pointer-events: none;
}

.badge-editor--inactive .badge-preview {
    opacity: 0.6;
}

.badge-preview {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(48, 255, 152, 0.28);
    background: rgba(8, 24, 12, 0.92);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.badge-preview--empty {
    min-height: 320px;
}

.badge-preview img {
    display: none;
    width: 100%;
    height: auto;
    object-fit: contain;
    /* When badge images are scaled in the preview, keep them pixelated */
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

.badge-preview img.badge-preview__image--visible {
    display: block;
}

.badge-preview__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    font-weight: 600;
    color: #9df7c5;
    letter-spacing: 0.04em;
    background: rgba(0, 0, 0, 0.38);
}

.badge-preview__placeholder.is-hidden {
    display: none;
}

.badge-preview__guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    background: rgba(255, 0, 0, 0.45);
    pointer-events: none;
    z-index: 2;
    display: none;
}


.name-overlay {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.2s ease;
    background: transparent;
}

.name-overlay--dragging {
    cursor: grabbing;
    transform: scale(1.02);
}

.badge-instruction {
    margin: 0;
    font-size: 0.85rem;
    color: #8cf6be;
    text-align: center;
}

.thumbnail {
    position: relative;
    border: 2px solid rgba(48, 255, 152, 0.2);
    border-radius: 12px;
    padding: 0.5rem;
    background-color: rgba(8, 24, 12, 0.9);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.thumbnail:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(48, 255, 152, 0.2);
    border-color: rgba(48, 255, 152, 0.45);
}

.thumbnail span {
    font-weight: 600;
    color: #8ff7c1;
}

.thumbnail.active {
    border-color: rgba(48, 255, 152, 0.75);
    box-shadow: 0 20px 40px rgba(48, 255, 152, 0.25);
}

.thumbnail img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    /* Preserve pixel look when scaled */
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

.thumbnail__media {
    position: relative;
    width: 100%;
    min-height: 150px;
}

.thumbnail__lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    text-align: center;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #ffdede;
    font-weight: 700;
    letter-spacing: 0.06em;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.thumbnail__lock-overlay small {
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #ffe5e5;
}

.thumbnail--locked {
    border-style: dashed;
    opacity: 0.9;
}

.thumbnail--locked:hover {
    transform: none;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
    border-color: rgba(48, 255, 152, 0.25);
}

.pi-easter-egg {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.pi-easter-egg:hover,
.pi-easter-egg:focus-visible {
    color: #ffe066;
    transform: scale(1.15);
    outline: none;
}

.field input[type="file"] {
    color-scheme: dark;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: #78f3b3;
}

@media (max-width: 720px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 1.6rem;
    }

    h1 {
        letter-spacing: 0.08em;
    }

    .badge-table-wrapper {
        padding: 1rem;
    }

.badge-table__preview-cell {
    flex-direction: column;
    justify-content: center;
}

.badge-table__preview {
    margin: 0 auto;
        width: 115px;
        height: 115px;
    }

    .badge-table__firmware,
    .badge-table__actions {
        width: 100%;
    }

    .badge-table__actions button {
        justify-self: stretch;
        text-align: center;
    }

    .queue-preview {
        width: 100px;
        height: 100px;
    }

    .secondary,
    .primary {
        padding: 0.55rem 1.1rem;
    }
}

@media (max-width: 920px) {
    .badge-table {
        min-width: 100%;
    }

    .badge-table thead {
        display: none;
    }

    .badge-table,
    .badge-table tbody,
    .badge-table tr,
    .badge-table td {
        display: block;
        width: 100%;
    }

    .badge-table tr {
        margin-bottom: 1.5rem;
        background: rgba(6, 18, 8, 0.95);
        border-radius: 14px;
        padding: 1rem;
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
        border-bottom: none;
    }

    .badge-table td {
        border-bottom: none;
        padding: 0.65rem 0;
    }

    .badge-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        margin-bottom: 0.35rem;
        color: #30ff98;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-size: 0.78rem;
    }

    .badge-table__preview-cell {
        margin-top: 0.5rem;
        gap: 0.75rem;
    }

    .badge-table__firmware {
        gap: 0.4rem;
        margin-top: 0.5rem;
    }

    .badge-table__actions form {
        grid-template-columns: 1fr;
    }

    .badge-table__actions button {
        justify-self: stretch;
    }
}

.breadcrumbs {
    margin-bottom: 1.5rem;
}

.breadcrumbs a {
    color: #8cf6be;
    text-decoration: none;
    font-weight: 600;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
    color: #c8ffe7;
    text-decoration: underline;
}

.log-controls {
    margin-bottom: 1.5rem;
}

.log-controls__form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1.2rem;
    border-radius: 14px;
    border: 1px solid rgba(48, 255, 152, 0.18);
    background: rgba(6, 20, 10, 0.9);
}

.log-controls__label {
    font-weight: 600;
    color: #8cf6be;
}

.log-controls__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.log-controls input[type="number"] {
    width: 100%;
    max-width: 160px;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(48, 255, 152, 0.28);
    background: rgba(0, 20, 10, 0.45);
    color: #d4ffe7;
}

.log-controls__search {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.log-controls__search span {
    font-weight: 600;
    color: #8cf6be;
}

.log-controls__search input[type="search"] {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(48, 255, 152, 0.28);
    background: rgba(0, 16, 10, 0.55);
    color: #eafff3;
    font: inherit;
}

.log-controls__search input[type="search"]::placeholder {
    color: rgba(234, 255, 243, 0.6);
}

.log-controls__search input[type="search"]:focus {
    outline: 2px solid rgba(48, 255, 152, 0.55);
    border-color: rgba(48, 255, 152, 0.65);
}

.log-controls__autorefresh {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #b0f8d4;
    margin-top: 0.5rem;
    cursor: pointer;
}

.log-controls__autorefresh input {
    width: auto;
    transform: scale(1.2);
}

.log-stream {
    border-radius: 16px;
    border: 1px solid rgba(48, 255, 152, 0.16);
    background: rgba(4, 16, 8, 0.92);
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.log-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-family: "IBM Plex Mono", "Fira Code", monospace;
    font-size: 0.92rem;
}

.log-list__item {
    display: grid;
    grid-template-columns: minmax(180px, 215px) auto minmax(140px, 1fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid rgba(48, 255, 152, 0.08);
}

@media (max-width: 720px) {
    .log-list__item {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
}

.log-list__timestamp {
    color: #9bf2c4;
    font-weight: 600;
}

.log-list__level {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.log-list__level--info {
    color: #30ff98;
    border-color: rgba(48, 255, 152, 0.45);
}

.log-list__level--warning {
    color: #ffd87a;
    border-color: rgba(255, 216, 122, 0.45);
}

.log-list__level--error,
.log-list__level--critical {
    color: #ff9898;
    border-color: rgba(255, 120, 120, 0.55);
}

.log-list__logger {
    color: #7af0b2;
    font-weight: 500;
}

.log-list__message {
    color: #e0ffee;
    word-break: break-word;
    white-space: pre-wrap;
    grid-column: 1 / -1;
    display: block;
    margin-top: 0.2rem;
}

.log-empty {
    text-align: center;
    color: #a7f7cf;
    margin: 2rem 0;
}
