* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Arial', sans-serif;
    background-attachment: fixed;
    min-height: 100vh;
    color: #fff;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(0, 255, 255, 0.06) 0%,
        rgba(0, 191, 255, 0.08) 25%,
        rgba(30, 144, 255, 0.06) 50%,
        rgba(0, 206, 209, 0.08) 75%,
        rgba(0, 255, 255, 0.06) 100%);
    z-index: -1;
    pointer-events: none;
}

#bg-video {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    will-change: transform;
}

.container {
    width: min(880px, calc(100% - 40px));
    max-width: 880px;
    max-height: calc(100vh - 60px);
    margin: 30px auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    border: 1px solid rgba(0, 255, 255, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
    overflow: hidden;
}

.header {
    text-align: center;
    margin-bottom: 4px;
}

.header h1 {
    font-size: clamp(1.1rem, 2.8vw, 1.8rem);
    line-height: 1.1;
    background: linear-gradient(45deg, #00ffff, #00bfff, #1e90ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 16px rgba(0, 255, 255, 0.22);
    margin-bottom: 4px;
}

.header p {
    font-size: clamp(0.65rem, 1.1vw, 0.85rem);
    color: rgba(255,255,255,0.85);
    opacity: 0.88;
}

.container > form,
.container > .result-container {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.25) transparent;
    scroll-behavior: smooth;
    scrollbar-gutter: stable both-edges;
}

.container > form::-webkit-scrollbar,
.container > .result-container::-webkit-scrollbar {
    width: 5px;
}

.container > form::-webkit-scrollbar-track,
.container > .result-container::-webkit-scrollbar-track {
    background: transparent;
}

.container > form::-webkit-scrollbar-thumb,
.container > .result-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 255, 255, 0.25);
    border-radius: 2.5px;
    transition: background-color 0.2s ease;
}

.container > form::-webkit-scrollbar-thumb:hover,
.container > .result-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 255, 255, 0.45);
}

.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #00ffff;
    font-weight: 700;
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.1);
    font-size: clamp(0.75rem, 1.1vw, 0.9rem);
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-container input[type="text"] {
    min-width: 0;
    flex: 1;
}

input[type="text"], textarea, select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 10px;
    background: rgba(0, 255, 255, 0.06);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1.4px solid rgba(0, 255, 255, 0.18);
    border-radius: 10px;
    color: #fff;
    font-size: clamp(0.7rem, 1.4vw, 0.8rem);
    transition: all 0.16s ease;
    line-height: 1.3;
    transform: translateZ(0);
    will-change: border-color, box-shadow, background;
}

input[type="text"], select {
    height: 44px;
}

textarea {
    height: 100px;
    resize: none;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.25) transparent;
    scroll-behavior: smooth;
}

textarea::-webkit-scrollbar {
    width: 5px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background-color: rgba(0, 255, 255, 0.25);
    border-radius: 2.5px;
    transition: background-color 0.2s ease;
}

textarea::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 255, 255, 0.45);
}

input[type="text"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: rgba(0, 255, 255, 0.85);
    box-shadow: 0 4px 16px rgba(0, 255, 255, 0.06);
    background: rgba(0, 255, 255, 0.08);
    transform: translateY(-1px);
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.btn {
    padding: 9px 12px;
    background: linear-gradient(45deg, #00ffff, #00bfff);
    border: none;
    border-radius: 10px;
    color: #000;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.14s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    font-size: clamp(0.75rem, 1.3vw, 0.9rem);
    height: 39px;
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn:hover::before {
    width: 100%;
    height: 100%;
}

.btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(0, 180, 255, 0.1);
    background: linear-gradient(45deg, #00bfff, #1e90ff);
}

.btn:active {
    transform: translateY(0);
}

.btn-small {
    padding: 7px 9px;
    font-size: clamp(0.65rem, 1vw, 0.78rem);
    min-width: 68px;
    height: 36px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.control-group select {
    flex: 0 0 170px;
    min-width: 130px;
}

.control-group input[type="number"] {
    flex: 0 0 50px;
    min-width: 40px;
    height: 39px;
}

.control-group .btn[onclick="copyResults()"] {
    min-width: 100px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
}

.control-group .btn[onclick="copyResults()"]:hover {
    background: linear-gradient(45deg, #ee5a24, #c44569);
}

.result-container {
    margin-top: 4px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.12);
}

#results {
    height: 90px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    color: #00ffff;
    font-size: 0.80rem;
    line-height: 1.4;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 255, 0.25) transparent;
    scroll-behavior: smooth;
}

#results::-webkit-scrollbar {
    width: 5px;
}

#results::-webkit-scrollbar-track {
    background: transparent;
}

#results::-webkit-scrollbar-thumb {
    background-color: rgba(0, 255, 255, 0.25);
    border-radius: 2.5px;
    transition: background-color 0.2s ease;
}

#results::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 255, 255, 0.45);
}

.loading {
    display: none;
    text-align: center;
    color: #00ffff;
    font-size: 0.85rem;
}

.loading::after {
    content: '';
    animation: dots 1.2s infinite;
}

@keyframes dots {
    0%, 33% { content: '.'; }
    34%, 66% { content: '..'; }
    67%, 100% { content: '...'; }
}

