/* Studio look: dark stage, quiet settings deck, one clear action. */

html {
    color-scheme: dark;
    scrollbar-color: #31414d #0c1218;
    scrollbar-width: thin;
}

body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: #070b10;
    color: #e7eef4;
}

.container {
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
}

.header {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    background: rgba(7, 11, 16, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow: visible;
}

.header::before,
.header::after {
    display: none;
}

.header h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 720;
    letter-spacing: -0.03em;
    text-shadow: none;
    justify-content: flex-start;
    gap: 10px;
}

.header-icon {
    width: 34px;
    height: 34px;
}

.header p {
    margin: 0;
    font-size: 0.84rem;
    color: #8ea0ae;
    opacity: 1;
}

.header-tools {
    margin: 0 0 0 auto;
}

.header-tool {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e7eef4;
}

.header-tool:hover {
    background: #1e8449;
    border-color: #1e8449;
}

.upload-section {
    background: #0c1218;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    scrollbar-color: #31414d #0c1218;
    scrollbar-width: thin;
}

.preview-section,
.preview-scroll,
.file-size-estimator,
.gif-grid {
    scrollbar-color: #31414d transparent;
    scrollbar-width: thin;
}

html::-webkit-scrollbar,
.upload-section::-webkit-scrollbar,
.preview-section::-webkit-scrollbar,
.preview-scroll::-webkit-scrollbar,
.file-size-estimator::-webkit-scrollbar,
.gif-grid::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html::-webkit-scrollbar-track,
.upload-section::-webkit-scrollbar-track {
    background: #0c1218;
}

.preview-section::-webkit-scrollbar-track,
.preview-scroll::-webkit-scrollbar-track,
.file-size-estimator::-webkit-scrollbar-track,
.gif-grid::-webkit-scrollbar-track {
    background: transparent;
}

html::-webkit-scrollbar-thumb,
.upload-section::-webkit-scrollbar-thumb,
.preview-section::-webkit-scrollbar-thumb,
.preview-scroll::-webkit-scrollbar-thumb,
.file-size-estimator::-webkit-scrollbar-thumb,
.gif-grid::-webkit-scrollbar-thumb {
    background: #31414d;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

html::-webkit-scrollbar-thumb:hover,
.upload-section::-webkit-scrollbar-thumb:hover,
.preview-section::-webkit-scrollbar-thumb:hover,
.preview-scroll::-webkit-scrollbar-thumb:hover,
.file-size-estimator::-webkit-scrollbar-thumb:hover,
.gif-grid::-webkit-scrollbar-thumb:hover {
    background: #1e8449;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.upload-section h2,
.preview-section h2 {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7f93a3;
}

.preview-section h2 {
    align-self: flex-start;
}

.upload-section .form-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 12px 14px 14px;
}

.form-group label {
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    color: #d5dee6;
}

.form-group select,
.search-input,
.overlay-row input[type="text"],
.overlay-row select {
    background: #101820;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e7eef4;
}

.form-group select:focus,
.search-input:focus,
.overlay-row input[type="text"]:focus,
.overlay-row select:focus {
    border-color: #2ecc71;
}

.source-tabs {
    gap: 6px;
    padding: 4px;
    border: 0;
    border-radius: 12px;
    background: #101820;
    overflow: visible;
}

.source-tab {
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #9aafbf;
    white-space: nowrap;
    padding: 10px 8px;
    font-size: 13px;
}

.source-tab:last-child {
    border-right: 0;
}

.source-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e7eef4;
}

.source-tab.active {
    background: #1e8449;
    color: #fff;
}

.upload-area {
    border: 1px dashed rgba(46, 204, 113, 0.55);
    border-radius: 16px;
    background: rgba(30, 132, 73, 0.08);
    padding: 28px 16px;
}

.upload-area:hover,
.upload-area.dragover {
    background: rgba(30, 132, 73, 0.16);
    border-color: #2ecc71;
    transform: none;
}

