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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

.powered-by {
    font-size: 12px;
    color: #999;
    margin: 0;
}

.powered-by a {
    color: #2196F3;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.powered-by a:hover {
    color: #1976D2;
    text-decoration: underline;
}

/* 入力セクション */
.input-section {
    background: white;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.input-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.input-label {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.label-title {
    font-size: 14px;
    font-weight: 600;
    color: #555;
}

.input-with-unit {
    display: flex;
    align-items: center;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 10px;
}

.input-with-unit input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 5px;
    font-size: 16px;
    text-align: right;
    outline: none;
}

.input-with-unit input:focus {
    background: white;
}

.input-with-unit input.auto-filled {
    background: #e8f5e9;
    border-left: 3px solid #4CAF50;
}

.input-with-unit .unit {
    font-size: 14px;
    color: #666;
    margin-left: 5px;
}

.calculate-btn {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    position: relative;
    overflow: hidden;
}

.calculate-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

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

.calculate-btn:disabled {
    background: #9E9E9E;
    cursor: not-allowed;
    transform: none;
}

.calculate-btn.calculating {
    background: #2196F3;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* 結果セクション */
.result-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.result-section.fade-out {
    opacity: 0.3;
    transform: scale(0.98);
}

.result-section.fade-in {
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    0% {
        opacity: 0.3;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 計算結果サマリー */
.result-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: slideInFromTop 0.5s ease;
    position: relative;
}

@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-summary p {
    font-size: 16px;
    line-height: 1.8;
    margin: 0;
    padding-right: 80px;
}

.result-summary strong {
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.result-summary .summary-detail {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 15px;
    backdrop-filter: blur(10px);
}

/* コピーボタン */
.copy-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.copy-btn.copied {
    background: rgba(76, 175, 80, 0.8);
    border-color: rgba(76, 175, 80, 1);
}

.copy-btn svg {
    width: 16px;
    height: 16px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.result-table thead {
    background: #f0f0f0;
}

.result-table th {
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #ddd;
}

.bonus-header {
    background: #e8f5e9;
    width: 120px;
}

.period-header {
    background: #f0f0f0;
}

.result-table tbody tr {
    border-bottom: 1px solid #ddd;
}

.result-table tbody tr:hover {
    background: #f9f9f9;
}

.result-table td {
    padding: 12px 8px;
    text-align: center;
    border: 1px solid #ddd;
    font-size: 14px;
}

.bonus-col {
    background: #f5f5f5;
    font-weight: 600;
}

.result-col {
    color: #333;
}

.monthly-payment {
    font-weight: 700;
    color: #2c3e50;
    font-size: 15px;
}

/* 注意書き */
.disclaimer {
    font-size: 11px;
    color: #666;
    line-height: 1.5;
    padding: 10px;
    background: #f9f9f9;
    border-left: 3px solid #f9f9f9;
    border-radius: 4px;
}

/* 情報テキスト */
.info-text {
    font-size: 12px;
    color: #666;
    padding: 10px 10px;
    font-style: italic;
}

/* SEO: イントロセクション */
.intro-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #4CAF50;
}

.intro-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    margin: 0;
}

.intro-text strong {
    color: #2c3e50;
    font-weight: 600;
}

/* SEO: 使い方セクション */
.how-to-section {
    background: white;
    padding: 30px 25px;
    margin-top: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.how-to-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.how-to-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.how-to-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border-left: 3px solid #616161;
}

.how-to-item h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.how-to-item p {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

.ratio-explanation {
    background: #fff3e0;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    border-left: 3px solid #FF9800;
}

.ratio-explanation p {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    margin: 10px 0;
}

.ratio-explanation strong {
    color: #e65100;
    font-weight: 600;
}

.features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

.features-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #4CAF50;
    font-weight: bold;
}

/* 返済比率セクション */
.ratio-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.ratio-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    padding: 10px;
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.ratio-subtitle {
    font-size: 16px;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #f5f5f5;
    border-left: 3px solid #9E9E9E;
}

.ratio-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.ratio-table thead {
    background: #e3f2fd;
}

.ratio-table th {
    padding: 12px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #ddd;
}

.ratio-table tbody tr {
    border-bottom: 1px solid #ddd;
}

.ratio-table tbody tr:hover {
    background: #f9f9f9;
}

.ratio-table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #ddd;
    font-size: 13px;
}

/* シンプルな返済比率テーブル（額面年収用） */
.ratio-table-simple {
    width: 100%;
    max-width: 400px;
    margin: 0 auto 15px;
    border-collapse: collapse;
}

.ratio-table-simple thead {
    background: #fff3e0;
}

.ratio-table-simple th {
    padding: 12px 15px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #ddd;
}

.ratio-table-simple tbody tr {
    border-bottom: 1px solid #ddd;
}

.ratio-table-simple tbody tr:hover {
    background: #fffbf5;
}

.ratio-table-simple td {
    padding: 12px 15px;
    text-align: center;
    border: 1px solid #ddd;
    font-size: 14px;
}

.period-cell {
    font-weight: 600;
    background: #fafafa;
}

.ratio-cell-simple {
    font-size: 16px;
}

.ratio-col {
    line-height: 1.8;
}

.ratio-net,
.ratio-annual {
    font-weight: 700;
    color: #2c3e50;
    font-size: 15px;
}

.ratio-net.warning,
.ratio-annual.warning {
    color: #d32f2f;
    font-weight: 800;
}

.ratio-info {
    font-size: 12px;
    color: #555;
    line-height: 1.6;
    padding: 12px;
    background: #f5f5f5;
    border-left: 3px solid #f5f5f5;
    border-radius: 4px;
    margin-top: 10px;
}

.ratio-info.warning-info {
    background: #fff3e0;
    border-left: 3px solid #fff3e0;
}

/* レスポンシブデザイン */
@media screen and (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 20px;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-label {
        min-width: 100%;
    }
    
    .calculate-btn {
        width: 100%;
        padding: 15px;
    }
    
    .result-section {
        overflow-x: auto;
    }
    
    .result-table {
        font-size: 12px;
    }
    
    .result-table th,
    .result-table td {
        padding: 8px 4px;
    }
    
    .monthly-payment {
        font-size: 13px;
    }
    
    .bonus-header {
        width: 80px;
    }
    
    .ratio-section {
        margin-top: 20px;
    }
    
    .ratio-title {
        font-size: 16px;
    }
    
    .ratio-table {
        font-size: 11px;
    }
    
    .ratio-table th,
    .ratio-table td {
        padding: 6px 2px;
    }
    
    .result-summary p {
        font-size: 14px;
        padding-right: 0;
    }
    
    .result-summary .summary-detail {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .copy-btn {
        position: static;
        margin-top: 15px;
        width: 100%;
        justify-content: center;
    }
    
    .how-to-content {
        grid-template-columns: 1fr;
    }
    
    .how-to-section {
        padding: 20px 15px;
    }
    
    .how-to-section h2 {
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {
    .result-table th,
    .result-table td {
        padding: 6px 2px;
        font-size: 11px;
    }
    
    .monthly-payment {
        font-size: 12px;
    }
    
    .bonus-col {
        font-size: 12px;
    }
}