.upload-area {
    border: 1.4px dashed rgba(0, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    margin: 8px 0;
    transition: all 0.16s ease;
    cursor: pointer;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
}

.upload-area:hover {
    border-color: rgba(0, 255, 255, 0.85);
    background: rgba(0, 255, 255, 0.02);
}

.upload-area.dragover {
    border-color: rgba(0, 255, 255, 0.95);
    background: rgba(0, 255, 255, 0.03);
}

#file-input {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 1.5px;
    overflow: hidden;
    margin: 10px 0;
    display: none;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ffff, #00bfff);
    width: 0%;
    transition: width 0.25s ease;
}

@media (max-width: 420px), (max-height: 640px) {
    .container {
        width: calc(100% - 16px);
        margin: 8px auto;
        padding: 10px;
        max-height: calc(100vh - 16px);
        border-radius: 10px;
    }

    .container > form,
    .container > .result-container {
        max-height: calc(100vh - 140px);
    }

    .header h1 { font-size: 1rem; }
    
    input[type="text"], select, .btn, .control-group input[type="number"] {
        height: 30px;
        padding: 8px;
    }
    
    textarea {
        height: 80px;
        padding: 8px;
    }
    
    #results {
        height: 50px;
    }
    
    .control-group {
        gap: 6px;
        margin: 10px 0;
    }
    
    .control-group select {
        flex: 0 0 100px;
        min-width: 90px;
    }
    
    .control-group input[type="number"] {
        flex: 0 0 45px;
        min-width: 40px;
    }
    
    .btn {
        height: 30px;
        padding: 4px 6px;
        min-width: 70px;
        font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    }
    
    .control-group .btn[onclick="copyResults()"] {
        min-width: 85px;
    }
    
    .btn-small {
        height: 28px;
        padding: 4px 6px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    label {
        margin-bottom: 4px;
    }
}

@media (min-width: 421px) and (max-width: 900px) {
    .container {
        width: calc(100% - 24px);
        padding: 14px;
    }

    .header h1 { font-size: clamp(1.1rem, 2.8vw, 1.6rem); }
    
    #results {
        height: 70px;
    }
    
    .control-group {
        gap: 9px;
    }
    
    .control-group select {
        flex: 0 0 150px;
        min-width: 125px;
    }
    
    .control-group input[type="number"] {
        flex: 0 0 80px;
        min-width: 60px;
    }
}

@media (min-width: 1200px) {
    .container { padding: 22px; }
    
    #results {
        height: 110px;
    }
    
    .control-group {
        gap: 12px;
    }
}

@media (min-width: 1600px) {
    .container {
        max-width: 860px;
        max-height: calc(100vh - 80px);
        margin: 40px auto;
    }
    
    #results {
        height: 130px;
    }
    
    .control-group {
        gap: 14px;
    }
}
    
@media (min-height: 1000px) {
    .container {
        max-height: calc(100vh - 100px);
        margin: 50px auto;
    }
    
    .container > form,
    .container > .result-container {
        max-height: calc(100vh - 240px);
    }
    
    #results {
        height: 150px;
    }
    
    .control-group {
        gap: 15px;
    }
}

@media (min-height: 900px) {
    .container {
        max-height: calc(100vh - 80px);
        margin: 40px auto;
    }
    
    .container > form,
    .container > .result-container {
        max-height: calc(100vh - 260px);
    }
    
    #results {
        height: 150px;
    }
    
    .control-group {
        gap: 16px;
    }
}

@media (max-height: 500px) {
    .container {
        max-height: calc(100vh - 8px);
        margin: 4px auto;
        padding: 6px;
    }
    
    .container > form,
    .container > .result-container {
        max-height: calc(100vh - 100px);
    }
    
    .header h1 { 
        font-size: clamp(0.9rem, 2.2vw, 1.3rem);
        margin-bottom: 1px;
    }
    
    .header p {
        font-size: clamp(0.55rem, 0.9vw, 0.75rem);
        margin-bottom: 2px;
    }
    
    input[type="text"], select, .btn, .control-group input[type="number"] {
        height: 33px;
        padding: 6px;
    }
    
    textarea {
        height: 60px;
        padding: 6px;
    }
    
    #results {
        height: 30px;
    }
    
    .control-group {
        gap: 6px;
        margin: 10px 0;
    }
    
    .control-group select {
        flex: 0 0 120px;
        min-width: 100px;
    }
    
    .control-group input[type="number"] {
        flex: 0 0 60px;
        min-width: 45px;
    }
    
    .btn {
        height: 28px;
        padding: 4px 6px;
    }
    
    .btn-small {
        height: 28px;
        padding: 4px 6px;
    }
    
    .form-group {
        margin-bottom: 8px;
    }
    
    label {
        margin-bottom: 3px;
    }
}

@media (min-width: 2560px) {
    .container {
        max-width: 920px;
        max-height: calc(100vh - 120px);
        margin: 60px auto;
        padding: 24px;
    }
    
    .container > form,
    .container > .result-container {
        max-height: calc(100vh - 300px);
    }
    
    #results {
        height: 170px;
    }
    
    .control-group {
        gap: 18px;
    }
}

@media print {
    body {
        background: none;
        color: #000;
    }
    
    .container {
        border: 1px solid #ccc;
        box-shadow: none;
        background: white;
        color: #000;
    }
    
    .btn {
        background: #ccc !important;
        color: #000 !important;
    }
    
    #results {
        height: auto;
        overflow: visible;
    }
    
    .control-group .btn[onclick="copyResults()"] {
        display: none;
    }
}