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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: white;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

h1 {
    color: #1f2937;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    text-shadow: none;
}

.calculator {
    background-color: #5a5a5a;
    background-image: url('attached_assets/Texturelabs_Paper_374M_1762505740800-CLPL0N0t_1762523530427_1762935396191.jpg');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    width: 450px;
    max-width: 100%;
    min-width: 320px;
    margin: 0 auto 40px;
}

.calculator-header {
    height: 25px;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.calculator-branding {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: white;
    font-weight: normal;
    letter-spacing: 0.5px;
}

.screen-container {
    background: #79833A;
    border: 3px solid #4a4a4a;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.4);
    position: relative;
    height: 210px;
    min-height: 210px;
    max-height: 210px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.splash-screen {
    position: absolute;
    top: 22px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.8s ease-in;
    padding: 20px;
    text-align: center;
}

.splash-title {
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-weight: bold;
    color: #1a3a1a;
    margin-bottom: 12px;
    animation: slideDown 0.6s ease-out;
}

.splash-datetime {
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #2a4a2a;
    animation: slideDown 0.6s ease-out 0.2s backwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-screen.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.screen-indicators {
    display: flex;
    justify-content: space-between;
    font-family: Arial, sans-serif;
    font-size: 11px;
    color: #1a3a1a;
    margin-bottom: 8px;
    height: 14px;
    font-weight: bold;
}

.indicator-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.indicator-right {
    display: flex;
    gap: 8px;
}

#sound-indicator {
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.history {
    flex: 1;
    overflow: hidden;
    margin-bottom: 10px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    color: #1a3a1a;
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.history.hidden {
    display: none;
}

.history::-webkit-scrollbar {
    width: 8px;
}

.history::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.history::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
}

.history-item {
    margin-bottom: 6px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-wrap: break-word;
}

.history-command {
    color: #0d2b0d;
    font-weight: normal;
    display: inline;
}

.history-result {
    color: #1a3a1a;
    margin-left: 10px;
    display: inline;
    font-weight: bold;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-line {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    padding: 8px;
    font-family: Arial, sans-serif;
    font-size: 18px;
    color: #000000;
    width: 100%;
    outline: none;
    text-align: right;
    height: 40px;
    line-height: 24px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

.buttons {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 33px;
    column-gap: 8px;
    row-gap: 24px;
    width: 100%;
}

.button {
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.5),
        0 3px 0 #0d0f11,
        0 5px 8px rgba(0,0,0,0.4);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.button:active {
    transform: translateY(2px);
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.2),
        inset 0 -1px 0 rgba(0,0,0,0.4),
        0 1px 0 #0d0f11,
        0 3px 5px rgba(0,0,0,0.3);
}

.button-shift {
    font-size: 10px;
    color: #a78bfa;
    position: absolute;
    top: -14px;
    left: 2px;
    font-weight: normal;
}

.button-alpha {
    font-size: 9px;
    color: #FFD700;
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-weight: bold;
}

.button-main {
    font-size: 15px;
    color: white;
}

.btn-shift {
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
    grid-column: span 2;
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.5),
        0 3px 0 #0d0f11,
        0 5px 8px rgba(0,0,0,0.4);
}

.btn-shift .button-main {
    color: #a78bfa;
}

.btn-shift.active {
    background: linear-gradient(to bottom, #4a5058 0%, #3a3f45 35%, #2a2d32 70%, #1f2224 100%);
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.4),
        inset 0 -2px 0 rgba(0,0,0,0.4),
        0 3px 0 #1a1d22,
        0 5px 8px rgba(139, 92, 246, 0.5);
}

.btn-shift.active .button-main {
    color: #c4b5fd;
}

.btn-function.active {
    background: linear-gradient(to bottom, #4a5058 0%, #3a3f45 35%, #2a2d32 70%, #1f2224 100%);
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.4),
        inset 0 -2px 0 rgba(0,0,0,0.4),
        0 3px 0 #1a1d22,
        0 5px 8px rgba(100, 200, 150, 0.5);
}

.btn-alpha {
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
    grid-column: span 2;
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.5),
        0 3px 0 #0d0f11,
        0 5px 8px rgba(0,0,0,0.4);
}

.btn-alpha .button-main {
    color: #FFD700;
}

.btn-alpha.active {
    background: linear-gradient(to bottom, #4a5058 0%, #3a3f45 35%, #2a2d32 70%, #1f2224 100%);
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.4),
        inset 0 -2px 0 rgba(0,0,0,0.4),
        0 3px 0 #1a1d22,
        0 5px 8px rgba(255, 215, 0, 0.5);
}

.btn-alpha.active .button-main {
    color: #FFE55C;
}

.btn-enter {
    grid-column: span 3;
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.3),
        inset 0 -2px 0 rgba(0,0,0,0.5),
        0 3px 0 #0d0f11,
        0 5px 8px rgba(0,0,0,0.4);
}

.btn-enter:active {
    transform: translateY(2px);
    box-shadow: 
        inset 0 2px 0 rgba(255,255,255,0.2),
        inset 0 -1px 0 rgba(0,0,0,0.4),
        0 1px 0 #0d0f11,
        0 3px 5px rgba(0,0,0,0.3);
}

.btn-number {
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
}

.btn-number .button-main {
    font-size: 20px;
}

.btn-operator {
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
}

.btn-function {
    background: linear-gradient(to bottom, #3a4048 0%, #2a2f35 35%, #1a1d22 70%, #0f1114 100%);
}

.features {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.features h2 {
    color: #1f2937;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.feature-item {
    padding: 20px;
    background: #f9fafb;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.feature-item h3 {
    color: #374151;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.feature-item p {
    color: #6b7280;
    line-height: 1.6;
    font-size: 0.95rem;
}

.graph-view {
    display: none;
    position: relative;
    flex: 1;
    min-height: 0;
    margin-bottom: 10px;
    background: #ffffcc;
    border-radius: 4px;
    padding: 2px;
    overflow: hidden;
}

.close-graph-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 25px;
    height: 25px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.close-graph-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

#calc-chart {
    width: 100% !important;
    height: 100% !important;
}

.graph-legend {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    max-width: 200px;
    z-index: 5;
    backdrop-filter: blur(2px);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    gap: 6px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    color: #1a3a1a;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.legend-delete:hover {
    opacity: 0.7;
}

@media (max-width: 480px) {
    .calculator {
        padding: 15px;
    }
    
    .button-main {
        font-size: 16px;
    }
    
    .button-shift {
        font-size: 9px;
    }
    
    .buttons {
        column-gap: 8px;
        row-gap: 20px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}
