:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --border-color: #334155;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

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

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-zone {
    background-color: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 3rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-color);
    background-color: rgba(30, 41, 59, 0.5);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: block;
}

.hidden {
    display: none !important;
}

/* Dashboard Layout */
.dashboard {
    /* Reset grid */
    display: block;
}

.score-row {
    margin-bottom: 2rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    /* Add margin bottom for default block flow */
}

/* ... existing card h2 ... */

/* Score Display */
.score-display {
    text-align: center;
    padding: 1rem 0;
}

.big-score {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sub-score {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Unified Byte Calculator */
.byte-card {
    min-height: 400px;
}

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

.byte-select {
    width: 100%;
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.byte-select:focus {
    border-color: var(--accent-color);
}

.byte-display {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.byte-textarea {
    width: 100%;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--text-primary);
    padding: 1rem;
    font-size: 1.1rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    margin-top: 1rem;
}

.byte-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.3);
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.8rem;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.progress-safe {
    background-color: var(--success-color);
}

.progress-warning {
    background-color: var(--warning-color);
}

.progress-danger {
    background-color: var(--danger-color);
}

/* --- Restored & Enhanced Styles --- */

/* Instructions */
.instruction-steps {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.step {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.step h3 {
    margin-bottom: 0.8rem;
    color: var(--accent-color);
    font-size: 1.2rem;
    font-weight: 700;
}

.step p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.instruct-img {
    max-width: 100%;
    /* Fix Overflow */
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
}

.tip-box {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 0.5rem;
    color: var(--warning-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Enhanced Buttons */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.7rem 1.4rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* SeTeuk & Detail Items (Readability) */
.detail-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-radius: 0.8rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 0.8rem;
    color: var(--accent-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.detail-item p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #e2e8f0;
    white-space: pre-wrap;
    letter-spacing: 0.01em;
}

/* Footer Disclaimer */
.footer-disclaimer {
    text-align: center;
    padding: 3rem 1rem;
    font-size: 0.9rem;
    color: #64748b;
    margin-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
        padding: 0;
    }

    .container {
        max-width: 100%;
    }

    header,
    .upload-zone,
    .instruction-steps,
    .tip-box,
    .btn-secondary,
    #backBtn,
    #btnDownloadTxt,
    #btnPrint {
        display: none !important;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
        background: white;
        color: black;
        page-break-inside: avoid;
    }

    .card h2 {
        color: black;
        border-bottom: 2px solid #ccc;
    }

    /* Force text colors for print */
    .detail-item,
    .byte-item {
        background: white;
        border: 1px solid #ddd;
        color: black;
    }

    .detail-item strong {
        color: #000 !important;
    }

    .detail-item p {
        color: #333 !important;
    }

    table {
        font-size: 10px;
    }

    th {
        background-color: #eee;
        color: black;
    }

    td {
        color: black;
    }

    .big-score {
        color: black;
    }

    .byte-textarea {
        border: 1px solid #ccc;
        color: black;
    }
}