:root {
    --primary-color: #f1b400; /* Your signature yellow */
    --primary-hover: #dbc300;
    --bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --input-focus-shadow: 0 0 0 0.25rem rgba(241, 180, 0, 0.25);
}

body { background-color: #f8f9fa; }
.logo { font-size: 2.5rem; font-weight: bold; }
.red { color: #dc3545; }
.green { color: #198754; }
.main-card { max-width: 600px; margin: 50px auto; border: none; border-radius: 15px; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: #333;
}

/* --- Logo & Branding --- */
.logo {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1.5px;
}

.logo .red { color: #e74c3c; }
.logo .green { color: #27ae60; }

/* --- Password Display Area --- */
#p_in {
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    
}

#p_in:focus {
    border-color: var(--primary-color);
    box-shadow: var(--input-focus-shadow);
}

/* Custom button colors to match your original theme */
#btn_copy {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #333;
}

#btn_copy:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* --- Range Sliders (Modernized) --- */
.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
}

.form-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(241, 180, 0, 0.25);
}

/* --- History Section --- */
#h {
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

#h span {
    display: block;
    padding: 8px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: background 0.2s;
}

#h span:hover {
    background: #f1f3f5;
}

#m_out {
    min-height: 150px;
}

/* --- Meanings Section --- */
.meaning-item {
    background: #fff;
    padding: 10px 15px;
    border-left: 4px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.meaning-item b {
    color: #222;
}

/* Show icon on hover */
.history-item:hover .copy-icon {
    opacity: 1 !important;
    transition: opacity 0.2s ease-in-out;
}

/* Optional: change background on hover to show it's clickable */
.history-item:hover {
    background-color: #f8f9fa;
}

/* Feedback animation when clicked */
.history-item:active {
    background-color: #e9ecef;
}

/* Mobile Logic: Input on top, Buttons 50/50 below */
@media (max-width: 767.98px) {
    .connected-group #p_in {
        border-bottom: 0;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
    .connected-group #btn_copy {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .connected-group #btn_renew {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-bottom-left-radius: 0;
        border-left: 0; /* Prevents double border between the two buttons */
    }

    .flex-shrink-0.text-end {
        display: none;
    }

    .logo { font-size: 2.2rem; }
    .main-card { margin: 20px 15px; }
}

/* Desktop Logic: Side-by-side [Copy][Input][Renew] */
@media (min-width: 768px) {
    .connected-group #btn_copy {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .connected-group #p_in {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }
    .connected-group #btn_renew {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }

    


}

/* Ensure borders don't disappear on focus */
.connected-group .form-control:focus {
    z-index: 3;
}
.connected-group .btn:active {
    z-index: 3;
}