* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: #f5f5f5;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    text-align: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.calc-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 70px;
}

.calc-panel {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.calc-panel.active {
    display: block;
}

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

/* Standard Calculator */
.display-area {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.display {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 2.5rem;
    text-align: right;
    color: #333;
    font-weight: 500;
}

.display:focus {
    outline: none;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.btn {
    padding: 20px;
    font-size: 1.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.95);
}

.btn.num {
    background: #f0f0f0;
    color: #333;
}

.btn.num:active {
    background: #e0e0e0;
}

.btn.operator {
    background: #667eea;
    color: white;
}

.btn.operator:active {
    background: #5a6fd6;
}

.btn.func {
    background: #e0e0e0;
    color: #666;
}

.btn.func:active {
    background: #d0d0d0;
}

.btn.equals {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn.equals:active {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.btn.zero {
    grid-column: span 2;
}

/* Percentage Calculator */
#percentage h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.result-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.result-box label {
    display: block;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.result-value {
    font-size: 2rem;
    color: white;
    font-weight: 600;
}

.perc-options {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.perc-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.perc-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

/* Age Calculator */
#age h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
}

.calc-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.2s;
}

.calc-btn:active {
    opacity: 0.9;
}

.age-result {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.age-item {
    text-align: center;
    flex: 1;
}

.age-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 600;
    color: #667eea;
}

.age-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* EMI Calculator */
#emi h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #333;
}

.time-input {
    display: flex;
    gap: 10px;
}

.time-input input {
    flex: 2;
}

.time-input select {
    flex: 1;
    padding: 14px;
    font-size: 1.1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
}

.emi-result {
    margin-top: 25px;
}

.emi-item.main {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 15px;
}

.emi-item.main .emi-label {
    display: block;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.emi-item.main .emi-value {
    font-size: 2rem;
    color: white;
    font-weight: 600;
}

.emi-details {
    display: flex;
    gap: 15px;
}

.emi-item {
    flex: 1;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.emi-item .emi-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.emi-item .emi-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 5px 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    border-top: 1px solid #e0e0e0;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-btn:active {
    background: #f0f0f0;
}

.nav-btn.active .nav-icon {
    transform: scale(1.1);
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-text {
    font-size: 0.7rem;
    color: #666;
}

.nav-btn.active .nav-text {
    color: #667eea;
    font-weight: 500;
}

/* Disable selection on mobile */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

input {
    -webkit-user-select: text;
    user-select: text;
}