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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 420px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* メイン画面 */
.main-screen {
    padding: 20px;
    display: block;
}

.main-screen.hidden {
    display: none;
}

.title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    text-align: left;
    color: #333;
}

.form-group {
    margin-bottom: 25px;
}

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

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.form-row .form-control {
    flex: 1;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
    transition: border-color 0.3s ease;
    position: relative;
    z-index: 10;
}

.form-control:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
    z-index: 15;
}

input.form-control {
    background-image: none;
    padding-right: 16px;
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(45deg, #4285f4, #34a853);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.4);
}

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

/* 広告画面 */
.ad-screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ad-screen.show {
    display: flex;
}

.ad-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.6s ease;
}

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

.ad-title {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: bold;
}

.ad-text {
    font-size: 16px;
    margin-bottom: 30px;
    line-height: 1.8;
}

.countdown {
    font-size: 48px;
    font-weight: bold;
    color: #ffeb3b;
    margin-bottom: 20px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.countdown-text {
    font-size: 14px;
    opacity: 0.8;
}

/* 結果画面 */
.result-screen {
    display: none;
    padding: 20px;
    animation: fadeIn 0.6s ease;
}

.result-screen.show {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.result-title {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideInUp 0.6s ease;
}

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

.result-number {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
    animation: countUp 1s ease;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-text {
    font-size: 16px;
    margin-bottom: 15px;
}

.result-percentage {
    font-size: 20px;
    font-weight: bold;
    color: #ffeb3b;
}

.result-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease;
}

.result-details h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.detail-item:hover {
    background-color: #f0f0f0;
}

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

.back-btn {
    width: 100%;
    padding: 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.back-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(108, 117, 125, 0.4);
}

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

.source-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    border-left: 4px solid #4285f4;
}

.source-info h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 14px;
}

.source-info ul {
    list-style: none;
    padding-left: 0;
}

.source-info li {
    margin-bottom: 5px;
    padding-left: 15px;
    position: relative;
    line-height: 1.4;
}

.source-info li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #4285f4;
    font-weight: bold;
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }
    
    .main-screen,
    .result-screen {
        padding: 15px;
    }
    
    .title {
        font-size: 20px;
    }
    
    .ad-content {
        padding: 30px 20px;
    }
    
    .result-number {
        font-size: 36px;
    }
    
    .countdown {
        font-size: 40px;
    }
}

/* ローディングアニメーション */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* エラー表示 */
.error {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: none;
    font-weight: bold;
}

.form-control.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
    position: relative;
    z-index: 12;
}

.form-control.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
    z-index: 20;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 8px 12px;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin-top: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.error-message::before {
    content: "⚠️";
    flex-shrink: 0;
}

.error-summary {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    display: none;
}

.error-summary.show {
    display: block;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(-5px);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

/* 成功表示 */
.success {
    color: #28a745;
    font-size: 14px;
    margin-top: 5px;
}