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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 500px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.lang-btn {
    padding: 8px 16px;
    border: 2px solid white;
    background: transparent;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.2);
}

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

.converter-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}

.input-section {
    margin-bottom: 30px;
}

.input-section label {
    display: block;
    margin-bottom: 15px;
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.currency-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.currency-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 75px;
    flex: 1;
    max-width: 100px;
}

.currency-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

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

.currency-btn .currency-symbol {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.currency-btn .currency-name {
    font-size: 12px;
    font-weight: normal;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .currency-symbol {
    position: absolute;
    left: 15px;
    color: #667eea;
    font-weight: bold;
    font-size: 18px;
    z-index: 1;
}

#amountInput {
    width: 100%;
    padding: 15px 15px 15px 60px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    transition: border-color 0.3s ease;
}

#amountInput:focus {
    outline: none;
    border-color: #667eea;
}

.results-section {
    margin-bottom: 30px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item label {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.result-value {
    display: flex;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

.result-value .currency-symbol {
    margin-right: 5px;
}

.rate-info {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.rate-display {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.rate-item {
    font-size: 13px;
    color: #666;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.rate-item span:last-child {
    font-weight: bold;
    color: #333;
}

.update-time {
    text-align: center;
    font-size: 12px;
    color: #888;
}

.loading {
    display: none;
    text-align: center;
    color: white;
    margin-top: 20px;
}

.loading.show {
    display: block;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 響應式設計 */

/* Tablet optimizations (iPad) */
@media (max-width: 1024px) and (min-width: 601px) {
    .container {
        max-width: 600px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .converter-card {
        padding: 35px;
    }
    
    .currency-selector {
        gap: 12px;
    }
    
    .currency-btn {
        min-width: 90px;
        padding: 15px 20px;
    }
    
    .currency-btn .currency-symbol {
        font-size: 22px;
    }
    
    #amountInput {
        font-size: 20px;
        padding: 18px 18px 18px 65px;
    }
    
    .result-value {
        font-size: 22px;
    }
    
    .rate-display {
        gap: 15px;
    }
    
    .rate-item {
        font-size: 14px;
        min-width: 140px;
    }
}

/* Mobile optimizations */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .converter-card {
        padding: 20px 15px;
        border-radius: 15px;
    }
    
    .language-selector {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .lang-btn {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 15px;
    }

    .currency-selector {
        gap: 8px;
        margin-bottom: 20px;
    }

    .currency-btn {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 15px 12px;
        min-width: auto;
        flex: 1;
        min-height: 50px;
        border-radius: 10px;
    }

    .currency-btn .currency-symbol {
        margin-bottom: 0;
        margin-right: 6px;
        font-size: 18px;
    }
    
    .currency-btn .currency-name {
        font-size: 11px;
    }
    
    .input-wrapper .currency-symbol {
        left: 12px;
        font-size: 16px;
    }
    
    #amountInput {
        padding: 18px 15px 18px 45px;
        font-size: 18px;
        border-radius: 8px;
    }
    
    .result-item {
        padding: 18px 0;
    }
    
    .result-item label {
        font-size: 15px;
    }
    
    .result-value {
        font-size: 18px;
    }
    
    .rate-info {
        padding: 15px;
        border-radius: 8px;
    }
    
    .rate-display {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .rate-item {
        font-size: 12px;
        min-width: auto;
        text-align: left;
        padding: 5px 0;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .rate-item:last-child {
        border-bottom: none;
    }
    
    .update-time {
        font-size: 11px;
    }
}

/* Small mobile phones */
@media (max-width: 375px) {
    .header h1 {
        font-size: 1.6rem;
    }
    
    .converter-card {
        padding: 15px 12px;
    }
    
    .currency-btn {
        padding: 12px 8px;
        min-height: 45px;
    }
    
    .currency-btn .currency-symbol {
        font-size: 16px;
        margin-right: 4px;
    }
    
    .currency-btn .currency-name {
        font-size: 10px;
    }
    
    #amountInput {
        padding: 15px 12px 15px 40px;
        font-size: 16px;
    }
    
    .input-wrapper .currency-symbol {
        left: 10px;
        font-size: 14px;
    }
    
    .result-value {
        font-size: 16px;
    }
    
    .lang-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .currency-btn {
        min-height: 48px;
    }
    
    .lang-btn {
        min-height: 44px;
    }
    
    #amountInput {
        min-height: 48px;
    }
    
    .currency-btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .lang-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}
