* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #007aff;
    --primary-dark: #0051d5;
    --primary-light: #4da2ff;
    --secondary: #005ecb;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --bg-white: #ffffff;
    --bg-gray: #f5f5f7;
    --border: #d2d2d7;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: #f5f5f7;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #007aff 0%, #005ecb 50%, #0051d5 100%);
    opacity: 0.04;
    z-index: 0;
}

.background-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.08) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.container {
    width: 100%;
    max-width: 540px;
    position: relative;
    z-index: 1;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--bg-white);
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.header {
    padding: 40px 40px 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.4;
}

.title {
    font-size: 32px;
    color: white;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
    position: relative;
}

form {
    padding: 40px;
}


.form-section {
    margin-bottom: 32px;
}

.form-section:last-of-type {
    margin-bottom: 0;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.input-group {
    margin-bottom: 20px;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.input-group:nth-child(2) { animation-delay: 0.05s; }
.input-group:nth-child(3) { animation-delay: 0.1s; }
.input-group:nth-child(4) { animation-delay: 0.15s; }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.label-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.label-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Hide number input arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Better touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    input {
        min-height: 48px;
    }
    
    .btn-calculate {
        min-height: 48px;
    }
}

input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

input:hover {
    border-color: var(--primary-light);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.btn-calculate {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 32px;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.btn-calculate svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
}

.btn-calculate:hover svg {
    transform: translateX(4px);
}

.btn-calculate:active {
    transform: translateY(0);
}


.result {
    margin: 0 40px 40px;
    padding: 32px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f7 100%);
    border-radius: 16px;
    border: 2px solid var(--border);
    animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result.hidden {
    display: none;
}

.result-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: -0.01em;
}

.score-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.25);
    position: relative;
    overflow: hidden;
}

.score-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.score-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    position: relative;
}

.score-value {
    font-size: 56px;
    font-weight: 700;
    color: white;
    line-height: 1;
    letter-spacing: -0.02em;
    animation: countUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.details {
    background: white;
    padding: 24px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.details p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.details p:last-child {
    margin-bottom: 0;
}

.details strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .card {
        border-radius: 20px;
    }
    
    .header {
        padding: 32px 24px 24px;
    }
    
    .title {
        font-size: 26px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    form {
        padding: 32px 24px;
    }
    
    .section-title {
        font-size: 13px;
    }
    
    .input-group {
        margin-bottom: 18px;
    }
    
    .label-text {
        font-size: 13px;
    }
    
    .label-hint {
        font-size: 11px;
    }
    
    input {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .input-row {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .btn-calculate {
        padding: 14px 20px;
        font-size: 15px;
        margin-top: 24px;
    }
    
    .result {
        margin: 0 24px 24px;
        padding: 24px 20px;
    }
    
    .result-header h2 {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .score-card {
        padding: 24px 20px;
    }
    
    .score-label {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .score-value {
        font-size: 48px;
    }
    
    .details {
        padding: 20px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .header {
        padding: 28px 20px 20px;
    }
    
    .title {
        font-size: 24px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    form {
        padding: 28px 20px;
    }
    
    .form-section {
        margin-bottom: 28px;
    }
    
    .section-title {
        font-size: 12px;
        margin-bottom: 16px;
        padding-bottom: 10px;
    }
    
    .input-group {
        margin-bottom: 16px;
    }
    
    input {
        padding: 12px;
        font-size: 16px;
    }
    
    .btn-calculate {
        padding: 13px 18px;
        font-size: 14px;
        margin-top: 20px;
    }
    
    .btn-calculate svg {
        width: 18px;
        height: 18px;
    }
    
    .result {
        margin: 0 20px 20px;
        padding: 20px 16px;
    }
    
    .score-card {
        padding: 20px 16px;
    }
    
    .score-value {
        font-size: 42px;
    }
    
    .details {
        padding: 16px 14px;
        font-size: 12px;
        line-height: 1.7;
    }
    
    .details p {
        margin-bottom: 6px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
