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

:root {
    --primary-color: #5e72e4;
    --primary-hover: #4c63d2;
    --secondary-color: #f5365c;
    --success-color: #2dce89;
    --warning-color: #fb6340;
    --info-color: #11cdef;
    --background: #f7fafc;
    --surface: #ffffff;
    --text-primary: #32325d;
    --text-secondary: #525f7f;
    --text-muted: #8898aa;
    --border-color: #e9ecef;
    --shadow-sm: 0 0 0.5rem rgba(0, 0, 0, 0.05);
    --shadow-md: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease;
}

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

.header {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.language-selector {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.language-selector select:hover {
    border-color: var(--primary-color);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(94, 114, 228, 0.25);
}

.main-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tabs {
    display: flex;
    background: var(--background);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.tab-button:hover {
    color: var(--primary-color);
    background: rgba(94, 114, 228, 0.05);
}

.tab-button.active {
    color: var(--primary-color);
    background: var(--surface);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
    padding: 2rem;
    animation: slideIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card {
    background: var(--surface);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

.date-input,
input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
}

.date-input:hover,
input[type="number"]:hover {
    border-color: var(--primary-color);
}

.date-input:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(94, 114, 228, 0.25);
}

.period-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group.inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

.form-group.inline input {
    width: 100px;
}

.form-group.inline label {
    margin-bottom: 0;
    white-space: nowrap;
}

.radio-group,
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.radio-label:hover,
.checkbox-label:hover {
    color: var(--primary-color);
}

input[type="radio"],
input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.calculate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: inline-block;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(0);
}

.today-btn {
    background: var(--info-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-left: 1rem;
}

.today-btn:hover {
    background: #0da5c0;
}

.result-container {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: var(--radius-lg);
    display: none;
    animation: fadeIn 0.5s ease;
}

.result-container h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-item {
    text-align: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.result-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.detailed-result {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.result-date {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-weekday {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.business-days-count {
    font-size: 1.125rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    background: rgba(94, 114, 228, 0.1);
    border-radius: var(--radius-md);
}

.age-result {
    text-align: center;
}

.age-main {
    margin-bottom: 1.5rem;
}

.age-value {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-color);
}

.age-label {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.age-detail {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
}

.age-days {
    font-size: 1.125rem;
    color: var(--text-secondary);
    padding: 0.75rem;
    background: rgba(94, 114, 228, 0.1);
    border-radius: var(--radius-md);
}

.footer {
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.footer p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .language-selector {
        position: static;
        margin-top: 1rem;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1 1 50%;
    }
    
    .period-inputs {
        grid-template-columns: 1fr;
    }
    
    .radio-group,
    .checkbox-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .age-value {
        font-size: 3rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .result-grid {
        grid-template-columns: 1fr;
    }
    
    .calculate-btn {
        width: 100%;
    }
}