.requirements {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

.maker-panel,
.frame-count-control {
    background: transparent;
    border: 0;
    padding: 0;
}

.preview-section {
    background-color: #090e14;
    background-image:
        radial-gradient(ellipse at 50% 42%, rgba(46, 204, 113, 0.2), transparent 56%),
        radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: auto, 22px 22px;
    border: 0;
}

.device-picker {
    padding: 4px;
    border-radius: 999px;
    background: rgba(8, 12, 17, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.device-option {
    background: transparent;
    color: #c5d4de;
}

.device-option:hover,
.device-option.active {
    background: #1e8449;
    color: #fff;
}

.device-caption {
    margin: 8px 0 0;
    color: #8ea0ae;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    text-align: center;
    text-decoration: none;
}

.device-caption:hover {
    color: #2ecc71;
    text-decoration: underline;
}

.file-size-estimator {
    position: relative;
    z-index: 2;
    flex: 0 1 auto;
    min-height: 0;
    width: min(440px, 100%);
    max-height: clamp(140px, calc(100dvh - 620px), 240px);
    margin: 8px 0 0;
    padding: 14px 10px 14px 16px;
    border-radius: 16px;
    background: rgba(8, 12, 17, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
    overflow-x: hidden;
    overflow-y: scroll;
}

.estimator-content h4,
.estimated-size,
.size-details {
    color: #e7eef4;
}

#processBtn {
    width: 100%;
    margin-top: 0;
    border-radius: 999px;
    padding: 14px 22px;
    letter-spacing: 0.01em;
    box-shadow: 0 12px 28px rgba(30, 132, 73, 0.28);
}

#processBtn[hidden] {
    display: none;
}

#processBtn:hover {
    transform: translateY(-1px);
}

.knomi-card {
    margin: 0 0 14px;
}

#knomiConnectGroup[hidden],
#knomiInstall[hidden] {
    display: none;
}

.knomi-install-title {
    margin: 0 0 6px;
    color: #d5dee6;
    font-size: 0.82rem;
    font-weight: 600;
}

.knomi-install-copy {
    margin: 0 0 12px;
    color: #8ea0ae;
    font-size: 0.82rem;
    line-height: 1.45;
}

.knomi-install-link {
    display: inline-block;
    width: auto;
    background: #1e8449;
    color: #fff;
    text-decoration: none;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.knomi-install-link:hover {
    background: #27ae60;
}

.knomi-optional {
    margin-left: 6px;
    color: #7f93a3;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.knomi-connect {
    display: flex;
    gap: 8px;
    align-items: center;
}

.knomi-connect input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    background: #101820;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e7eef4;
    font: inherit;
}

.knomi-connect input:focus {
    outline: none;
    border-color: #2ecc71;
}

.knomi-connect button,
#knomiPushBtn {
    margin: 0;
    border: 0;
    border-radius: 999px;
    background: #1e8449;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.knomi-connect button {
    flex: 0 0 auto;
    padding: 10px 14px;
}

.process-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: min(440px, 100%);
}

#knomiPushBtn {
    display: block;
    width: 100%;
    margin-top: 0;
    padding: 12px 16px;
}

#knomiPushBtn[hidden] {
    display: none;
}

.knomi-connect button:hover,
#knomiPushBtn:hover {
    background: #27ae60;
}

.knomi-connect button:disabled,
#knomiPushBtn:disabled {
    background: #3d4f5c;
    cursor: not-allowed;
}

.knomi-connect-status,
.knomi-memory,
.knomi-fit {
    margin: 8px 0 0;
    color: #8ea0ae;
    font-size: 0.82rem;
    line-height: 1.4;
}

.knomi-fit.is-ok {
    color: #2ecc71;
}

.knomi-fit.is-over {
    color: #f0c674;
}

.site-footer {
    background: #070b10;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: #7f93a3;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 18px;
}

.footer-links a {
    color: #e7eef4;
    font-weight: 650;
    text-decoration: none;
}

.footer-links a:hover {
    color: #2ecc71;
}

.footer-note {
    color: #7f93a3;
    font-size: 0.78rem;
}

.footer-legal {
    color: #7f93a3;
    font-size: 0.82rem;
}

.footer-legal a {
    color: #2ecc71;
    text-decoration: none;
}

.footer-legal a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .header {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .header p {
        order: 3;
        width: 100%;
    }

    .header-tools {
        margin-left: auto;
    }

    .preview-section {
        background-image: radial-gradient(ellipse at 50% 30%, rgba(46, 204, 113, 0.16), transparent 60%);
    }

    #processBtn {
        position: static;
        width: 100%;
        margin-top: 0;
    }
}
