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

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

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

.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 48px 40px;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.card::-webkit-scrollbar {
    width: 8px;
}

.card::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.card::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

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

.header h1 {
    font-size: 32px;
    color: #1f2937;
    margin-bottom: 12px;
    font-weight: 700;
}

.header p {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
}

/* メッセージ */
.message {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.error-message {
    background-color: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.success-message {
    text-align: center;
}

.success-icon {
    margin: 0 auto 16px;
    color: #10b981;
}

.success-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #065f46;
}

.success-btn {
    display: inline-block;
    padding: 12px 32px;
    background: #10b981;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.success-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* フォーム */
.contract-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.required {
    color: #ef4444;
}

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

.icon {
    position: absolute;
    left: 14px;
    color: #9ca3af;
    flex-shrink: 0;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background-color: #f9fafb;
}

.input-wrapper input::placeholder {
    color: #d1d5db;
}

/* 条件付きフィールド */
.conditional-fields {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    margin-bottom: 8px;
}

/* プラン選択 */
.plan-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.plan-label .icon {
    position: static;
    color: #667eea;
}

.plan-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    color: #1f2937;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2'%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;
    padding-right: 40px;
}

.plan-select:hover {
    border-color: #667eea;
}

.plan-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.plan-description {
    margin-top: 12px;
    padding: 12px 16px;
    background-color: #f0f9ff;
    border-left: 3px solid #667eea;
    border-radius: 6px;
    font-size: 14px;
    color: #1e40af;
    line-height: 1.6;
}

/* 契約情報表示 */
.contract-info {
    background: linear-gradient(135deg, #4b4ca2 0%, #667aea 100%);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.info-value {
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.plan-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.price {
    font-size: 20px;
    color: #ffaeae;
}

/* 契約書内容 */
.contract-content {
    background: #f9fafb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.content-header .icon {
    position: static;
    color: #667eea;
}

.content-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.terms-box {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.terms-box::-webkit-scrollbar {
    width: 8px;
}

.terms-box::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.terms-box::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.terms-box h3 {
    font-size: 15px;
    font-weight: 700;
    color: #374151;
    margin-top: 20px;
    margin-bottom: 8px;
}

.terms-box h3:first-child {
    margin-top: 0;
}

.terms-box p {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 12px;
}

.terms-box ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.terms-box li {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 6px;
}

/* チェックボックス */
.checkbox-group {
    margin-bottom: 16px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #667eea;
    flex-shrink: 0;
}

.checkbox-text {
    font-size: 14px;
    color: #374151;
    line-height: 1.6;
}

.checkbox-text .required {
    color: #ef4444;
    margin-right: 4px;
}

.inline-link {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
}

.inline-link:hover {
    color: #764ba2;
}

/* 情報セクション */
.info-section {
    margin-top: 20px;
    margin-bottom: 24px;
}

.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background-color: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
}

.info-icon {
    flex-shrink: 0;
    color: #3b82f6;
    margin-top: 2px;
}

.info-content {
    flex: 1;
}

.info-content p {
    margin: 0;
    color: #1e40af;
    font-size: 13px;
    line-height: 1.6;
}

.info-content p + p {
    margin-top: 4px;
}

/* ボタングループ */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    flex: 0 0 auto;
}

.back-btn:hover {
    background: #f0f4ff;
    transform: translateY(-2px);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* 送信ボタン */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 32px;
    background: #9ca3af;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: not-allowed;
    transition: all 0.3s ease;
}

.next-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.submit-btn.enabled {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
}

.submit-btn.enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* キャンセルリンク */
.cancel-link {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    font-size: 14px;
    color: #6b7280;
}

.link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.3s ease;
}

.link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Google ボタン */
.sso-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sso-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    gap: 10px;
}

.sso-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.google-sso {
    background: #fff;
    color: #333;
    border: 2px solid #ddd;
}

.google-sso:hover {
    border-color: #4285f4;
}

.email-toggle{
    background: #fff;
    color: #333;
    border: 2px solid #ddd;
}
.email-toggle:hover{
    border-color: #4285f4;
}

.google-icon {
    width: 24px;
    height: 24px;
}

/* メールアドレスでの登録フォーム */
.email-form {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

.email-form.active {
    max-height: 400px; /* 内容に合わせて調整 */
    opacity: 1;
    margin-top: 1rem;
}

/* メールフォーム用スタイル */
.email-form {
    display: flex;
    flex-direction: column;
    background-color: #f9fafb;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    padding: 1%;
}

.email-form .form-group {
    display: flex;
    flex-direction: column;
}

.email-form label {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    margin-top: 2%;
}

.email-form input {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1.5px solid #d1d5db;
    font-size: 15px;
    transition: all 0.3s ease;
}

.email-form input:focus {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    outline: none;
}

.email-form input::placeholder {
    color: #9ca3af;
}

/* 登録ボタン */
.email-form .submit-btn {
    margin-top: 5%;
    padding: 12px 0;
    border: none;
    border-radius: 10px;
    background: #667eea;
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.email-form .submit-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(102, 126, 234, 0.3);
}

.emailAuthFormContainer {
    padding: 2%;
    background-color: #f9fafb;
    border-radius: 12px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .card {
        padding: 32px 24px;
        max-height: 85vh;
    }

    .header h1 {
        font-size: 28px;
    }

    .header p {
        font-size: 14px;
    }

    .contract-info {
        padding: 20px;
    }

    .info-value {
        font-size: 14px;
    }

    .price {
        font-size: 18px;
    }

    .contract-content {
        padding: 20px;
    }

    .content-header h2 {
        font-size: 18px;
    }

    .terms-box {
        max-height: 250px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 24px 20px;
        max-height: 80vh;
    }

    .header h1 {
        font-size: 24px;
    }

    .contract-info {
        padding: 16px;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .info-label,
    .info-value {
        font-size: 13px;
    }

    .price {
        font-size: 16px;
    }

    .contract-content {
        padding: 16px;
    }

    .content-header h2 {
        font-size: 16px;
    }

    .terms-box {
        max-height: 200px;
        padding: 12px;
    }

    .terms-box h3 {
        font-size: 14px;
    }

    .terms-box p,
    .terms-box li {
        font-size: 13px;
    }

    .submit-btn,
    .next-btn {
        padding: 14px 24px;
        font-size: 15px;
    }

    .input-wrapper input {
        padding: 12px 12px 12px 40px;
        font-size: 16px;
    }

    .success-message {
        padding: 24px 16px;
    }

    .success-title {
        font-size: 16px;
    }

    .info-content p {
        font-size: 12px;
    }
}